File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -59,15 +59,16 @@ public function installGitPreHook() {
5959 $ config = $ this ->composer ->getConfig ();
6060 $ filesystem = new Filesystem ();
6161 $ projectDir = dirname ($ filesystem ->normalizePath (realpath (realpath ($ config ->get ('vendor-dir ' )))));
62+ if (!file_exists ($ projectDir . '/.php-cs-fixer.php ' )) {
63+ $ filesystem ->copy (dirname (__DIR__ ) . '/Helper/.php-cs-fixer.php ' , $ projectDir . '/.php-cs-fixer.php ' );
64+ }
65+
6266 $ hookDir = $ projectDir . '/.git/hooks/ ' ;
6367 if (!file_exists ($ hookDir )) {
64- throw new \ Exception ( ' not a git project ' ) ;
68+ return true ;
6569 }
6670
6771 $ fixFileName = 'pre-commit-cs-fix-30 ' ;
68- if (!file_exists ($ projectDir . '/.php-cs-fixer.php ' )) {
69- $ filesystem ->copy (dirname (__DIR__ ) . '/Helper/.php-cs-fixer.php ' , $ projectDir . '/.php-cs-fixer.php ' );
70- }
7172 if (file_exists ($ hookDir . $ fixFileName )) {
7273 return true ;
7374 }
You can’t perform that action at this time.
0 commit comments