Skip to content

Commit 578d314

Browse files
authored
Change deprecated ClassReflection::isSubClassOf() to ClassReflection::is() for PHPStan ^2.1.8 (#706)
* Change deprecated ClassReflection::isSubClassOf() to ClassReflection::is() for PHPStan ^2.1.8 * bump
1 parent dcb8a88 commit 578d314

File tree

11 files changed

+14
-14
lines changed

11 files changed

+14
-14
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
},
1010
"require-dev": {
1111
"phpstan/extension-installer": "^1.4",
12-
"phpstan/phpstan": "^2.0",
12+
"phpstan/phpstan": "^2.1.8",
1313
"phpstan/phpstan-webmozart-assert": "^2.0",
1414
"phpunit/phpunit": "^11.4",
1515
"rector/rector-src": "dev-main",

rules/DependencyInjection/Rector/Class_/CommandGetByTypeToConstructorInjectionRector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,6 @@ private function shouldSkipClass(Class_ $class): bool
134134
return true;
135135
}
136136

137-
return ! $classReflection->isSubclassOf(SymfonyClass::CONTAINER_AWARE_COMMAND);
137+
return ! $classReflection->is(SymfonyClass::CONTAINER_AWARE_COMMAND);
138138
}
139139
}

rules/DependencyInjection/Rector/Class_/ControllerGetByTypeToConstructorInjectionRector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,6 @@ private function shouldSkipClass(Class_ $class): bool
130130
return true;
131131
}
132132

133-
return ! $classReflection->isSubclassOf(SymfonyClass::CONTROLLER);
133+
return ! $classReflection->is(SymfonyClass::CONTROLLER);
134134
}
135135
}

rules/DependencyInjection/Rector/Class_/GetBySymfonyStringToConstructorInjectionRector.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,10 @@ private function shouldSkipClass(Class_ $class): bool
155155
return true;
156156
}
157157

158-
if ($classReflection->isSubclassOf(SymfonyClass::CONTAINER_AWARE_COMMAND)) {
158+
if ($classReflection->is(SymfonyClass::CONTAINER_AWARE_COMMAND)) {
159159
return false;
160160
}
161161

162-
return ! $classReflection->isSubclassOf(SymfonyClass::CONTROLLER);
162+
return ! $classReflection->is(SymfonyClass::CONTROLLER);
163163
}
164164
}

rules/DowngradeSymfony70/Rector/Class_/DowngradeSymfonyCommandAttributeRector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public function refactor(Node $node): ?Node
7777
return null;
7878
}
7979

80-
if (! $classReflection->isSubClassOf('Symfony\Component\Console\Command\Command')) {
80+
if (! $classReflection->is('Symfony\Component\Console\Command\Command')) {
8181
return null;
8282
}
8383

rules/Symfony43/Rector/ClassMethod/EventDispatcherParentConstructRector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public function refactor(Node $node): ?Node
8686
}
8787

8888
$classReflection = $scope->getClassReflection();
89-
if (! $classReflection->isSubclassOf('Symfony\Contracts\EventDispatcher\EventDispatcherInterface')) {
89+
if (! $classReflection->is('Symfony\Contracts\EventDispatcher\EventDispatcherInterface')) {
9090
return null;
9191
}
9292

rules/Symfony51/Rector/ClassMethod/CommandConstantReturnCodeRector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public function refactor(Node $node): ?Node
8080
return null;
8181
}
8282

83-
if (! $classReflection->isSubclassOf('Symfony\Component\Console\Command\Command')) {
83+
if (! $classReflection->is('Symfony\Component\Console\Command\Command')) {
8484
return null;
8585
}
8686

rules/Symfony61/Rector/StaticPropertyFetch/ErrorNamesPropertyToConstantRector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function refactor(Node $node): ?Node
7373
if (! $classReflection instanceof ClassReflection) {
7474
return null;
7575
}
76-
if (! $classReflection->isSubclassOf('Symfony\Component\Validator\Constraint')) {
76+
if (! $classReflection->is('Symfony\Component\Validator\Constraint')) {
7777
return null;
7878
}
7979
if (! $this->nodeNameResolver->isName($node->name, 'errorNames')) {

rules/Twig134/Rector/Return_/SimpleFunctionAndFilterRector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ private function shouldSkip(ClassMethod $classMethod): bool
151151
return true;
152152
}
153153

154-
if (! $classReflection->isSubclassOf('Twig_Extension')) {
154+
if (! $classReflection->is('Twig_Extension')) {
155155
return true;
156156
}
157157

src/NodeAnalyzer/SymfonyTestCaseAnalyzer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function isInWebTestCase(Node $node): bool
2222
return false;
2323
}
2424

25-
return $classReflection->isSubclassOf('Symfony\Bundle\FrameworkBundle\Test\WebTestCase');
25+
return $classReflection->is('Symfony\Bundle\FrameworkBundle\Test\WebTestCase');
2626
}
2727

2828
/**
@@ -35,6 +35,6 @@ public function isInKernelTestCase(Node $node): bool
3535
return false;
3636
}
3737

38-
return $classReflection->isSubclassOf('Symfony\Bundle\FrameworkBundle\Test\KernelTestCase');
38+
return $classReflection->is('Symfony\Bundle\FrameworkBundle\Test\KernelTestCase');
3939
}
4040
}

0 commit comments

Comments
 (0)