-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Fix type hint on OrderBy attribute #11779
Conversation
PHPStan 2.0 does not accept a string backed enum as a string.
Please retarget to 2.20.x, I think it also applies here. |
It was completely rewritten for 3.x so needs a different change: https://github.com/doctrine/orm/blob/2.20.x/src/Mapping/OrderBy.php I doubt it's really worth targeting 2.x as the error only occurs when picking up on the deprecation of |
ORM2 version of doctrine#11779
Created #11780 targetting 2.20.x |
Given the static analysis error, I guess targeting 2 is indeed not worth it. Sorry for the confusion. |
Do we really allow the |
The deprecation explicitly replaces the Which is a backed enum: But, come to think of it, the deprecation may just be triggered horribly wrong here as I vaguely recall Doctrine ORM having major internal inconsistencies here and requiring the literal |
None of our test cases use the enum for this attribute which indeed still demands a string. This change is not correct, sorry. |
Yep, just checked and using the enum causes some horrible crashes, so closing the PR is correct ofc. But erm, are we ever going to fix the horrible inconsistencies here? Because I don't see why we're insisting on using constant magic strings (a strict no-go in every software architecture book) instead of relying on a well defined predictable enum of a direct dependency. |
There's a discussion on this somewhere in this tracker, but I'm on a phone and can't look this up right now. |
At #11313 |
PHPStan 2.0 does not accept a string backed enum as a string.