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.
I suspect this is because you're using a version of
PHPCompatibilitythat 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
developbranch, and so you will need to specifydev-developin yourcomposer.jsonto be able to run checks for those versions.This should switch you to the
dev-developbranch: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-developallowed it to be detected properly while using thePHPCompatibilitystandard withphpcs.