Skip to content

AccessType attribute constructor expects array #1531

@SimonTod

Description

@SimonTod
Q A
Bug report? yes
Feature request? no
BC Break report? yes
RFC? no

As declared in the documentation, the next annotation works

use JMS\Serializer\Annotation\AccessType;

/** @AccessType("public_method") */
class User { }

But I could not make it work using the php attribute

use JMS\Serializer\Annotation\AccessType;

#[AccessType('public_method')]
class User { }

Error thrown :

Uncaught Error: JMS\Serializer\Annotation\AccessType::__construct(): Argument #1 ($values) must be of type array, string given

As we can see in https://github.com/schmittjoh/serializer/blob/master/src/Annotation/AccessType.php#L24 :

    public function __construct(array $values = [], ?string $type = null)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions