diff --git a/bin/phpcbf-fix-exit-0 b/bin/phpcbf-fix-exit-0 new file mode 100755 index 0000000..b9f0084 --- /dev/null +++ b/bin/phpcbf-fix-exit-0 @@ -0,0 +1,25 @@ +#!/usr/bin/env php + + * @see https://github.com/squizlabs/PHP_CodeSniffer/blob/master/bin/phpcbf + * @see https://github.com/squizlabs/PHP_CodeSniffer/issues/1359 + */ + +if (is_file(__DIR__.'/../../../squizlabs/php_codesniffer/autoload.php') === true) { + include_once __DIR__.'/../../../squizlabs/php_codesniffer/autoload.php'; +} else { + include_once 'PHP/CodeSniffer/autoload.php'; +} + +$runner = new PHP_CodeSniffer\Runner(); +$exitCode = $runner->runPHPCBF(); + +if ( 1 === $exitCode ){ + $exitCode = 0; +} +exit($exitCode); diff --git a/composer.json b/composer.json index ef5009e..9ea5c67 100644 --- a/composer.json +++ b/composer.json @@ -2,6 +2,9 @@ "name": "cxl/phpcs-ruleset", "description": "PHP CS coding standards for CXL projects.", "type": "phpcodesniffer-standard", + "bin": [ + "bin/phpcbf-fix-exit-0" + ], "require": { "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", "wp-coding-standards/wpcs": "^2.3"