Skip to content

Commit ab98563

Browse files
committed
Updated Rector to commit 033b0c2bf86dc2f7cd3c6d6183ddc5ad1a3ab390
rectorphp/rector-src@033b0c2 Fix nested extends pattern in AddReturnTypeDeclarationBasedOnParentClassMethodRector (#3325)
1 parent 2e9b687 commit ab98563

File tree

5 files changed

+29
-25
lines changed

5 files changed

+29
-25
lines changed

rules/TypeDeclaration/Rector/ClassMethod/AddReturnTypeDeclarationBasedOnParentClassMethodRector.php

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -100,24 +100,28 @@ public function refactor(Node $node) : ?Node
100100
if ($this->nodeNameResolver->isName($node, MethodName::CONSTRUCT)) {
101101
return null;
102102
}
103-
$parentMethodReflection = $this->parentClassMethodTypeOverrideGuard->getParentClassMethod($node);
104-
if (!$parentMethodReflection instanceof MethodReflection) {
105-
return null;
106-
}
107-
$parentClassMethod = $this->astResolver->resolveClassMethodFromMethodReflection($parentMethodReflection);
108-
if (!$parentClassMethod instanceof ClassMethod) {
109-
return null;
110-
}
111-
if ($parentClassMethod->isPrivate()) {
112-
return null;
113-
}
114-
$parentClassMethodReturnType = $parentClassMethod->getReturnType();
103+
$parentClassMethodReturnType = $this->getReturnTypeRecursive($node);
115104
if ($parentClassMethodReturnType === null) {
116105
return null;
117106
}
118-
$parentClassMethodReturnType = $this->staticTypeMapper->mapPhpParserNodePHPStanType($parentClassMethodReturnType);
119107
return $this->processClassMethodReturnType($node, $parentClassMethodReturnType);
120108
}
109+
private function getReturnTypeRecursive(ClassMethod $classMethod) : ?Type
110+
{
111+
$returnType = $classMethod->getReturnType();
112+
if ($returnType === null) {
113+
$parentMethodReflection = $this->parentClassMethodTypeOverrideGuard->getParentClassMethod($classMethod);
114+
if (!$parentMethodReflection instanceof MethodReflection) {
115+
return null;
116+
}
117+
$parentClassMethod = $this->astResolver->resolveClassMethodFromMethodReflection($parentMethodReflection);
118+
if (!$parentClassMethod instanceof ClassMethod || $parentClassMethod->isPrivate()) {
119+
return null;
120+
}
121+
return $this->getReturnTypeRecursive($parentClassMethod);
122+
}
123+
return $this->staticTypeMapper->mapPhpParserNodePHPStanType($returnType);
124+
}
121125
private function processClassMethodReturnType(ClassMethod $classMethod, Type $parentType) : ?ClassMethod
122126
{
123127
if ($parentType instanceof MixedType) {

src/Application/VersionResolver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ final class VersionResolver
1919
* @api
2020
* @var string
2121
*/
22-
public const PACKAGE_VERSION = '82163244c12ff8d14073bda37f21cfb03e532a6f';
22+
public const PACKAGE_VERSION = '033b0c2bf86dc2f7cd3c6d6183ddc5ad1a3ab390';
2323
/**
2424
* @api
2525
* @var string
2626
*/
27-
public const RELEASE_DATE = '2023-01-30 16:28:58';
27+
public const RELEASE_DATE = '2023-01-31 00:47:45';
2828
/**
2929
* @var int
3030
*/

vendor/autoload.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@
2222

2323
require_once __DIR__ . '/composer/autoload_real.php';
2424

25-
return ComposerAutoloaderInit644e822f2f9577c954a4348a8f005018::getLoader();
25+
return ComposerAutoloaderInit3e49df11e5e7a9c3c313caa0abd511ca::getLoader();

vendor/composer/autoload_real.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
// autoload_real.php @generated by Composer
44

5-
class ComposerAutoloaderInit644e822f2f9577c954a4348a8f005018
5+
class ComposerAutoloaderInit3e49df11e5e7a9c3c313caa0abd511ca
66
{
77
private static $loader;
88

@@ -22,17 +22,17 @@ public static function getLoader()
2222
return self::$loader;
2323
}
2424

25-
spl_autoload_register(array('ComposerAutoloaderInit644e822f2f9577c954a4348a8f005018', 'loadClassLoader'), true, true);
25+
spl_autoload_register(array('ComposerAutoloaderInit3e49df11e5e7a9c3c313caa0abd511ca', 'loadClassLoader'), true, true);
2626
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
27-
spl_autoload_unregister(array('ComposerAutoloaderInit644e822f2f9577c954a4348a8f005018', 'loadClassLoader'));
27+
spl_autoload_unregister(array('ComposerAutoloaderInit3e49df11e5e7a9c3c313caa0abd511ca', 'loadClassLoader'));
2828

2929
require __DIR__ . '/autoload_static.php';
30-
call_user_func(\Composer\Autoload\ComposerStaticInit644e822f2f9577c954a4348a8f005018::getInitializer($loader));
30+
call_user_func(\Composer\Autoload\ComposerStaticInit3e49df11e5e7a9c3c313caa0abd511ca::getInitializer($loader));
3131

3232
$loader->setClassMapAuthoritative(true);
3333
$loader->register(true);
3434

35-
$filesToLoad = \Composer\Autoload\ComposerStaticInit644e822f2f9577c954a4348a8f005018::$files;
35+
$filesToLoad = \Composer\Autoload\ComposerStaticInit3e49df11e5e7a9c3c313caa0abd511ca::$files;
3636
$requireFile = static function ($fileIdentifier, $file) {
3737
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
3838
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;

vendor/composer/autoload_static.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace Composer\Autoload;
66

7-
class ComposerStaticInit644e822f2f9577c954a4348a8f005018
7+
class ComposerStaticInit3e49df11e5e7a9c3c313caa0abd511ca
88
{
99
public static $files = array (
1010
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
@@ -3082,9 +3082,9 @@ class ComposerStaticInit644e822f2f9577c954a4348a8f005018
30823082
public static function getInitializer(ClassLoader $loader)
30833083
{
30843084
return \Closure::bind(function () use ($loader) {
3085-
$loader->prefixLengthsPsr4 = ComposerStaticInit644e822f2f9577c954a4348a8f005018::$prefixLengthsPsr4;
3086-
$loader->prefixDirsPsr4 = ComposerStaticInit644e822f2f9577c954a4348a8f005018::$prefixDirsPsr4;
3087-
$loader->classMap = ComposerStaticInit644e822f2f9577c954a4348a8f005018::$classMap;
3085+
$loader->prefixLengthsPsr4 = ComposerStaticInit3e49df11e5e7a9c3c313caa0abd511ca::$prefixLengthsPsr4;
3086+
$loader->prefixDirsPsr4 = ComposerStaticInit3e49df11e5e7a9c3c313caa0abd511ca::$prefixDirsPsr4;
3087+
$loader->classMap = ComposerStaticInit3e49df11e5e7a9c3c313caa0abd511ca::$classMap;
30883088

30893089
}, null, ClassLoader::class);
30903090
}

0 commit comments

Comments
 (0)