File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ CHANGED_FILES=$(git diff --cached --name-only --diff-filter=ACM -- '*.php')
1616echo $CHANGED_FILES
1717
1818if [ -n " $CHANGED_FILES " ]; then
19- $PHP_CS_FIXER --config=.php_cs --verbose fix $CHANGED_FILES ;
19+ $PHP_CS_FIXER --config=$PHP_CS_CONFIG --verbose fix $CHANGED_FILES ;
2020 git add $CHANGED_FILES ;
2121fi
2222
Original file line number Diff line number Diff line change @@ -64,20 +64,21 @@ public function installGitPreHook() {
6464 throw new \Exception ('not a git project ' );
6565 }
6666
67+ $ fixFileName = 'pre-commit-cs-fix ' ;
6768 if (!file_exists ($ projectDir . '/.php_cs ' )) {
6869 $ filesystem ->copy (dirname (__DIR__ ) . '/Helper/.php_cs ' , $ projectDir . '/.php_cs ' );
6970 }
70- if (file_exists ($ hookDir . ' pre-commit-cs-fix ' )) {
71+ if (file_exists ($ hookDir . $ fixFileName )) {
7172 return true ;
7273 }
7374
74- $ filesystem ->copy (dirname (__DIR__ ) . '/Helper/pre-commit-cs-fix ' , $ hookDir . ' pre-commit-cs-fix ' );
75- $ list [] = $ hookDir . ' pre-commit-cs-fix ' ;
75+ $ filesystem ->copy (dirname (__DIR__ ) . '/Helper/pre-commit-cs-fix ' , $ hookDir . $ fixFileName );
76+ $ list [] = $ hookDir . $ fixFileName ;
7677
7778 if (file_exists ($ hookDir . 'pre-commit ' )) {
78- file_put_contents ($ hookDir . 'pre-commit ' , "\n exec " . $ hookDir . ' pre-commit-cs-fix ' , FILE_APPEND );
79+ file_put_contents ($ hookDir . 'pre-commit ' , "\n exec " . $ hookDir . $ fixFileName , FILE_APPEND );
7980 } else {
80- file_put_contents ($ hookDir . 'pre-commit ' , "#!/bin/bash \n exec " . $ hookDir . ' pre-commit-cs-fix ' );
81+ file_put_contents ($ hookDir . 'pre-commit ' , "#!/bin/bash \n exec " . $ hookDir . $ fixFileName );
8182 $ list [] = $ hookDir . 'pre-commit ' ;
8283 }
8384 $ this ->changePermission ($ list );
You can’t perform that action at this time.
0 commit comments