Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[symfony/property-info] Can't handle Collection annotations #57634

Copy link
Copy link
Closed
@bumburoom

Description

@bumburoom
Issue body actions

Symfony version(s) affected

6.4.9

Description

The property reader symfony/property-info/Util/PhpStanTypeHelper.php doesn't recognized the type of a collection property and try to access an not existing array key at line 169.

return [new Type($subTypes[0]->getBuiltinType(), true, $subTypes[0]->getClassName(), $subTypes[0]->isCollection(), $subTypes[0]->getCollectionKeyTypes(), $subTypes[0]->getCollectionValueTypes())];

How to reproduce

The property with annotation like that can be successful extracted

/** @var ?Permission[] $permissions*/
public ?array $permissions = null;

The following annotation can not be extracted and cause a PHP warning "Undefined array key 0"
/** @var ?Collection<int, Permission> $permissions*/
public ?Collection $permissions = null;

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.