1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-22 22:01:48 +01:00

Merge pull request #9848 from lptn/phpstorm-output-format-on-jetbrains-terminal

Use PHPStorm output format by default on JetBrains terminals
This commit is contained in:
orklah 2023-05-31 20:29:58 +02:00 committed by GitHub
commit 6b94453bea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -403,7 +403,20 @@ final class Psalm
{
return isset($options['output-format']) && is_string($options['output-format'])
? $options['output-format']
: Report::TYPE_CONSOLE;
: self::findDefaultOutputFormat();
}
/**
* @return Report::TYPE_*
*/
private static function findDefaultOutputFormat(): string
{
$emulator = getenv('TERMINAL_EMULATOR');
if (is_string($emulator) && substr($emulator, 0, 9) === 'JetBrains') {
return Report::TYPE_PHP_STORM;
}
return Report::TYPE_CONSOLE;
}
private static function initShowInfo(array $options): bool