1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00

Fix #1746 - allow DeprecatedInterface to be suppressed with referencedClass

This commit is contained in:
Brown 2019-06-06 14:48:33 -04:00
parent b1d1ab974c
commit 9aeaf1a4ed
9 changed files with 31 additions and 19 deletions

View File

@ -146,11 +146,11 @@
<xs:element name="ContinueOutsideLoop" type="IssueHandlerType" minOccurs="0" />
<xs:element name="ConflictingReferenceConstraint" type="IssueHandlerType" minOccurs="0" />
<xs:element name="DeprecatedClass" type="ClassIssueHandlerType" minOccurs="0" />
<xs:element name="DeprecatedConstant" type="ClassIssueHandlerType" minOccurs="0" />
<xs:element name="DeprecatedInterface" type="IssueHandlerType" minOccurs="0" />
<xs:element name="DeprecatedConstant" type="IssueHandlerType" minOccurs="0" />
<xs:element name="DeprecatedInterface" type="ClassIssueHandlerType" minOccurs="0" />
<xs:element name="DeprecatedMethod" type="MethodIssueHandlerType" minOccurs="0" />
<xs:element name="DeprecatedProperty" type="PropertyIssueHandlerType" minOccurs="0" />
<xs:element name="DeprecatedTrait" type="ClassIssueHandlerType" minOccurs="0" />
<xs:element name="DeprecatedTrait" type="IssueHandlerType" minOccurs="0" />
<xs:element name="DocblockTypeContradiction" type="IssueHandlerType" minOccurs="0" />
<xs:element name="DuplicateArrayKey" type="IssueHandlerType" minOccurs="0" />
<xs:element name="DuplicateParam" type="IssueHandlerType" minOccurs="0" />

View File

@ -251,7 +251,8 @@ class ClassAnalyzer extends ClassLikeAnalyzer
if (IssueBuffer::accepts(
new DeprecatedClass(
$parent_fq_class_name . ' is marked deprecated',
$code_location
$code_location,
$parent_fq_class_name
),
array_merge($storage->suppressed_issues, $this->getSuppressedIssues())
)) {
@ -270,7 +271,8 @@ class ClassAnalyzer extends ClassLikeAnalyzer
if (IssueBuffer::accepts(
new InternalClass(
$parent_fq_class_name . ' is marked internal',
$code_location
$code_location,
$parent_fq_class_name
),
array_merge($storage->suppressed_issues, $this->getSuppressedIssues())
)) {
@ -285,7 +287,8 @@ class ClassAnalyzer extends ClassLikeAnalyzer
if (IssueBuffer::accepts(
new InternalClass(
$parent_fq_class_name . ' is internal to ' . $parent_class_storage->psalm_internal,
$code_location
$code_location,
$parent_fq_class_name
),
array_merge($storage->suppressed_issues, $this->getSuppressedIssues())
)) {
@ -376,7 +379,8 @@ class ClassAnalyzer extends ClassLikeAnalyzer
if (IssueBuffer::accepts(
new UndefinedInterface(
$fq_interface_name . ' is not an interface',
$code_location
$code_location,
$fq_interface_name
),
array_merge($storage->suppressed_issues, $this->getSuppressedIssues())
)) {
@ -461,7 +465,8 @@ class ClassAnalyzer extends ClassLikeAnalyzer
if (IssueBuffer::accepts(
new DeprecatedInterface(
$interface_name . ' is marked deprecated',
$code_location
$code_location,
$interface_name
),
array_merge($storage->suppressed_issues, $this->getSuppressedIssues())
)) {

View File

@ -63,7 +63,8 @@ class InterfaceAnalyzer extends ClassLikeAnalyzer
if (\Psalm\IssueBuffer::accepts(
new UndefinedInterface(
$extended_interface_name . ' is not an interface',
$code_location
$code_location,
$extended_interface_name
),
$this->getSuppressedIssues()
)) {

View File

@ -311,7 +311,8 @@ class NewAnalyzer extends \Psalm\Internal\Analyzer\Statements\Expression\CallAna
if (IssueBuffer::accepts(
new DeprecatedClass(
$fq_class_name . ' is marked deprecated',
new CodeLocation($statements_analyzer->getSource(), $stmt)
new CodeLocation($statements_analyzer->getSource(), $stmt),
$fq_class_name
),
$statements_analyzer->getSuppressedIssues()
)) {
@ -325,7 +326,8 @@ class NewAnalyzer extends \Psalm\Internal\Analyzer\Statements\Expression\CallAna
if (IssueBuffer::accepts(
new InternalClass(
$fq_class_name . ' is marked internal to ' . $storage->psalm_internal,
new CodeLocation($statements_analyzer->getSource(), $stmt)
new CodeLocation($statements_analyzer->getSource(), $stmt),
$fq_class_name
),
$statements_analyzer->getSuppressedIssues()
)) {
@ -339,7 +341,8 @@ class NewAnalyzer extends \Psalm\Internal\Analyzer\Statements\Expression\CallAna
if (IssueBuffer::accepts(
new InternalClass(
$fq_class_name . ' is marked internal',
new CodeLocation($statements_analyzer->getSource(), $stmt)
new CodeLocation($statements_analyzer->getSource(), $stmt),
$fq_class_name
),
$statements_analyzer->getSuppressedIssues()
)) {

View File

@ -585,7 +585,8 @@ class StaticCallAnalyzer extends \Psalm\Internal\Analyzer\Statements\Expression\
if (IssueBuffer::accepts(
new DeprecatedClass(
$fq_class_name . ' is marked deprecated',
new CodeLocation($statements_analyzer->getSource(), $stmt)
new CodeLocation($statements_analyzer->getSource(), $stmt),
$fq_class_name
),
$statements_analyzer->getSuppressedIssues()
)) {
@ -600,7 +601,8 @@ class StaticCallAnalyzer extends \Psalm\Internal\Analyzer\Statements\Expression\
if (IssueBuffer::accepts(
new InternalClass(
$fq_class_name . ' is marked internal to ' . $class_storage->psalm_internal,
new CodeLocation($statements_analyzer->getSource(), $stmt)
new CodeLocation($statements_analyzer->getSource(), $stmt),
$fq_class_name
),
$statements_analyzer->getSuppressedIssues()
)) {
@ -617,7 +619,8 @@ class StaticCallAnalyzer extends \Psalm\Internal\Analyzer\Statements\Expression\
if (IssueBuffer::accepts(
new InternalClass(
$fq_class_name . ' is marked internal',
new CodeLocation($statements_analyzer->getSource(), $stmt)
new CodeLocation($statements_analyzer->getSource(), $stmt),
$fq_class_name
),
$statements_analyzer->getSuppressedIssues()
)) {

View File

@ -1,6 +1,6 @@
<?php
namespace Psalm\Issue;
class DeprecatedClass extends CodeIssue
class DeprecatedClass extends ClassIssue
{
}

View File

@ -1,6 +1,6 @@
<?php
namespace Psalm\Issue;
class DeprecatedInterface extends CodeIssue
class DeprecatedInterface extends ClassIssue
{
}

View File

@ -1,6 +1,6 @@
<?php
namespace Psalm\Issue;
class InternalClass extends CodeIssue
class InternalClass extends ClassIssue
{
}

View File

@ -1,6 +1,6 @@
<?php
namespace Psalm\Issue;
class UndefinedInterface extends CodeIssue
class UndefinedInterface extends ClassIssue
{
}