PHP Compatibility - Compatibility check

28.03.2023 | 445 | SQL

Checking the compatibility of the code with the PHP version

Installing the verification tool using the compositor:
composer require phpcompatibility/php-compatibility
Adding "scripts" to composer.json:
{
    "require-dev": {
        "phpcompatibility/php-compatibility": "^9.3"
    },
    "scripts": {
        "post-install-cmd": "\"vendor/bin/phpcs\" --config-set installed_path vendor/phpcompatibility/php-compatibility",
        "post-update-cmd" : "\"vendor/bin/phpcs\" --config-set installed_paths vendor/phpcompatibility/php-compatibility"
    }
}
Running a check with writing the result to a file:
./vendor/bin/phpcs -p your_project_folder/ --standard=PHPCompatibility --runtime-set testVersion 7.3  > report.txt -n
"n" - outputs only errors


← Back

Comments (0)