-
Notifications
You must be signed in to change notification settings - Fork 50
Ignore missingType.iterableValue for data-providers #246
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
Conversation
|
|
||
| public function shouldIgnore(Error $error, Node $node, Scope $scope): bool | ||
| { | ||
| if (! $node instanceof InClassMethodNode) { // @phpstan-ignore phpstanApi.instanceofAssumption |
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.
This assumes an implementation detail that missingType.iterableValue is reported by a rule that hooks onto InClassMethodNode.
You can remove this instanceof and just ask for $scope->isInClass(), $scope->getFunction() etc.
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.
|
BTW I love this, it's genius :) |
|
Thank you! |
|
@staabm @ondrejmirtes Is there an easy way to (?)
Would it be ok to have such option ? Maybe like or if such syntax exists... In our codebase, we appreciate the fact PHPStan enforce the detailed phpdoc of iterable (for documentation purpose), and even if the return/yield statement are now checked, we still find some interest in the required phpdoc. |
|
So I realize I don't want to have a long-term option for turning off DataProviderDataRule. I only want it to be conditional now in 2.x based on bleedingEdge. As for the data provider return types, I can imagine there to be an option named something like Feel free to send a PR. |
Like this #253 ? |
As we are now validating data-providers by its return/yield statements, I think we should no longer throw a
error onto the PHPStan user
requires phpstan/phpstan-src#4488