Ignore missingType.iterableValue for data-providers#246
Ignore missingType.iterableValue for data-providers#246ondrejmirtes merged 9 commits intophpstan:2.0.xfrom
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.
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.
|
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