@@ -53,10 +53,7 @@ public function __construct(string $outputFile, ?ErrorFormatter $defaultFormatte
5353 } catch (RegexpException $ e ) {
5454 }
5555
56- $ outputFile = realpath ($ outputFile );
57- if ($ outputFile !== false ) {
58- $ this ->outputFile = $ outputFile ;
59- }
56+ $ this ->outputFile = str_replace (['\\' , '/ ' ], DIRECTORY_SEPARATOR , $ outputFile );
6057
6158 $ customTemplateFile = $ customTemplate !== null ? realpath ($ customTemplate ) : false ;
6259 if ($ customTemplateFile !== false ) {
@@ -72,18 +69,15 @@ public function __construct(string $outputFile, ?ErrorFormatter $defaultFormatte
7269 */
7370 public function formatErrors (AnalysisResult $ analysisResult , OutputStyle $ style ): int
7471 {
72+ if ($ this ->defaultFormatter !== null ) {
73+ $ this ->defaultFormatter ->formatErrors ($ analysisResult , $ style );
74+ }
7575 try {
76- if ($ this ->outputFile === null ) {
77- throw new IOException ('Real path of file could not be resolved ' );
78- }
7976 $ this ->generateFile ($ analysisResult );
80- $ style ->writeln ('Note: Analysis outputted into file ' . $ this ->outputFile . '. ' );
77+ $ style ->writeln ('Note: Analysis outputted into file ' . realpath ( $ this ->outputFile ) . '. ' );
8178 } catch (IOException $ e ) {
8279 $ style ->error ('Analysis could not be outputted into file. ' . $ e ->getMessage ());
8380 }
84- if ($ this ->defaultFormatter !== null ) {
85- $ this ->defaultFormatter ->formatErrors ($ analysisResult , $ style );
86- }
8781
8882 return $ analysisResult ->hasErrors () ? 1 : 0 ;
8983 }
0 commit comments