Skip to content

Commit

Permalink
Merge pull request #9848 from lptn/phpstorm-output-format-on-jetbrain…
Browse files Browse the repository at this point in the history
…s-terminal

Use PHPStorm output format by default on JetBrains terminals
  • Loading branch information
orklah committed May 31, 2023
2 parents bebce06 + bf1a736 commit 6b94453
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/Psalm/Internal/Cli/Psalm.php
Expand Up @@ -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
Expand Down

0 comments on commit 6b94453

Please sign in to comment.