diff --git a/docs/en/plugins/php_cs_fixes.md b/docs/en/plugins/php_cs_fixes.md index 17a3491d..babb8160 100644 --- a/docs/en/plugins/php_cs_fixes.md +++ b/docs/en/plugins/php_cs_fixes.md @@ -8,7 +8,10 @@ Configuration ### Options +* **verbose** [bool, optional] - Whether to run in verbose mode (default: false) +* **diff** [bool, optional] - Whether to run with the `--diff` flag enabled (default: false) * **directory** [string, optional] - The directory in which PHP CS Fixer should work (default: `%BUILD_PATH%`) +* **rules** [string, optional] - Fixer rules (default: `@PSR2`) * **args** [string, optional] - Command line args (in string format) to pass to PHP Coding Standards Fixer (default: ``) ### Examples @@ -24,5 +27,7 @@ test: test: php_cs_fixer: directory: "%BUILD_PATH%/my/dir/path" - args: "--rules=@PSR2" + verbose: true + diff: true + rules: "@PSR2" ``` diff --git a/src/PHPCensor/Plugin/PhpCsFixer.php b/src/PHPCensor/Plugin/PhpCsFixer.php index a001a898..2cbc7bf1 100644 --- a/src/PHPCensor/Plugin/PhpCsFixer.php +++ b/src/PHPCensor/Plugin/PhpCsFixer.php @@ -13,8 +13,8 @@ use PHPCensor\Plugin; */ class PhpCsFixer extends Plugin { - protected $directory = null; - protected $args = ''; + protected $directory = null; + protected $args = ''; /** * @return string @@ -34,6 +34,18 @@ class PhpCsFixer extends Plugin if (!empty($options['args'])) { $this->args = $options['args']; } + + if (isset($options['verbose']) && $options['verbose']) { + $this->args .= ' --verbose'; + } + + if (isset($options['diff']) && $options['diff']) { + $this->args .= ' --diff'; + } + + if (isset($options['rules']) && $options['rules']) { + $this->args .= ' --rules=' . $options['rules']; + } if (isset($options['directory']) && $options['directory']) { $this->directory = $builder->interpolate($options['directory']);