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

Use PHPStorm output format by default on JetBrains terminals

This commit is contained in:
Alies Lapatsin 2023-05-31 13:30:52 +02:00
parent bebce06014
commit bf1a7365d2

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