-
Notifications
You must be signed in to change notification settings - Fork 104
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
Update PHPStan to v2, improve code quality #1729
base: trunk
Are you sure you want to change the base?
Conversation
Strangely I cannot reproduce the https://github.com/WordPress/performance/actions/runs/12256447140/job/34191719008?pr=1729 error locally right now 🤔 I got it earlier but thought I had resolved it. |
"phpstan": "phpstan analyse --memory-limit=2048M", | ||
"phpstan": [ | ||
"composer --working-dir=phpstan install --no-interaction", | ||
"phpstan/vendor/bin/phpstan analyse --memory-limit=2048M" |
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.
So there is a new phpstan
root directory?
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.
Yes. Could also be renamed.
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.
We have an existing tools/phpstan
directory that could be reused.
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.
Hmm not sure I wanna mix the config directory with that one
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.
Since we had build-cs
before I could just rename it to that.
This is unfortunate since we previously maintained two separate I wonder if we should bump the minimum PHP version to 7.4 for the entire project to facilitate maintenance and considering that core will likely bump the minimum version to 7.4 in in the middle of 2025 per Core-62622. We could still run PHPUnit on 7.2 in GHA for now if we want to. |
Ah true, there was a Bumping requirements is of course the easiest route, but I thought we just recently discussed not bumping PHP version requirements unnecessarily if we can avoid it. |
@westonruter is it passing for you locally? |
It was removed when we bumped to PHP 7.2 in #1130. |
Summary
Fixes #776
Relevant technical choices
phpstan
folder, because PHPStan v2 requires PHP 7.4, whereas this repo requires PHP 7.2+swissspidy/phpstan-no-private
hooks.php
like in the other plugins for consistency, makes it easier to separate that code from the constant definitions inload.php