-
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
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 (?)
- take advantage of the DataProviderDataRule
- without enabling the DataProviderReturnTypeIgnoreExtension
Would it be ok to have such option ?
Maybe like
checkDataProviderData: %featureToggles.bleedingEdge%
ignoreDataProviderReturnType: %featureToggles.bleedingEdge%
PHPStan\Type\PHPUnit\DataProviderReturnTypeIgnoreExtension:
phpstan.ignoreErrorExtension: %phpunit.ignoreDataProviderReturnType%
or
checkDataProviderData: %featureToggles.bleedingEdge%
checkDataProviderReturnType: false
PHPStan\Type\PHPUnit\DataProviderReturnTypeIgnoreExtension:
phpstan.ignoreErrorExtension: [%phpunit.ignoreDataProviderReturnType%, not(%phpunit.checkDataProviderReturnType%)]
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 reportMissingDataProviderReturnType that would default to false. You could set it to true to disable the ignore errors extension.
Feel free to send a PR.
Feel free to send a PR.
Like this #253 ?
Uh oh!
There was an error while loading. Please reload this page.
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