6

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

2 Answers 2

6

Add 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)"
        ]
    }
}
2
  • This usually works but there is issue with current version of phpcs sometime installed path are blank despite defining it Jun 27, 2022 at 2:39
  • This should be the accepted answer as it does not require manual changes in any file.
    – EssGee
    Apr 14 at 12:14
3

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.