mirror of
https://github.com/rectorphp/rector.git
synced 2025-02-12 03:25:27 +01:00
Updated Rector to commit 3376578a6e4ab5ec68ff56d863da9e36a36ab857
3376578a6e
[VendorLocker] Move early private method check on ParentClassMethodTypeOverrideGuard to resolveParentClassMethod() for re-use (#5954)
This commit is contained in:
parent
6c191927ee
commit
a2a5c87397
@ -19,12 +19,12 @@ final class VersionResolver
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '432357641c0de02e6efcbd2cdb2d8d68bc84ba6e';
|
||||
public const PACKAGE_VERSION = '3376578a6e4ab5ec68ff56d863da9e36a36ab857';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2024-06-09 00:29:52';
|
||||
public const RELEASE_DATE = '2024-06-09 20:03:44';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
@ -53,10 +53,6 @@ final class ParentClassMethodTypeOverrideGuard
|
||||
*/
|
||||
public function hasParentClassMethod($classMethod) : bool
|
||||
{
|
||||
// early got false on private method
|
||||
if ($classMethod->isPrivate()) {
|
||||
return \false;
|
||||
}
|
||||
try {
|
||||
$parentClassMethod = $this->resolveParentClassMethod($classMethod);
|
||||
return $parentClassMethod instanceof MethodReflection;
|
||||
@ -93,18 +89,17 @@ final class ParentClassMethodTypeOverrideGuard
|
||||
*/
|
||||
private function resolveParentClassMethod($classMethod) : ?MethodReflection
|
||||
{
|
||||
if ($classMethod instanceof ClassMethod) {
|
||||
$classReflection = $this->reflectionResolver->resolveClassReflection($classMethod);
|
||||
if (!$classReflection instanceof ClassReflection) {
|
||||
// we can't resolve the class, so we don't know.
|
||||
throw new UnresolvableClassException();
|
||||
}
|
||||
/** @var string $methodName */
|
||||
$methodName = $this->nodeNameResolver->getName($classMethod);
|
||||
} else {
|
||||
$classReflection = $classMethod->getDeclaringClass();
|
||||
$methodName = $classMethod->getName();
|
||||
// early got null on private method
|
||||
if ($classMethod->isPrivate()) {
|
||||
return null;
|
||||
}
|
||||
$classReflection = $classMethod instanceof ClassMethod ? $this->reflectionResolver->resolveClassReflection($classMethod) : $classMethod->getDeclaringClass();
|
||||
if (!$classReflection instanceof ClassReflection) {
|
||||
// we can't resolve the class, so we don't know.
|
||||
throw new UnresolvableClassException();
|
||||
}
|
||||
/** @var string $methodName */
|
||||
$methodName = $classMethod instanceof ClassMethod ? $this->nodeNameResolver->getName($classMethod) : $classMethod->getName();
|
||||
$currentClassReflection = $classReflection;
|
||||
while ($this->hasClassParent($currentClassReflection)) {
|
||||
$parentClassReflection = $currentClassReflection->getParentClass();
|
||||
|
Loading…
x
Reference in New Issue
Block a user