-
Notifications
You must be signed in to change notification settings - Fork 21
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 phpstan-phpunit and phpstan-strict-rules #105
Conversation
phil-davis
commented
Feb 9, 2023
•
edited
Loading
edited
- added phpstan-phpunit and phpstan-strict-rules to composer.json and fixed up things reported about test code.
- Add phpstan messages to ignoreErrors instead of ignoring
- fixup things reported in real code
Codecov Report
@@ Coverage Diff @@
## master #105 +/- ##
=========================================
Coverage 99.73% 99.73%
Complexity 109 109
=========================================
Files 7 7
Lines 376 376
=========================================
Hits 375 375
Misses 1 1
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Co-authored-by: Markus Staab <maggus.staab@googlemail.com>
count: 1 | ||
path: lib/Loop/Loop.php | ||
- | ||
message: "#^Instanceof between Generator<mixed, mixed, mixed, TReturn> and Generator will always evaluate to true.$#" |
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 might make sense to configure phpstan with treatPhpDocTypesAsCertain: false
since we have defensive code which makes double sure that types in phpdocs are really passed as expected
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.
I tried that locally, and it does not make any difference for this message.
Somehow PHPstan "knows" about Promises and Generator and still thinks that the check can never fail.
For now, IMO we can just keep this in ignoreErrors
@staabm please review again and merge if you think it looks OK. IMO the code changes I made are just being more explicit in "if" statements - phpstan now wants all "if" conditions to be real booleans. No more just saying |
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.
thank you
I am getting back to a backlog of sabre-io issues and PRs - there should be some action from now and over the coming weekend. |