For php8.1 and with the latest Magento coding standards we are facing below error while running the static test from CLI and PHPStorm
ERROR: Referenced sniff "PHPCompatibility.FunctionUse.RemovedFunctions" does not exist
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityAdd the phpcompatibility/php-compatibility
ruleset to the composer.json
using post-install-cmd
:
{
"scripts": {
"post-install-cmd": [
"([ $COMPOSER_DEV_MODE -eq 0 ] || vendor/bin/phpcs --config-set installed_paths ../../magento/magento-coding-standard/,../../phpcompatibility/php-compatibility)"
]
}
}
This is known issue with Magento coding standards and temporary workaround is to add below code
$resolvedInstalledPaths[] = '/path/to/your/project/vendor/phpcompatibility/php-compatibility/PHPCompatibility';
$resolvedInstalledPaths[] = $installedPath;
}
return $resolvedInstalledPaths;
to
\PHP_CodeSniffer\Util\Standards::getInstalledStandardPaths