mirror of https://github.com/rectorphp/rector.git
Updated Rector to commit 033b0c2bf86dc2f7cd3c6d6183ddc5ad1a3ab390
033b0c2bf8
Fix nested extends pattern in AddReturnTypeDeclarationBasedOnParentClassMethodRector (#3325)
This commit is contained in:
parent
2e9b687937
commit
ab985638db
|
@ -100,24 +100,28 @@ CODE_SAMPLE
|
|||
if ($this->nodeNameResolver->isName($node, MethodName::CONSTRUCT)) {
|
||||
return null;
|
||||
}
|
||||
$parentMethodReflection = $this->parentClassMethodTypeOverrideGuard->getParentClassMethod($node);
|
||||
if (!$parentMethodReflection instanceof MethodReflection) {
|
||||
return null;
|
||||
}
|
||||
$parentClassMethod = $this->astResolver->resolveClassMethodFromMethodReflection($parentMethodReflection);
|
||||
if (!$parentClassMethod instanceof ClassMethod) {
|
||||
return null;
|
||||
}
|
||||
if ($parentClassMethod->isPrivate()) {
|
||||
return null;
|
||||
}
|
||||
$parentClassMethodReturnType = $parentClassMethod->getReturnType();
|
||||
$parentClassMethodReturnType = $this->getReturnTypeRecursive($node);
|
||||
if ($parentClassMethodReturnType === null) {
|
||||
return null;
|
||||
}
|
||||
$parentClassMethodReturnType = $this->staticTypeMapper->mapPhpParserNodePHPStanType($parentClassMethodReturnType);
|
||||
return $this->processClassMethodReturnType($node, $parentClassMethodReturnType);
|
||||
}
|
||||
private function getReturnTypeRecursive(ClassMethod $classMethod) : ?Type
|
||||
{
|
||||
$returnType = $classMethod->getReturnType();
|
||||
if ($returnType === null) {
|
||||
$parentMethodReflection = $this->parentClassMethodTypeOverrideGuard->getParentClassMethod($classMethod);
|
||||
if (!$parentMethodReflection instanceof MethodReflection) {
|
||||
return null;
|
||||
}
|
||||
$parentClassMethod = $this->astResolver->resolveClassMethodFromMethodReflection($parentMethodReflection);
|
||||
if (!$parentClassMethod instanceof ClassMethod || $parentClassMethod->isPrivate()) {
|
||||
return null;
|
||||
}
|
||||
return $this->getReturnTypeRecursive($parentClassMethod);
|
||||
}
|
||||
return $this->staticTypeMapper->mapPhpParserNodePHPStanType($returnType);
|
||||
}
|
||||
private function processClassMethodReturnType(ClassMethod $classMethod, Type $parentType) : ?ClassMethod
|
||||
{
|
||||
if ($parentType instanceof MixedType) {
|
||||
|
|
|
@ -19,12 +19,12 @@ final class VersionResolver
|
|||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '82163244c12ff8d14073bda37f21cfb03e532a6f';
|
||||
public const PACKAGE_VERSION = '033b0c2bf86dc2f7cd3c6d6183ddc5ad1a3ab390';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2023-01-30 16:28:58';
|
||||
public const RELEASE_DATE = '2023-01-31 00:47:45';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
|
|
@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
|
|||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInit644e822f2f9577c954a4348a8f005018::getLoader();
|
||||
return ComposerAutoloaderInit3e49df11e5e7a9c3c313caa0abd511ca::getLoader();
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInit644e822f2f9577c954a4348a8f005018
|
||||
class ComposerAutoloaderInit3e49df11e5e7a9c3c313caa0abd511ca
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
|
@ -22,17 +22,17 @@ class ComposerAutoloaderInit644e822f2f9577c954a4348a8f005018
|
|||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit644e822f2f9577c954a4348a8f005018', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit3e49df11e5e7a9c3c313caa0abd511ca', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit644e822f2f9577c954a4348a8f005018', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit3e49df11e5e7a9c3c313caa0abd511ca', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit644e822f2f9577c954a4348a8f005018::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit3e49df11e5e7a9c3c313caa0abd511ca::getInitializer($loader));
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit644e822f2f9577c954a4348a8f005018::$files;
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit3e49df11e5e7a9c3c313caa0abd511ca::$files;
|
||||
$requireFile = static function ($fileIdentifier, $file) {
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInit644e822f2f9577c954a4348a8f005018
|
||||
class ComposerStaticInit3e49df11e5e7a9c3c313caa0abd511ca
|
||||
{
|
||||
public static $files = array (
|
||||
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
||||
|
@ -3082,9 +3082,9 @@ class ComposerStaticInit644e822f2f9577c954a4348a8f005018
|
|||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit644e822f2f9577c954a4348a8f005018::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit644e822f2f9577c954a4348a8f005018::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit644e822f2f9577c954a4348a8f005018::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit3e49df11e5e7a9c3c313caa0abd511ca::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit3e49df11e5e7a9c3c313caa0abd511ca::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit3e49df11e5e7a9c3c313caa0abd511ca::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue