Skip to content

Commit

Permalink
Add suppressMixedIssues config flag to hide mixed issues
Browse files Browse the repository at this point in the history
  • Loading branch information
muglug committed Feb 18, 2020
1 parent 87d8947 commit 520b646
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions config.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
<xs:attribute name="throwExceptionOnError" type="xs:boolean" default="false" />
<xs:attribute name="totallyTyped" type="xs:boolean" default="false" />
<xs:attribute name="errorLevel" type="xs:integer" default="1" />
<xs:attribute name="suppressMixedIssues" type="xs:boolean" default="false" />
<xs:attribute name="useAssertForType" type="xs:boolean" default="true" />
<xs:attribute name="useDocblockTypes" type="xs:boolean" default="true" />
<xs:attribute name="useDocblockPropertyTypes" type="xs:boolean" default="false" />
Expand Down
10 changes: 10 additions & 0 deletions src/Psalm/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,11 @@ class Config
/** @var 1|2|3|4|5|6|7|8 */
public $level = 1;

/**
* @var bool
*/
public $suppress_mixed_issues = false;

/** @var bool */
public $strict_binary_operands = false;

Expand Down Expand Up @@ -759,6 +764,7 @@ private static function fromXmlAndPaths(string $base_dir, string $file_contents,
'loadXdebugStub' => 'load_xdebug_stub',
'ensureArrayStringOffsetsExist' => 'ensure_array_string_offsets_exist',
'ensureArrayIntOffsetsExist' => 'ensure_array_int_offsets_exist',
'suppressMixedIssues' => 'suppress_mixed_issues',
];

foreach ($booleanAttributes as $xmlName => $internalName) {
Expand Down Expand Up @@ -1254,6 +1260,10 @@ public function shortenFileName($file_name)
*/
public function reportIssueInFile($issue_type, $file_path)
{
if ($this->suppress_mixed_issues && in_array($issue_type, self::MIXED_ISSUES, true)) {
return false;
}

if ($this->mustBeIgnored($file_path)) {
return false;
}
Expand Down

0 comments on commit 520b646

Please sign in to comment.