Can I use PHPStan for PHP version compatibility analysis? #10597
Replies: 1 comment 1 reply
-
Hello, You can also analyse any code on phpstan.org/try and if there are differences between PHP versions, it will result in different errors being showed in tabs grouped by PHP versions there. But of course the support is not totally comprehensive and complete. "Report natively typed properties on PHP versions lower than 7.4" is simply a feature request that could be implemented in PHPStan pretty easily. |
Beta Was this translation helpful? Give feedback.
-
Let's say I have a package that should support PHP >=7.3. Can I run phpstan with parameter
phpVersion: 70300
and it will report all the features that are not compatibile with PHP 7.3+?I'm asking this because I've started to setup php-compatibility package but after a while this thought came up to me: "Do I need another package for this? Maybe PHPStan is smart enought to report the usage of features that do not exist in given PHP version"?
P.S. Of course I've played with PHPStan but it looks that something is missing, e.g. it reports promoted constructor properties (8.0) but not typed properties (7.4). That's why I'm asking in general whether PHPStan is a tool that can be used for PHP version compatibility checking.
Beta Was this translation helpful? Give feedback.
All reactions