@@ -110,13 +110,19 @@ protected function execute(InputInterface $input, OutputInterface $output): int
110110 $ useBaseline = (string ) $ input ->getOption (self ::USE_BASELINE_PARAM );
111111 $ skipBaseline = (bool ) $ input ->getOption (self ::SKIP_BASELINE_PARAM );
112112 $ ignoreBaselineLinenumbers = (bool ) $ input ->getOption (self ::IGNORE_BASELINE_LINENUMBERS_PARAM );
113+ $ phpVersion = $ input ->getOption ('target-php-version ' );
113114 $ format = $ input ->getOption (self ::FORMAT_PARAM );
114- $ onlyErrors = Printer::FORMAT_JSON === $ format || Printer::FORMAT_GITLAB === $ format ;
115115
116116 // we write everything on STDERR apart from the list of violations which goes on STDOUT
117+ // this allows to pipe the output of this command to a file while showing output on the terminal
117118 $ stdOut = $ output ;
118119 $ output = $ output instanceof ConsoleOutputInterface ? $ output ->getErrorOutput () : $ output ;
119120
121+ /** @var string|null $phpVersion */
122+ $ targetPhpVersion = TargetPhpVersion::create ($ phpVersion );
123+
124+ $ progress = $ verbose ? new DebugProgress ($ output ) : new ProgressBarProgress ($ output );
125+
120126 if (true !== $ skipBaseline && !$ useBaseline && file_exists (self ::DEFAULT_BASELINE_FILENAME )) {
121127 $ useBaseline = self ::DEFAULT_BASELINE_FILENAME ;
122128 }
@@ -131,12 +137,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
131137
132138 $ generateBaseline = $ input ->getOption (self ::GENERATE_BASELINE_PARAM );
133139
134- /** @var string|null $phpVersion */
135- $ phpVersion = $ input ->getOption ('target-php-version ' );
136- $ targetPhpVersion = TargetPhpVersion::create ($ phpVersion );
137-
138- $ progress = $ verbose ? new DebugProgress ($ output ) : new ProgressBarProgress ($ output );
139-
140140 $ this ->printHeadingLine ($ output );
141141
142142 $ rulesFilename = $ this ->getConfigFilename ($ input );
@@ -148,7 +148,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
148148 $ this ->readRules ($ config , $ rulesFilename );
149149
150150 $ runner = new Runner ($ stopOnFailure );
151- $ runner ->run ($ config , $ progress , $ targetPhpVersion, $ onlyErrors );
151+ $ runner ->run ($ config , $ progress , $ targetPhpVersion );
152152
153153 $ violations = $ runner ->getViolations ();
154154 $ violations ->sort ();
@@ -255,8 +255,4 @@ private function getConfigFilename(InputInterface $input): string
255255
256256 return $ filename ;
257257 }
258-
259- private function printNoViolationsDetectedMessage (OutputInterface $ output , bool $ onlyErrors = false , string $ format = Printer::FORMAT_TEXT ): void
260- {
261- }
262258}
0 commit comments