|
2 | 2 |
|
3 | 3 | namespace PHPStan\Command; |
4 | 4 |
|
| 5 | +use DateTimeImmutable; |
5 | 6 | use OndraM\CiDetector\CiDetector; |
6 | 7 | use Override; |
7 | 8 | use PHPStan\Analyser\InternalError; |
|
35 | 36 | use Symfony\Component\Console\Input\InputInterface; |
36 | 37 | use Symfony\Component\Console\Input\InputOption; |
37 | 38 | use Symfony\Component\Console\Input\StringInput; |
| 39 | +use Symfony\Component\Console\Output\ConsoleOutputInterface; |
38 | 40 | use Symfony\Component\Console\Output\OutputInterface; |
39 | 41 | use Symfony\Component\Console\Output\StreamOutput; |
40 | 42 | use Throwable; |
|
63 | 65 | use function stream_get_contents; |
64 | 66 | use function strlen; |
65 | 67 | use function substr; |
| 68 | +use function time; |
66 | 69 | use const PATHINFO_BASENAME; |
67 | 70 | use const PATHINFO_EXTENSION; |
68 | 71 |
|
@@ -140,6 +143,34 @@ protected function initialize(InputInterface $input, OutputInterface $output): v |
140 | 143 | #[Override] |
141 | 144 | protected function execute(InputInterface $input, OutputInterface $output): int |
142 | 145 | { |
| 146 | + if ($output instanceof ConsoleOutputInterface) { |
| 147 | + $errorOutput = $output->getErrorOutput(); |
| 148 | + $errorOutput->writeln(''); |
| 149 | + $errorOutput->writeln("⚠️ You're running an old version of PHPStan.️"); |
| 150 | + $errorOutput->writeln(''); |
| 151 | + $errorOutput->writeln('The last release in the 1.12.x series with new features'); |
| 152 | + |
| 153 | + $lastRelease = new DateTimeImmutable('2025-07-17 00:00:00'); |
| 154 | + $daysSince = (time() - $lastRelease->getTimestamp()) / 60 / 60 / 24; |
| 155 | + $errorOutput->writeln('and bugfixes was released on <fg=red>July 17th 2025</>,'); |
| 156 | + $errorOutput->writeln(sprintf('that\'s <fg=red>%d days ago.</>', (int) $daysSince)); |
| 157 | + $errorOutput->writeln(''); |
| 158 | + |
| 159 | + $errorOutput->writeln('Since then more than <fg=cyan>65 new PHPStan versions</> were released'); |
| 160 | + $errorOutput->writeln('with hundreds of new features, bugfixes, and other'); |
| 161 | + $errorOutput->writeln('quality of life improvements.'); |
| 162 | + $errorOutput->writeln(''); |
| 163 | + |
| 164 | + $errorOutput->writeln("To learn about what you're missing out on, check out"); |
| 165 | + $errorOutput->writeln('this blog with articles about the latest major releases:'); |
| 166 | + $errorOutput->writeln('<options=underscore>https://phpstan.org/blog</>'); |
| 167 | + $errorOutput->writeln(''); |
| 168 | + |
| 169 | + $errorOutput->writeln('Upgrade today to <fg=green>PHPStan 2.2 or newer</> by using'); |
| 170 | + $errorOutput->writeln('<fg=cyan>"phpstan/phpstan": "^2.2"</> in your <fg=cyan>composer.json</>.'); |
| 171 | + $errorOutput->writeln(''); |
| 172 | + } |
| 173 | + |
143 | 174 | $paths = $input->getArgument('paths'); |
144 | 175 | $memoryLimit = $input->getOption('memory-limit'); |
145 | 176 | $autoloadFile = $input->getOption('autoload-file'); |
|
0 commit comments