CLI tools for running PHP code checks and refactoring for Pimcore
composer require --dev zieglerh/php-code-quality:^1.0
Copy /templates/*
into your project root folder
In your .env
file you can define a path to overwrite the rulesets, e.g. from your project root
PHPCS_RULESET_FILE=./phpcs.xml
PHPMD_RULESET_FILE=./phpmd.xml
You can disable tools in your .env
file by setting the following
PHPCS=0
PHPMD=0
PHPSTAN=0
or disable all of them with
CODE_CHECKS_ENABLED=0
You can also overwrite tool arguments from definition_args.conf
in your .env
file
PHPCS_ARGS=...
PHPMD_ARGS=...
PHPSTAN_ARGS=...
vendor/bin/code-check
To execute only specific tools, you can append one or multiple arguments
vendor/bin/code-check phpcs phpmd phpstan
Display automatic code refactoring
vendor/bin/rector process --dry-run
Run rector and change all files
vendor/bin/rector process
For configuration of tools see defnitions_tools.conf
Rulesets are defined inside the rulesets/*.xml files and can be overwritten