Update PHPStan to v2, improve code quality#1729
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.
So there is a new phpstan root directory?
There was a problem hiding this comment.
Yes. Could also be renamed.
There was a problem hiding this comment.
We have an existing tools/phpstan directory that could be reused.
There was a problem hiding this comment.
Hmm not sure I wanna mix the config directory with that one
There was a problem hiding this comment.
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
phpstanfolder, because PHPStan v2 requires PHP 7.4, whereas this repo requires PHP 7.2+swissspidy/phpstan-no-privatehooks.phplike in the other plugins for consistency, makes it easier to separate that code from the constant definitions inload.php