Skip to content

ReflectionExtractor does not extract from property with declared type (PHP 7.4) #36425

@pszalko

Description

@pszalko

Symfony version(s) affected: symfony/property-info v5.0.7 (probably all versions) with PHP 7.4

Description
ReflectionExtractor does not extract property type from properties with declared type.

How to reproduce

class ProjectCreateRequest
{
    public ProjectModel $project;
}

$expectedType = $extractor->getTypes(ProjectCreateRequest::class, 'project');

Current implementation:

  • $expectedType is null

Expected implementation:

  • $expectedType refers to the class ProjectModel as type for property project.
  • declared type takes precedence before mutators, accessors or constructor

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