-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Add phpdoc for constraint #42136
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
Add phpdoc for constraint #42136
Conversation
Fixing Doc blocks should be done as a bugfix on lower branches (4.4 mainly, in this case). |
I fully agree on this. If the core team now decide it's a bugfix, I'm fine doing it on 4.4 but I'd like some confirmation before doing this PR again. |
Fair enough. Sorry for the confusion. 😞 |
We try to remove phpdoc actually. |
The rule has some sens, but it's not because a property has a default value that another type is forbidden My main issue was that psalm and phpstan consider as |
That's an issue with psalm/phpstan, it might be fixed with a plugin maybe? |
So I should remove the phpdoc of property with default value and keep the others ? |
That'd work for me yes. If a default value can be added instead in some cases, that'd be even better. |
When extending some constraint and overriding some property, it's not always simple to know what can be passed to the properties and when it can be null. Those properties should have phpdoc to define their type.
Plus it avoid a psalm error
NonInvariantDocblockPropertyType
for the developer which use a more specific phpdoc (because atm, properties are considered as mixed).And, it will help the typing for PHP8 on the branch 6.0 @nicolas-grekas :)