Skip to content
Permalink
Browse files

Allow references to deprecated class inside the class

  • Loading branch information...
muglug committed Jun 27, 2019
1 parent 049b148 commit 6b32565a9bf199049d070a5197c77f266170844d
@@ -314,7 +314,7 @@ public static function analyze(
}
}
if ($storage->deprecated) {
if ($storage->deprecated && $fq_class_name !== $context->self) {
if (IssueBuffer::accepts(
new DeprecatedClass(
$fq_class_name . ' is marked deprecated',
@@ -589,7 +589,7 @@ function (PhpParser\Node\Arg $arg) {
}
}
if ($class_storage->deprecated) {
if ($class_storage->deprecated && $fq_class_name !== $context->self) {
if (IssueBuffer::accepts(
new DeprecatedClass(
$fq_class_name . ' is marked deprecated',
@@ -161,7 +161,7 @@ public static function analyzeClassConst(
if ($codebase->classExists($fq_class_name)) {
$class_const_storage = $codebase->classlike_storage_provider->get($fq_class_name);
if ($class_const_storage->deprecated) {
if ($class_const_storage->deprecated && $fq_class_name !== $context->self) {
if (IssueBuffer::accepts(
new DeprecatedClass(
'Class ' . $fq_class_name . ' is deprecated',
@@ -320,7 +320,7 @@ public static function analyzeClassConst(
$class_const_storage = $codebase->classlike_storage_provider->get($fq_class_name);
if ($class_const_storage->deprecated) {
if ($class_const_storage->deprecated && $fq_class_name !== $context->self) {
if (IssueBuffer::accepts(
new DeprecatedClass(
'Class ' . $fq_class_name . ' is deprecated',
@@ -397,19 +397,25 @@ public static function canExpressionTypesBeIdentical(
foreach ($type1->getTypes() as $type1_part) {
foreach ($type2->getTypes() as $type2_part) {
$second_type_coerced = false;
$either_contains = self::isAtomicContainedBy(
$codebase,
$type1_part,
$type2_part,
true,
false
false,
$first_has_scalar_match,
$first_type_coerced
) || self::isAtomicContainedBy(
$codebase,
$type2_part,
$type1_part,
true,
false
);
false,
$second_has_scalar_match,
$second_type_coerced
) || ($first_type_coerced && $second_type_coerced);
if ($either_contains) {
return true;
@@ -22,6 +22,17 @@ public static function barBar(): void {
}
}',
],
'deprecatedClassUsedInsideClass' => [
'<?php
/**
* @deprecated
*/
class Foo {
public static function barBar(): void {
new Foo();
}
}',
],
];
}
@@ -1444,6 +1444,16 @@ function foo($clips, bool $found, int $id) : void {
[],
['MixedArgument', 'MixedArrayAccess', 'MixedAssignment', 'MixedArrayOffset']
],
'allowNonEmptyArrayComparison' => [
'<?php
/**
* @param non-empty-array $a
* @param array<string> $b
*/
function foo(array $a, array $b) : void {
if ($a === $b) {}
}'
],
];
}

0 comments on commit 6b32565

Please sign in to comment.
You can’t perform that action at this time.