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
Run phpstan on staged PHP source files #5424
Run phpstan on staged PHP source files #5424
Conversation
Plugin builds for 3e4af0c are ready 🛎️!
|
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.
Excellent. Thank you.
Did you test whether this works as intended? I can't imagine static analysis being useful is not run across the whole codebase. Contrary to PHPCS, the whole point of PHPStan is to look at the whole and reason about whether the flow across the codebase makes sense everywhere. If you just look at one file, you cannot really say much about typing consistency and similar issues. |
I did test. It caught an issue with a staged file. |
This goes counter to what the author of PHPStan recommends, though: https://medium.com/@ondrejmirtes/from-minutes-to-seconds-massive-performance-gains-in-phpstan-163be88d1519 |
Ah I did not know that. So we can configure phpstan to run via the pre-commit hook then, instead of on staged files. |
Summary
This PR is a followup from #4441, which runs phpstan on staged PHP files within the
includes
orsrc
folders.Checklist