Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Validator] Enhance PHPDoc onConstraint::getTargets()#58493
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
b2b9050 to987af2fCompare| * Constraint::CLASS_CONSTRAINT and Constraint::PROPERTY_CONSTRAINT. | ||
| * | ||
| * @return string|string[] One or more constant values | ||
| * @return self::CLASS_CONSTRAINT|self::PROPERTY_CONSTRAINT|array<self::CLASS_CONSTRAINT|self::PROPERTY_CONSTRAINT> One or more constant values |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
wouldn't this work?
| * @return self::CLASS_CONSTRAINT|self::PROPERTY_CONSTRAINT|array<self::CLASS_CONSTRAINT|self::PROPERTY_CONSTRAINT> Oneor more constant values | |
| * @return self::*_CONSTRAINT|array<self::*_CONSTRAINT> Oneor more constant values |
alexandre-dauboisOct 8, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
It works:https://phpstan.org/r/e511c5d3-eacc-4d1d-b9b3-c45683a3429f
I hesitated, because we could unintentionally include new constants ending with_CONSTRAINT. But if it seems OK to you, I'm fine with it 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
It appears to not work for Psalm (https://psalm.dev/r/25734b245c), which is a requirement for us (as this is what we use in our own CI).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Oh right, let's keep it as-is then. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
then:
| * @return self::CLASS_CONSTRAINT|self::PROPERTY_CONSTRAINT|array<self::CLASS_CONSTRAINT|self::PROPERTY_CONSTRAINT> Oneor more constant values | |
| * @return self::CLASS_CONSTRAINT|self::PROPERTY_CONSTRAINT|array<self::CLASS_CONSTRAINT|self::PROPERTY_CONSTRAINT> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Indeed!
7f5ce66 tobc81173Comparebc81173 to5492bf4CompareThank you@alexandre-daubois. |
5cabe45 intosymfony:7.2Uh oh!
There was an error while loading.Please reload this page.
…return types (xabbuh)This PR was merged into the 7.2 branch.Discussion----------[ErrorHandler] resolve class constant types when patching return types| Q | A| ------------- | ---| Branch? | 7.2| Bug fix? | yes| New feature? | no| Deprecations? | no| Issues || License | MITaccount for types like the ones added in#58493Commits-------01eb32c resolve class constant types when patching return types
Uh oh!
There was an error while loading.Please reload this page.
Provides better static analysis on constraints.