Skip to content

The type integration does not properly support enumType on an array-based type #478

@stof

Description

@stof

Currently, the resolution of doctrine types considers that any field that uses enumType will have a PHP type of new ObjectType($enumType) (potentially nullable depending on the nullability of the field).

This is a wrong assumption about the way this feature works in the Doctrine ORM. The enumType feature supports 2 cases:

  • if the converted field value (based on the DBAL type of the field) is a scalar, it gets turned into an enum instance
  • if the converted field value is an array, each value of the array gets turned into an enum instance

That second case is not supported by phpstan-doctrine, reporting the wrong type.
Both QueryResultTypeWalker and EntityColumnRule are impacted by that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions