@@ -53,10 +53,7 @@ public function __construct(string $outputFile, ?ErrorFormatter $defaultFormatte
53
53
} catch (RegexpException $ e ) {
54
54
}
55
55
56
- $ outputFile = realpath ($ outputFile );
57
- if ($ outputFile !== false ) {
58
- $ this ->outputFile = $ outputFile ;
59
- }
56
+ $ this ->outputFile = str_replace (['\\' , '/ ' ], DIRECTORY_SEPARATOR , $ outputFile );
60
57
61
58
$ customTemplateFile = $ customTemplate !== null ? realpath ($ customTemplate ) : false ;
62
59
if ($ customTemplateFile !== false ) {
@@ -72,18 +69,15 @@ public function __construct(string $outputFile, ?ErrorFormatter $defaultFormatte
72
69
*/
73
70
public function formatErrors (AnalysisResult $ analysisResult , OutputStyle $ style ): int
74
71
{
72
+ if ($ this ->defaultFormatter !== null ) {
73
+ $ this ->defaultFormatter ->formatErrors ($ analysisResult , $ style );
74
+ }
75
75
try {
76
- if ($ this ->outputFile === null ) {
77
- throw new IOException ('Real path of file could not be resolved ' );
78
- }
79
76
$ this ->generateFile ($ analysisResult );
80
- $ style ->writeln ('Note: Analysis outputted into file ' . $ this ->outputFile . '. ' );
77
+ $ style ->writeln ('Note: Analysis outputted into file ' . realpath ( $ this ->outputFile ) . '. ' );
81
78
} catch (IOException $ e ) {
82
79
$ style ->error ('Analysis could not be outputted into file. ' . $ e ->getMessage ());
83
80
}
84
- if ($ this ->defaultFormatter !== null ) {
85
- $ this ->defaultFormatter ->formatErrors ($ analysisResult , $ style );
86
- }
87
81
88
82
return $ analysisResult ->hasErrors () ? 1 : 0 ;
89
83
}
0 commit comments