From 707f4ca8abd92cefba39c269695b841a00ac9faf Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sun, 14 Jul 2024 18:43:18 +0000 Subject: [PATCH] Updated Rector to commit a9ddf8fe859ce31baccee9692438ad03c9101549 https://github.com/rectorphp/rector-src/commit/a9ddf8fe859ce31baccee9692438ad03c9101549 [Reflection] Clean up unnecessary loop parents on ReflectionResolver (#6146) --- src/Application/VersionResolver.php | 4 +-- src/Reflection/ReflectionResolver.php | 35 +++------------------------ 2 files changed, 6 insertions(+), 33 deletions(-) diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index becf69d0b16..683a818222b 100644 --- a/src/Application/VersionResolver.php +++ b/src/Application/VersionResolver.php @@ -19,12 +19,12 @@ final class VersionResolver * @api * @var string */ - public const PACKAGE_VERSION = '4dd889abe4cabdbe4235578a10a7d6d4b64b5f55'; + public const PACKAGE_VERSION = 'a9ddf8fe859ce31baccee9692438ad03c9101549'; /** * @api * @var string */ - public const RELEASE_DATE = '2024-07-15 00:10:17'; + public const RELEASE_DATE = '2024-07-15 01:40:48'; /** * @var int */ diff --git a/src/Reflection/ReflectionResolver.php b/src/Reflection/ReflectionResolver.php index fdf29c0d41b..8b2b69e5e13 100644 --- a/src/Reflection/ReflectionResolver.php +++ b/src/Reflection/ReflectionResolver.php @@ -116,22 +116,8 @@ public function resolveClassReflectionSourceObject($node) : ?ClassReflection if ($property->isPrivate()) { return $classReflection; } - $nativeReflection = $classReflection->getNativeReflection(); - $properties = $nativeReflection->getProperties(); - // no need to lookup properties on interfaces - $ancestors = $classReflection->getParents(); - foreach ($properties as $property) { - if ($property->getName() !== $propertyName) { - continue; - } - if ($property->getDeclaringClass()->getName() === $className) { - return $classReflection; - } - foreach ($ancestors as $ancestor) { - if ($ancestor->hasNativeProperty($propertyName)) { - return $ancestor; - } - } + if ($this->reflectionProvider->hasClass($property->getDeclaringClass()->getName())) { + return $this->reflectionProvider->getClass($property->getDeclaringClass()->getName()); } return $classReflection; } @@ -143,21 +129,8 @@ public function resolveClassReflectionSourceObject($node) : ?ClassReflection if ($extendedMethodReflection->isPrivate()) { return $classReflection; } - $nativeReflection = $classReflection->getNativeReflection(); - $methods = $nativeReflection->getMethods(); - $ancestors = \array_merge($classReflection->getParents(), $classReflection->getInterfaces()); - foreach ($methods as $method) { - if ($method->getName() !== $methodName) { - continue; - } - if ($method->getDeclaringClass()->getName() === $className) { - return $classReflection; - } - foreach ($ancestors as $ancestor) { - if ($ancestor->hasNativeMethod($methodName)) { - return $ancestor; - } - } + if ($this->reflectionProvider->hasClass($extendedMethodReflection->getDeclaringClass()->getName())) { + return $this->reflectionProvider->getClass($extendedMethodReflection->getDeclaringClass()->getName()); } return $classReflection; }