Skip to content

Commit 872fb34

Browse files
Fix deprecation
1 parent 449b637 commit 872fb34

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/Rules/Properties/AccessStaticPropertiesRule.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ private function processSingleProperty(Scope $scope, StaticPropertyFetch $node,
138138

139139
$locationData = [];
140140
$locationClassReflection = $this->reflectionProvider->getClass($class);
141-
if ($locationClassReflection->hasProperty($name)) {
142-
$locationData['property'] = $locationClassReflection->getProperty($name, $scope);
141+
if ($locationClassReflection->hasStaticProperty($name)) {
142+
$locationData['property'] = $locationClassReflection->getStaticProperty($name);
143143
}
144144

145145
$messages = $this->classCheck->checkClassNames(

src/Rules/RestrictedUsage/RestrictedPropertyUsageRule.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@ public function processNode(Node $node, Scope $scope): array
5757
}
5858

5959
$classReflection = $this->reflectionProvider->getClass($referencedClass);
60-
if (!$classReflection->hasProperty($propertyName)) {
60+
if (!$classReflection->hasInstanceProperty($propertyName)) {
6161
continue;
6262
}
6363

64-
$propertyReflection = $classReflection->getProperty($propertyName, $scope);
64+
$propertyReflection = $classReflection->getInstanceProperty($propertyName, $scope);
6565
foreach ($extensions as $extension) {
6666
$restrictedUsage = $extension->isRestrictedPropertyUsage($propertyReflection, $scope);
6767
if ($restrictedUsage === null) {

src/Rules/RestrictedUsage/RestrictedStaticPropertyUsageRule.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function processNode(Node $node, Scope $scope): array
6060
$scope,
6161
$node->class,
6262
'', // We don't care about the error message
63-
static fn (Type $type): bool => $type->canAccessProperties()->yes() && $type->hasProperty($propertyName)->yes(),
63+
static fn (Type $type): bool => $type->canAccessProperties()->yes() && $type->hasInstanceProperty($propertyName)->yes(),
6464
);
6565

6666
if ($classTypeResult->getType() instanceof ErrorType) {
@@ -77,11 +77,11 @@ public function processNode(Node $node, Scope $scope): array
7777
}
7878

7979
$classReflection = $this->reflectionProvider->getClass($referencedClass);
80-
if (!$classReflection->hasProperty($propertyName)) {
80+
if (!$classReflection->hasStaticProperty($propertyName)) {
8181
continue;
8282
}
8383

84-
$propertyReflection = $classReflection->getProperty($propertyName, $scope);
84+
$propertyReflection = $classReflection->getStaticProperty($propertyName);
8585
foreach ($extensions as $extension) {
8686
$restrictedUsage = $extension->isRestrictedPropertyUsage($propertyReflection, $scope);
8787
if ($restrictedUsage === null) {

0 commit comments

Comments
 (0)