Created
August 21, 2019 14:57
-
-
Save Epskampie/427c512722b8e6c4cbf5f1340b87986b to your computer and use it in GitHub Desktop.
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
#!/bin/php | |
<?php | |
/** | |
* Helper script to use php-cs-fixer with stdin / stdout | |
**/ | |
$temp_file = tempnam(sys_get_temp_dir(), 'fix_'); | |
$input = file_get_contents("php://stdin"); | |
file_put_contents($temp_file, $input); | |
$output = []; | |
$returnCode; | |
exec('bin/php-cs-fixer fix --quiet ' . $temp_file, $output, $returnCode); | |
if ($returnCode) { | |
// Error occurred | |
exit($returnCode); | |
} | |
echo file_get_contents($temp_file); | |
unlink($temp_file); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@Epskampie you absolute hero.