mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 13:51:54 +01:00
Whitelist suppressed issue types to for template extended params
This commit is contained in:
parent
21617c7029
commit
a60de4bac8
@ -350,7 +350,7 @@ final class ClassAnalyzer extends ClassLikeAnalyzer
|
||||
null,
|
||||
true,
|
||||
),
|
||||
$storage->suppressed_issues + $this->getSuppressedIssues(),
|
||||
$storage->getSuppressedIssuesForTemplateExtendParams() + $this->getSuppressedIssues(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -10,11 +10,13 @@ use Psalm\Internal\Analyzer\ClassLikeAnalyzer;
|
||||
use Psalm\Internal\MethodIdentifier;
|
||||
use Psalm\Internal\Type\TypeAlias\ClassTypeAlias;
|
||||
use Psalm\Issue\CodeIssue;
|
||||
use Psalm\Issue\DeprecatedClass;
|
||||
use Psalm\Type\Atomic\TNamedObject;
|
||||
use Psalm\Type\Atomic\TTemplateParam;
|
||||
use Psalm\Type\Union;
|
||||
|
||||
use function array_values;
|
||||
use function in_array;
|
||||
|
||||
final class ClassLikeStorage implements HasAttributesInterface
|
||||
{
|
||||
@ -550,4 +552,22 @@ final class ClassLikeStorage implements HasAttributesInterface
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<int, string>
|
||||
*/
|
||||
public function getSuppressedIssuesForTemplateExtendParams(): array
|
||||
{
|
||||
$allowed_issue_types = [
|
||||
DeprecatedClass::getIssueType(),
|
||||
];
|
||||
$suppressed_issues_for_template_extend_params = [];
|
||||
foreach ($this->suppressed_issues as $offset => $suppressed_issue) {
|
||||
if (!in_array($suppressed_issue, $allowed_issue_types, true)) {
|
||||
continue;
|
||||
}
|
||||
$suppressed_issues_for_template_extend_params[$offset] = $suppressed_issue;
|
||||
}
|
||||
return $suppressed_issues_for_template_extend_params;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user