-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
phpcbf lint-staged integration [1], force fix exit code 0.
- Loading branch information
Showing
2 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
/** | ||
* PHP Code Beautifier and Fixer fixes violations of a defined coding standard. | ||
* This version is for https://github.com/okonet/lint-staged, which requires | ||
* all success exit codes to complete its mission. | ||
* | ||
* @author Leho Kraav <leho@cxl.com> | ||
* @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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters