mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +01:00
Hide Mixed* issues under a totallyTyped config flag
This commit is contained in:
parent
52b3e1ba8c
commit
9a32b5fd40
@ -3,21 +3,13 @@
|
||||
name="Example Psalm config with recommended defaults"
|
||||
stopOnFirstError="false"
|
||||
useDocblockTypes="true"
|
||||
totallyTyped="false"
|
||||
>
|
||||
<inspectFiles>
|
||||
<directory name="src" />
|
||||
</inspectFiles>
|
||||
|
||||
<issueHandler>
|
||||
<MixedArrayAccess errorLevel="suppress" />
|
||||
<MixedArrayOffset errorLevel="suppress" />
|
||||
<MixedAssignment errorLevel="suppress" />
|
||||
<MixedArgument errorLevel="suppress" />
|
||||
<MixedMethodCall errorLevel="suppress" />
|
||||
<MixedPropertyFetch errorLevel="suppress" />
|
||||
<MixedPropertyAssignment errorLevel="suppress" />
|
||||
<MixedInferredReturnType errorLevel="suppress" />
|
||||
|
||||
<InvalidDocblock errorLevel="info" />
|
||||
<MissingPropertyType errorLevel="info" />
|
||||
<MissingReturnType errorLevel="info" />
|
||||
|
@ -3,6 +3,7 @@
|
||||
name="Psalm for Psalm"
|
||||
stopOnFirstError="false"
|
||||
useDocblockTypes="true"
|
||||
totallyTyped="true"
|
||||
>
|
||||
<inspectFiles>
|
||||
<directory name="src" />
|
||||
|
@ -22,6 +22,21 @@ class Config
|
||||
self::REPORT_SUPPRESS
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected static $MIXED_ISSUES = [
|
||||
'MixedArgument',
|
||||
'MixedArrayAccess',
|
||||
'MixedArrayOffset',
|
||||
'MixedAssignment',
|
||||
'MixedInferredReturnType',
|
||||
'MixedMethodCall',
|
||||
'MixedPropertyFetch',
|
||||
'MixedPropertyAssignment',
|
||||
'MixedStringOffsetAssignment'
|
||||
];
|
||||
|
||||
/**
|
||||
* @var self|null
|
||||
*/
|
||||
@ -114,6 +129,9 @@ class Config
|
||||
/** @var bool */
|
||||
public $allow_includes = true;
|
||||
|
||||
/** @var bool */
|
||||
public $totally_typed = false;
|
||||
|
||||
/**
|
||||
* Psalm plugins
|
||||
*
|
||||
@ -195,6 +213,11 @@ class Config
|
||||
$config->allow_includes = $attribute_text === 'true' || $attribute_text === '1';
|
||||
}
|
||||
|
||||
if (isset($config_xml['totallyTyped'])) {
|
||||
$attribute_text = (string) $config_xml['totallyTyped'];
|
||||
$config->totally_typed = $attribute_text === 'true' || $attribute_text === '1';
|
||||
}
|
||||
|
||||
if (isset($config_xml->inspectFiles)) {
|
||||
$config->inspect_files = FileFilter::loadFromXML($config_xml->inspectFiles, true);
|
||||
}
|
||||
@ -349,6 +372,10 @@ class Config
|
||||
*/
|
||||
public function excludeIssueInFile($issue_type, $file_name)
|
||||
{
|
||||
if (!$this->totally_typed && in_array($issue_type, self::$MIXED_ISSUES)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($this->getReportingLevel($issue_type) === self::REPORT_SUPPRESS) {
|
||||
return true;
|
||||
}
|
||||
|
@ -11,5 +11,6 @@ class TestConfig extends Config
|
||||
|
||||
$this->throw_exception = true;
|
||||
$this->use_docblock_types = true;
|
||||
$this->totally_typed = true;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user