1

I am searching for a way to check my PHP code for compatibility with different PHP versions. Especially compatibility to PHP version 7.2 - 8.1 is what I am looking for. At first I tried phpcs but the results were not really good, so I tried something different.

To test the code I introduced phpstan which works really well (for one PHP version) but it seems it is only possible to specify one PHP version per configuration.

My phpstan.neon file:

parameters:
        level: 0
        phpVersion: 70400
        paths:
                - src/project
                - src/library

Running vendor/bin/phpstan -c phpstan.neon works as expected.

Tried to specify more than one value for phpVersion but this only produces an error because the argument has to be int|null value.

Does anyone know a method to check more than one PHP vesion in just one run of phpstan? Maybe there is an appropriate rule set for different PHP versions?

maxhb
  • 8,554
  • 9
  • 29
  • 53

0 Answers0