Skip to content

[ObjectMapper] Map attribute PHPDoc does not match TargetClass for $if param #63273

@fishgit

Description

@fishgit

Symfony version(s) affected

8.0.5

Description

PHPdoc annotation in \Symfony\Component\ObjectMapper\Attribute\Map constructor for $if parameter does not include \Symfony\Component\ObjectMapper\Condition\TargetClass as allowed type.

PHPStan error:
Parameter $if of attribute class Symfony\Component\ObjectMapper\Attribute\Map constructor expects bool|(callable(mixed, object): bool)|string|null, Symfony\Component\ObjectMapper\Condition\TargetClass<App\ExampleClass> given.

How to reproduce

Using if with TargetClass in Map attribute.

Example:

#[Map(if: new TargetClass(ExampleClass::class))]

Possible Solution

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions