From 2e4154d76e24d1b4e59e6cc2bebef7790cb9e550 Mon Sep 17 00:00:00 2001 From: Matthew Brown Date: Tue, 18 Feb 2020 20:30:37 -0500 Subject: [PATCH] Add better defaults and documentation --- config.xsd | 2 +- docs/running_psalm/configuration.md | 14 +++++++++++++- src/Psalm/Config.php | 12 +++++++----- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/config.xsd b/config.xsd index 122f3e4b8..daeea2ddc 100644 --- a/config.xsd +++ b/config.xsd @@ -62,7 +62,7 @@ - + diff --git a/docs/running_psalm/configuration.md b/docs/running_psalm/configuration.md index 244571b24..4288cc77c 100644 --- a/docs/running_psalm/configuration.md +++ b/docs/running_psalm/configuration.md @@ -47,6 +47,15 @@ Configuration file may be split into several files using [XInclude](https://www. ``` This corresponds to Psalm‘s [error-detection level](error_levels.md). +#### reportMixedIssues + +```xml + +``` +Setting this to `"false"` hides all issues with `Mixed` types in Psalm’s output. If not given, this defaults to `"false"` when `errorLevel` is 3 or higher, and `"true"` when the error level is 1 or 2. + #### totallyTyped ```xml @@ -54,7 +63,10 @@ This corresponds to Psalm‘s [error-detection level](error_levels.md). totallyTyped="[bool]" /> ``` -Enabling this will make Psalm very strict, such that it needs to be able to evaluate the type of every single statement, and emitting a bevy of `Mixed*` issues if the types cannot be determined. Defaults to `false`. + +\(Deprecated\) Setting `totallyTyped` to `"true"` is equivalent to setting `errorLevel` to `"1"`. Setting `totallyTyped` to `"false"` is equivalent to setting `errorLevel` to `"2"` and `reportMixedIssues` to `"false"` + + #### resolveFromConfigFile diff --git a/src/Psalm/Config.php b/src/Psalm/Config.php index 7e6fa8609..f1db1b187 100644 --- a/src/Psalm/Config.php +++ b/src/Psalm/Config.php @@ -248,7 +248,7 @@ class Config /** * @var ?bool */ - public $suppress_mixed_issues = null; + public $show_mixed_issues = null; /** @var bool */ public $strict_binary_operands = false; @@ -764,7 +764,7 @@ class Config 'loadXdebugStub' => 'load_xdebug_stub', 'ensureArrayStringOffsetsExist' => 'ensure_array_string_offsets_exist', 'ensureArrayIntOffsetsExist' => 'ensure_array_int_offsets_exist', - 'suppressMixedIssues' => 'suppress_mixed_issues', + 'reportMixedIssues' => 'show_mixed_issues', ]; foreach ($booleanAttributes as $xmlName => $internalName) { @@ -849,8 +849,8 @@ class Config } else { $config->level = 2; - if ($config->suppress_mixed_issues === null) { - $config->suppress_mixed_issues = true; + if ($config->show_mixed_issues === null) { + $config->show_mixed_issues = false; } } } else { @@ -1264,7 +1264,9 @@ class Config */ public function reportIssueInFile($issue_type, $file_path) { - if (($this->suppress_mixed_issues || $this->level > 2) && in_array($issue_type, self::MIXED_ISSUES, true)) { + if (($this->show_mixed_issues === false || $this->level > 2) + && in_array($issue_type, self::MIXED_ISSUES, true) + ) { return false; }