From 0119a34897eb499298845d8a02cb861348af7534 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Thu, 15 Jan 2026 11:30:15 +0100 Subject: [PATCH] make resolveClassReflection non-nullable as always passed a node --- .../Property/TypedPropertyFromStrictConstructorRector.php | 4 ---- src/Reflection/ReflectionResolver.php | 6 +----- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/rules/TypeDeclaration/Rector/Property/TypedPropertyFromStrictConstructorRector.php b/rules/TypeDeclaration/Rector/Property/TypedPropertyFromStrictConstructorRector.php index c216ce31ffa..4351c5a7337 100644 --- a/rules/TypeDeclaration/Rector/Property/TypedPropertyFromStrictConstructorRector.php +++ b/rules/TypeDeclaration/Rector/Property/TypedPropertyFromStrictConstructorRector.php @@ -187,10 +187,6 @@ private function shouldSkipPropertyType(Type $propertyType): bool private function hasSomeUntypedProperties(Class_ $class): bool { - if ($class->getProperties() === []) { - return false; - } - foreach ($class->getProperties() as $property) { if ($property->type instanceof Node) { continue; diff --git a/src/Reflection/ReflectionResolver.php b/src/Reflection/ReflectionResolver.php index dc7b2dd9b4c..1e37c4072e2 100644 --- a/src/Reflection/ReflectionResolver.php +++ b/src/Reflection/ReflectionResolver.php @@ -65,12 +65,8 @@ public function resolveClassAndAnonymousClass(ClassLike $classLike): ClassReflec return $this->reflectionProvider->getClass($className); } - public function resolveClassReflection(?Node $node): ?ClassReflection + public function resolveClassReflection(Node $node): ?ClassReflection { - if (! $node instanceof Node) { - return null; - } - $scope = $node->getAttribute(AttributeKey::SCOPE); if (! $scope instanceof Scope) { return null;