I've been searching and reading and hunting and pulling my hair. This is the only mention of phpVersion
: https://phpstan.org/config-reference#phpversion
If you want to analyse a codebase as if it was written for a different PHP version than you’re currently running, change the phpVersion parameter:
parameters:
phpVersion: 70400 # PHP 7.4
What the...? "70400"? Why this weird format? Does that mean that PHP 8.1 is supposed to be written as "80100"? This really confuses me. I've never see this format before, and it's not mentioned with one single word.
Also, I have to put this into the .neon config? I cannot specify it on the command line? That really further complicates things needlessly.
It’s the same format the PHP_VERSION_ID
constant uses.
So you can just type php -r "echo PHP_VERSION_ID . PHP_EOL;"
to get it.
If you want to emulate another version, you can do:
$otherVersion = "8.0.0";
$version = explode('.', $otherVersion);
echo $version[0] * 10000 + $version[1] * 100 + $version[2];
# would print 80000
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With