|
25 | 25 | use PHPStan\Fixable\Patcher; |
26 | 26 | use PHPStan\Internal\AgentDetector; |
27 | 27 | use PHPStan\Internal\BytesHelper; |
| 28 | +use PHPStan\Internal\ComposerHelper; |
28 | 29 | use PHPStan\Internal\DirectoryCreator; |
29 | 30 | use PHPStan\Internal\DirectoryCreatorException; |
30 | 31 | use PHPStan\ShouldNotHappenException; |
| 32 | +use PHPStan\Turbo\TurboExtensionEnabler; |
31 | 33 | use Symfony\Component\Console\Command\Command; |
32 | 34 | use Symfony\Component\Console\Input\InputArgument; |
33 | 35 | use Symfony\Component\Console\Input\InputInterface; |
@@ -319,6 +321,30 @@ protected function execute(InputInterface $input, OutputInterface $output): int |
319 | 321 | )); |
320 | 322 | } |
321 | 323 |
|
| 324 | + $incompatibleTurboVersion = TurboExtensionEnabler::getIncompatibleLoadedVersion(); |
| 325 | + if ($incompatibleTurboVersion !== null) { |
| 326 | + $errorOutput->writeLineFormatted('<comment>Incompatible version of the phpstan_turbo extension</comment>'); |
| 327 | + $errorOutput->writeLineFormatted(sprintf( |
| 328 | + 'The loaded phpstan_turbo extension is version %s', |
| 329 | + $incompatibleTurboVersion, |
| 330 | + )); |
| 331 | + $errorOutput->writeLineFormatted(sprintf( |
| 332 | + 'but this PHPStan version expects version %s.', |
| 333 | + TurboExtensionEnabler::EXPECTED_EXTENSION_VERSION, |
| 334 | + )); |
| 335 | + $errorOutput->writeLineFormatted(''); |
| 336 | + $errorOutput->writeLineFormatted('The extension stays inactive and PHPStan runs slower than necessary.'); |
| 337 | + $errorOutput->writeLineFormatted(''); |
| 338 | + |
| 339 | + $phpstanVersion = ComposerHelper::getPhpStanVersion(); |
| 340 | + if ($phpstanVersion === ComposerHelper::UNKNOWN_VERSION) { |
| 341 | + $errorOutput->writeLineFormatted('Update the extension to the version appropriate for your PHPStan version.'); |
| 342 | + } else { |
| 343 | + $errorOutput->writeLineFormatted(sprintf('Update the extension to the version appropriate for PHPStan %s.', $phpstanVersion)); |
| 344 | + } |
| 345 | + $errorOutput->writeLineFormatted(''); |
| 346 | + } |
| 347 | + |
322 | 348 | if ($pro) { |
323 | 349 | if ($generateBaselineFile !== null) { |
324 | 350 | $inceptionResult->getStdOutput()->getStyle()->error('You cannot pass the --generate-baseline option when running PHPStan Pro.'); |
|
0 commit comments