Skip to content

Commit

Permalink
Updated Rector to commit a9ddf8fe859ce31baccee9692438ad03c9101549
Browse files Browse the repository at this point in the history
rectorphp/rector-src@a9ddf8f  [Reflection] Clean up unnecessary loop parents on ReflectionResolver  (#6146)
  • Loading branch information
TomasVotruba committed Jul 14, 2024
1 parent 8c2cb60 commit 707f4ca
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 33 deletions.
4 changes: 2 additions & 2 deletions src/Application/VersionResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
35 changes: 4 additions & 31 deletions src/Reflection/ReflectionResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down

0 comments on commit 707f4ca

Please sign in to comment.