File tree 1 file changed +22
-4
lines changed
src/PhpGitHooks/Infrastructure/PhpCsFixer
1 file changed +22
-4
lines changed Original file line number Diff line number Diff line change 4
4
5
5
use IgnoreFiles \IgnoreFiles ;
6
6
use PhpGitHooks \Application \Message \MessageConfigData ;
7
+ use PhpGitHooks \Command \BadJobLogo ;
7
8
use PhpGitHooks \Command \OutputHandlerInterface ;
8
9
use PhpGitHooks \Infrastructure \Common \InteractiveToolInterface ;
9
10
use PhpGitHooks \Infrastructure \Common \ToolHandler ;
@@ -75,10 +76,11 @@ public function run(array $messages)
75
76
}
76
77
77
78
if ($ errors ) {
78
- $ this ->writeOutputError (
79
- new PhpCsFixerException (implode ('' , $ errors )),
80
- $ messages [MessageConfigData::KEY_ERROR_MESSAGE ]
81
- );
79
+ $ this ->outputHandler ->setError ($ this ->getErrors ($ errors ));
80
+ $ this ->output ->writeln ($ this ->outputHandler ->getError ());
81
+ $ this ->output ->writeln (BadJobLogo::paint ($ messages [MessageConfigData::KEY_ERROR_MESSAGE ]));
82
+
83
+ throw new PhpCsFixerException ();
82
84
}
83
85
84
86
$ this ->output ->writeln ($ this ->outputHandler ->getSuccessfulStepMessage ());
@@ -116,4 +118,20 @@ public function setLevels(array $levels)
116
118
{
117
119
$ this ->levels = $ levels ;
118
120
}
121
+
122
+ /**
123
+ * @param array $errors
124
+ *
125
+ * @return null|string
126
+ */
127
+ private function getErrors (array $ errors )
128
+ {
129
+ $ errorText = null ;
130
+
131
+ foreach ($ errors as $ error ) {
132
+ $ errorText .= trim ($ error )."\n" ;
133
+ }
134
+
135
+ return $ errorText ;
136
+ }
119
137
}
You can’t perform that action at this time.
0 commit comments