Reputation: 21
I am running phpcs with the following command:
php -d memory_limit=-1 vendor/bin/phpcs -v -p . --standard=PHPCompatibility --extensions=php --colors --runtime-set testVersion 8.1
However, it is only finding deprecation and errors for PHP 7.4 and below. If I set testVersion
to any PHP version of 7.4 or below, it works as expected. With the above command, it only finds compatibility issues for 7.4.
To test, I added a new deprecation and removed function from 8.1 and it does not detect them.
Upvotes: 2
Views: 1527
Reputation: 483
I suspect this is because you're using a version of PHPCompatibility
that does not yet know about PHP 8.x features. The current tagged release, as of this writing, is 9.3.5, which was released on Dec 27, 2019.
It appears that compatibility checks for PHP 8.0, 8.1, and 8.2 only exist in the develop
branch, and so you will need to specify dev-develop
in your composer.json
to be able to run checks for those versions.
This should switch you to the dev-develop
branch:
composer require --dev phpcompatibility/php-compatibility dev-develop
I was in a similar situation (I have code I know is not supported in PHP 8.x, but was not being flagged) and switching to dev-develop
allowed it to be detected properly while using the PHPCompatibility
standard with phpcs
.
Upvotes: 3