Reputation: 95
I am trying to check for errors via phpcs and PHPCompatibility standard on a laravel project, here is the command:
phpcs -psvw app --extensions=php --standard=PHPCompatibility --runtime-set testVersion 8.0
The command works fine. However, I am supposed to receive following error but I am not:
Deprecated: Method ReflectionParameter::getClass() is deprecated in somefile.php on line 838
The actual code where PHP8 fails but PHPCS does not inform:
$results[] = is_null($dependency->getClass()) ? $this->resolvePrimitive($dependency) : $this->resolveClass($dependency);
The reason PHPCompatibility standard should tell me about this error is that when I try to run my app in PHP 8 I get above error, however PHPCS with PHPCompatibility does not report above error.
Any idea how can I make PHPCompatibility report above error ?
Upvotes: 1
Views: 504
Reputation: 31
After some investigation it seems the standard is, for whatever reason, not aware of this particular deprecation.
ReflectionParameter::getClass()
is not yet removed (even in PHP 8.4), so we don't get a removal error from the sniffer, either.
Even so, I think the sniffer will still always give plenty of warning of a function being fully removed, so there is no huge cause for concern here. Make sure to take note of runtime deprecation errors as well, as part of a complete strategy for preparing for a PHP upgrade.
Upvotes: 0