diff --git a/src/Psalm/Internal/Cli/Psalm.php b/src/Psalm/Internal/Cli/Psalm.php index 7401cd1e621..c9473b30eb7 100644 --- a/src/Psalm/Internal/Cli/Psalm.php +++ b/src/Psalm/Internal/Cli/Psalm.php @@ -403,7 +403,20 @@ private static function initOutputFormat(array $options): string { 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