1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-21 21:31:13 +01:00

Add ability to suppress info output from command line

This commit is contained in:
Matthew Brown 2016-08-04 14:38:43 -04:00
parent bff796ceb7
commit 944a8c24eb
3 changed files with 15 additions and 2 deletions

View File

@ -19,13 +19,16 @@ ini_set('display_startup_errors', 1);
ini_set('memory_limit', '2048M');
// get options from command line
$options = getopt('f:m:', ['debug', 'config:', 'monochrome']);
$options = getopt('f:m:', ['debug', 'config:', 'monochrome', 'show-info:']);
// get vars from options
$debug = array_key_exists('debug', $options);
$path_to_check = isset($options['f']) ? realpath($options['f']) : null;
$path_to_config = isset($options['config']) ? realpath($options['config']) : null;
$use_color = !array_key_exists('monochrome', $options);
$show_info = isset($options['show-info'])
? $options['show-info'] !== 'false' && $options['show-info'] !== '0'
: true;
// set the cache directory for the file checker
FileChecker::setCacheDir('/var/tmp/php-parser');
@ -36,6 +39,7 @@ if ($path_to_config) {
}
ProjectChecker::$use_color = $use_color;
ProjectChecker::$show_info = $show_info;
$time = microtime(true);

View File

@ -37,9 +37,12 @@ class IssueBuffer
$reporting_level = $config->getReportingLevel($issue_type);
switch ($reporting_level) {
case Config::REPORT_INFO:
echo 'INFO: ' . $error_message . PHP_EOL;
if (ProjectChecker::$show_info) {
echo 'INFO: ' . $error_message . PHP_EOL;
}
return false;
case Config::REPORT_SUPPRESS:

View File

@ -19,6 +19,12 @@ class ProjectChecker
*/
public static $use_color = true;
/**
* Whether or not to show informational messages
* @var boolean
*/
public static $show_info = true;
public static function check($debug = false)
{
if (!self::$config) {