Skip to content

Commit e911cc9

Browse files
ondrejmirtesclaude
andcommitted
Render the incompatible turbo version note in Symfony style
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012vuNxwtFCEJYsooPPgidPp
1 parent e69dcb5 commit e911cc9

1 file changed

Lines changed: 7 additions & 17 deletions

File tree

‎src/Command/AnalyseCommand.php‎

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -323,26 +323,16 @@ protected function execute(InputInterface $input, OutputInterface $output): int
323323

324324
$incompatibleTurboVersion = TurboExtensionEnabler::getIncompatibleLoadedVersion();
325325
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',
326+
$phpstanVersion = ComposerHelper::getPhpStanVersion();
327+
$errorOutput->getStyle()->note(sprintf(
328+
'Incompatible version of the phpstan_turbo extension.' . "\n"
329+
. 'The loaded extension is version %s but this PHPStan version expects %s.' . "\n"
330+
. 'The extension stays inactive and PHPStan runs slower than necessary.' . "\n"
331+
. 'Update the extension to the version appropriate for %s.',
329332
$incompatibleTurboVersion,
330-
));
331-
$errorOutput->writeLineFormatted(sprintf(
332-
'but this PHPStan version expects version %s.',
333333
TurboExtensionEnabler::EXPECTED_EXTENSION_VERSION,
334+
$phpstanVersion === ComposerHelper::UNKNOWN_VERSION ? 'your PHPStan version' : sprintf('PHPStan %s', $phpstanVersion),
334335
));
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('');
346336
}
347337

348338
if ($pro) {

0 commit comments

Comments
 (0)