Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
stof opened this issue Oct 18, 2023 · 2 comments
Open

Comments

@stof
Copy link
Contributor

stof commented Oct 18, 2023

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.

@ondrejmirtes
Copy link
Member

This is easy to fix, the right code in EntityColumnRule will make it work.

@ondrejmirtes
Copy link
Member

And yeah, you'll have to touch QueryResultTypeWalker too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants