Skip to content

Commit b341c77

Browse files
committed
Fixed compatibility with PHPStan 0.12
1 parent 57f52e6 commit b341c77

7 files changed

+7
-21
lines changed

src/Rules/Deprecations/AccessDeprecatedPropertyRule.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
use PhpParser\Node\Identifier;
88
use PHPStan\Analyser\Scope;
99
use PHPStan\Broker\Broker;
10-
use PHPStan\Reflection\DeprecatableReflection;
1110
use PHPStan\Type\TypeUtils;
1211

1312
class AccessDeprecatedPropertyRule implements \PHPStan\Rules\Rule
@@ -50,11 +49,7 @@ public function processNode(Node $node, Scope $scope): array
5049
$classReflection = $this->broker->getClass($referencedClass);
5150
$propertyReflection = $classReflection->getProperty($propertyName, $scope);
5251

53-
if (!$propertyReflection instanceof DeprecatableReflection) {
54-
continue;
55-
}
56-
57-
if ($propertyReflection->isDeprecated()) {
52+
if ($propertyReflection->isDeprecated()->yes()) {
5853
$description = $propertyReflection->getDeprecatedDescription();
5954
if ($description === null) {
6055
return [sprintf(

src/Rules/Deprecations/AccessDeprecatedStaticPropertyRule.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
use PhpParser\Node\Name;
99
use PHPStan\Analyser\Scope;
1010
use PHPStan\Broker\Broker;
11-
use PHPStan\Reflection\DeprecatableReflection;
1211
use PHPStan\Rules\RuleLevelHelper;
1312
use PHPStan\Type\ErrorType;
1413
use PHPStan\Type\Type;
@@ -80,7 +79,7 @@ function (Type $type) use ($propertyName): bool {
8079
continue;
8180
}
8281

83-
if ($property instanceof DeprecatableReflection && $property->isDeprecated()) {
82+
if ($property->isDeprecated()->yes()) {
8483
$description = $property->getDeprecatedDescription();
8584
if ($description === null) {
8685
return [sprintf(

src/Rules/Deprecations/CallToDeprecatedFunctionRule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function processNode(Node $node, Scope $scope): array
4545
return [];
4646
}
4747

48-
if ($function->isDeprecated()) {
48+
if ($function->isDeprecated()->yes()) {
4949
$description = $function->getDeprecatedDescription();
5050
if ($description === null) {
5151
return [sprintf(

src/Rules/Deprecations/CallToDeprecatedMethodRule.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
use PhpParser\Node\Identifier;
88
use PHPStan\Analyser\Scope;
99
use PHPStan\Broker\Broker;
10-
use PHPStan\Reflection\DeprecatableReflection;
1110
use PHPStan\Type\TypeUtils;
1211

1312
class CallToDeprecatedMethodRule implements \PHPStan\Rules\Rule
@@ -50,11 +49,7 @@ public function processNode(Node $node, Scope $scope): array
5049
$classReflection = $this->broker->getClass($referencedClass);
5150
$methodReflection = $classReflection->getMethod($methodName, $scope);
5251

53-
if (!$methodReflection instanceof DeprecatableReflection) {
54-
continue;
55-
}
56-
57-
if (!$methodReflection->isDeprecated()) {
52+
if (!$methodReflection->isDeprecated()->yes()) {
5853
continue;
5954
}
6055

src/Rules/Deprecations/CallToDeprecatedStaticMethodRule.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
use PhpParser\Node\Name;
99
use PHPStan\Analyser\Scope;
1010
use PHPStan\Broker\Broker;
11-
use PHPStan\Reflection\DeprecatableReflection;
1211
use PHPStan\Rules\RuleLevelHelper;
1312
use PHPStan\Type\ErrorType;
1413
use PHPStan\Type\Type;
@@ -100,7 +99,7 @@ function (Type $type) use ($methodName): bool {
10099
}
101100
}
102101

103-
if (!$methodReflection instanceof DeprecatableReflection || !$methodReflection->isDeprecated()) {
102+
if (!$methodReflection->isDeprecated()->yes()) {
104103
continue;
105104
}
106105

src/Rules/Deprecations/DeprecatedScopeHelper.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace PHPStan\Rules\Deprecations;
44

55
use PHPStan\Analyser\Scope;
6-
use PHPStan\Reflection\DeprecatableReflection;
76

87
class DeprecatedScopeHelper
98
{
@@ -21,7 +20,7 @@ public static function isScopeDeprecated(Scope $scope): bool
2120
}
2221

2322
$function = $scope->getFunction();
24-
if ($function instanceof DeprecatableReflection && $function->isDeprecated()) {
23+
if ($function !== null && $function->isDeprecated()->yes()) {
2524
return true;
2625
}
2726

src/Rules/Deprecations/FetchingClassConstOfDeprecatedClassRule.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
use PhpParser\Node\Name;
99
use PHPStan\Analyser\Scope;
1010
use PHPStan\Broker\Broker;
11-
use PHPStan\Reflection\DeprecatableReflection;
1211
use PHPStan\Rules\RuleLevelHelper;
1312
use PHPStan\Type\ErrorType;
1413
use PHPStan\Type\Type;
@@ -103,7 +102,7 @@ function (Type $type) use ($constantName): bool {
103102

104103
$constantReflection = $class->getConstant($constantName);
105104

106-
if (!$constantReflection instanceof DeprecatableReflection || !$constantReflection->isDeprecated()) {
105+
if (!$constantReflection->isDeprecated()->yes()) {
107106
continue;
108107
}
109108

0 commit comments

Comments
 (0)