|
24 | 24 | use PhpCsFixer\Console\SelfUpdate\NewVersionChecker;
|
25 | 25 | use PhpCsFixer\PharChecker;
|
26 | 26 | use PhpCsFixer\ToolInfo;
|
| 27 | +use PhpCsFixer\Utils; |
27 | 28 | use Symfony\Component\Console\Application as BaseApplication;
|
28 | 29 | use Symfony\Component\Console\Command\ListCommand;
|
29 | 30 | use Symfony\Component\Console\Input\InputInterface;
|
@@ -78,16 +79,39 @@ public function doRun(InputInterface $input, OutputInterface $output): int
|
78 | 79 | ? $output->getErrorOutput()
|
79 | 80 | : ($input->hasParameterOption('--format', true) && 'txt' !== $input->getParameterOption('--format', null, true) ? null : $output)
|
80 | 81 | ;
|
| 82 | + |
81 | 83 | if (null !== $stdErr) {
|
82 | 84 | $warningsDetector = new WarningsDetector($this->toolInfo);
|
83 | 85 | $warningsDetector->detectOldVendor();
|
84 | 86 | $warningsDetector->detectOldMajor();
|
85 |
| - foreach ($warningsDetector->getWarnings() as $warning) { |
86 |
| - $stdErr->writeln(sprintf($stdErr->isDecorated() ? '<bg=yellow;fg=black;>%s</>' : '%s', $warning)); |
| 87 | + $warnings = $warningsDetector->getWarnings(); |
| 88 | + |
| 89 | + if ($warnings) { |
| 90 | + foreach ($warnings as $warning) { |
| 91 | + $stdErr->writeln(sprintf($stdErr->isDecorated() ? '<bg=yellow;fg=black;>%s</>' : '%s', $warning)); |
| 92 | + } |
| 93 | + $stdErr->writeln(''); |
| 94 | + } |
| 95 | + } |
| 96 | + |
| 97 | + $result = parent::doRun($input, $output); |
| 98 | + |
| 99 | + if ( |
| 100 | + null !== $stdErr |
| 101 | + && $output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE |
| 102 | + ) { |
| 103 | + $triggeredDeprecations = array_unique(Utils::getTriggeredDeprecations()); |
| 104 | + sort($triggeredDeprecations); |
| 105 | + if ($triggeredDeprecations) { |
| 106 | + $stdErr->writeln(''); |
| 107 | + $stdErr->writeln($stdErr->isDecorated() ? '<bg=yellow;fg=black;>Detected deprecations in use:</>' : 'Detected deprecations in use:'); |
| 108 | + foreach ($triggeredDeprecations as $deprecation) { |
| 109 | + $stdErr->writeln(sprintf('- %s', $deprecation)); |
| 110 | + } |
87 | 111 | }
|
88 | 112 | }
|
89 | 113 |
|
90 |
| - return parent::doRun($input, $output); |
| 114 | + return $result; |
91 | 115 | }
|
92 | 116 |
|
93 | 117 | /**
|
|
0 commit comments