tomaraoo / yii2-pint
A fast parallel code-style formatter for Yii2 projects across PHP 5.6 and modern PHP versions.
Requires
- php: >=5.6
- squizlabs/php_codesniffer: ^3.7
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
tomaraoo/yii2-pint is a parallel code-style checker and formatter for Yii2 projects. Its command-line code is compatible with PHP 5.6 and modern PHP releases.
Installation
composer require --dev tomaraoo/yii2-pint
PHP_CodeSniffer 3.x supports PHP 5.4 and newer. This package requires PHP 5.6 or newer and uses PHPCS/PHPCBF as its formatting engine.
Usage
Format the current project:
vendor/bin/yii2-pint --parallel
Check formatting without changing files:
vendor/bin/yii2-pint check --parallel
Choose the number of workers:
vendor/bin/yii2-pint fix --parallel=8 common backend frontend
Process only Git changes:
vendor/bin/yii2-pint --dirty vendor/bin/yii2-pint check --staged
Configuration
Copy yii2-pint.example.json to yii2-pint.json in the consuming project:
{
"paths": ["common", "backend", "frontend", "console"],
"exclude": ["vendor/*", "runtime/*", "*/web/assets/*"],
"extensions": ["php"]
}
Set standard to a project-relative PHPCS ruleset when additional rules are needed:
{
"standard": "phpcs.xml",
"paths": ["common", "backend"]
}
Commands and exit codes
fixis the default command. It returns0when files are clean or all fixable violations were corrected.checknever changes files and returns a non-zero status when violations exist.- Invalid configuration and unavailable tooling return
2.
Runtime support
The package source intentionally avoids PHP 7+ language features. CI should test PHP 5.6 and currently supported modern PHP versions before each release.