markus staab
software development with passion - open-source lover, creator of staabm/phpstan-dba, excessive freetime @phpstan@phpc.social, @rectorphp and @phpunit@phpc.social contributor
@OndrejMirtes@phpc.social had another great idea to speedup #phpstan analysis
Implementing it was easier than expected :-)
my non-scientific benchmark suggests running #PHPStan on #wordpress core, will be a lot faster starting with the next release
It was a pleasure to work with @misterdeviling@bird.makeup thru a lot of old #PHPStan bugs. Yesterdays release contains a massive package of fixes.
while we concentrated on the maintenance parts, @OndrejMirtes@phpc.social could concentrate his efforts on improving DX with better docs and other nice additions.
Recently I learned that the order in which you pass options to a CLI command can have a huge perf impact on the runtime (even if it leads the same result)
I recently learned that git bisect has a "run" subcommand, which allows you to automate the bisect process.
in a blog post I am describing how you can find a regression commit in phpstan-src.
the same approach works for any git based project.
In case your daily #phpstan run takes minutes instead of seconds you likely don’t utilize the result cache.
Find solutions at https://staabm.github.io/2023/10/21/phpstan-result-cache-gotchas.html
Starting with #phpstan 2.1.39 in case we know constants are deprecated only in certain php versions, we no longer error about them, when used in a `if (PHP_VERSION_ID < 80400) {`-like condition.
see E_STRICT before PHP 8.4:
https://phpstan.org/r/0dc9fe34-0c60-4254-9174-f37e910cb4cf
TIL: your github action might fail because of a overlong command line, which gets cut without further notice.
Not sure its a #php or #windows or #githubactions effect.
1:1 the same command works on a ubuntu based github action without error
@edorian@phpc.social I agree. See my comment in the fixing PR
while I think this is just a workaround for a more general problem - I see no way atm to find out which ENV vars are relevant for us and which are not
The fact that nobody reported a problem and I found this bug just by incident, tells me that it seems not „broken enough“ to spent time on it though.
It seems we don’t invalidate waaay to often and spam temp-cache files and we don‘t cache too aggressively and produce bugs.
contributed to #phpstan by @zonuexe@phpc.social: PHPStan will have a better idea about purity of callables taking a callback argument.
for example will array_map($pureCb, $arr) be considered pure:
- less false positives
- better dead code detection
In case you think #phpstan is running too slow, have a look at the result of running phpstan analyze command with -vv and check whether it utilizes the result cache
When the result cache is warm, it should be wicked fast
in CI you likely need to persist the cache manually
see https://phpstan.org/user-guide/result-cache#setup-in-continuous-integration
