mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-18 22:08:00 +01:00
Updated Rector to commit 424b874e8cbfde95c46e1bba12ffe6931c375197
424b874e8c
[NodeManipulator] Remove parent lookup on ClassMethodPropertyFetchManipulator (#4170)
This commit is contained in:
parent
971a0d2b75
commit
ca8754469c
@ -19,12 +19,12 @@ final class VersionResolver
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = 'ea2ee121e0b6388fdcda0125f7dca941a44edc3a';
|
||||
public const PACKAGE_VERSION = '424b874e8cbfde95c46e1bba12ffe6931c375197';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2023-06-11 12:42:01';
|
||||
public const RELEASE_DATE = '2023-06-11 12:50:49';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
@ -15,7 +15,7 @@ final class RectorKernel
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private const CACHE_KEY = 'v90';
|
||||
private const CACHE_KEY = 'v91';
|
||||
/**
|
||||
* @var \Symfony\Component\DependencyInjection\ContainerInterface|null
|
||||
*/
|
||||
|
@ -11,9 +11,9 @@ use PhpParser\Node\Expr\PropertyFetch;
|
||||
use PhpParser\Node\Expr\StaticCall;
|
||||
use PhpParser\Node\Expr\StaticPropertyFetch;
|
||||
use PhpParser\Node\Param;
|
||||
use PhpParser\Node\Stmt\Class_;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use PhpParser\NodeTraverser;
|
||||
use Rector\Core\PhpParser\Node\BetterNodeFinder;
|
||||
use Rector\NodeNameResolver\NodeNameResolver;
|
||||
use Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser;
|
||||
final class ClassMethodPropertyFetchManipulator
|
||||
@ -28,21 +28,15 @@ final class ClassMethodPropertyFetchManipulator
|
||||
* @var \Rector\NodeNameResolver\NodeNameResolver
|
||||
*/
|
||||
private $nodeNameResolver;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\PhpParser\Node\BetterNodeFinder
|
||||
*/
|
||||
private $betterNodeFinder;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\NodeManipulator\FunctionLikeManipulator
|
||||
*/
|
||||
private $functionLikeManipulator;
|
||||
public function __construct(SimpleCallableNodeTraverser $simpleCallableNodeTraverser, NodeNameResolver $nodeNameResolver, BetterNodeFinder $betterNodeFinder, \Rector\Core\NodeManipulator\FunctionLikeManipulator $functionLikeManipulator)
|
||||
public function __construct(SimpleCallableNodeTraverser $simpleCallableNodeTraverser, NodeNameResolver $nodeNameResolver, \Rector\Core\NodeManipulator\FunctionLikeManipulator $functionLikeManipulator)
|
||||
{
|
||||
$this->simpleCallableNodeTraverser = $simpleCallableNodeTraverser;
|
||||
$this->nodeNameResolver = $nodeNameResolver;
|
||||
$this->betterNodeFinder = $betterNodeFinder;
|
||||
$this->functionLikeManipulator = $functionLikeManipulator;
|
||||
}
|
||||
/**
|
||||
@ -57,7 +51,10 @@ final class ClassMethodPropertyFetchManipulator
|
||||
public function findParamAssignToPropertyName(ClassMethod $classMethod, string $propertyName) : ?Param
|
||||
{
|
||||
$assignedParamName = null;
|
||||
$this->simpleCallableNodeTraverser->traverseNodesWithCallable((array) $classMethod->stmts, function (Node $node) use($propertyName, &$assignedParamName, $classMethod) : ?int {
|
||||
$this->simpleCallableNodeTraverser->traverseNodesWithCallable((array) $classMethod->stmts, function (Node $node) use($propertyName, &$assignedParamName) : ?int {
|
||||
if ($node instanceof Class_) {
|
||||
return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN;
|
||||
}
|
||||
if (!$node instanceof Assign) {
|
||||
return null;
|
||||
}
|
||||
@ -70,10 +67,6 @@ final class ClassMethodPropertyFetchManipulator
|
||||
if ($node->expr instanceof MethodCall || $node->expr instanceof StaticCall) {
|
||||
return null;
|
||||
}
|
||||
$parentClassMethod = $this->betterNodeFinder->findParentType($node, ClassMethod::class);
|
||||
if ($parentClassMethod !== $classMethod) {
|
||||
return null;
|
||||
}
|
||||
$assignedParamName = $this->nodeNameResolver->getName($node->expr);
|
||||
return NodeTraverser::STOP_TRAVERSAL;
|
||||
});
|
||||
@ -102,7 +95,10 @@ final class ClassMethodPropertyFetchManipulator
|
||||
{
|
||||
$assignExprs = [];
|
||||
$paramNames = $this->functionLikeManipulator->resolveParamNames($classMethod);
|
||||
$this->simpleCallableNodeTraverser->traverseNodesWithCallable((array) $classMethod->stmts, function (Node $node) use($propertyName, &$assignExprs, $paramNames, $classMethod) : ?int {
|
||||
$this->simpleCallableNodeTraverser->traverseNodesWithCallable((array) $classMethod->stmts, function (Node $node) use($propertyName, &$assignExprs, $paramNames) : ?int {
|
||||
if ($node instanceof Class_) {
|
||||
return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN;
|
||||
}
|
||||
if (!$node instanceof Assign) {
|
||||
return null;
|
||||
}
|
||||
@ -116,10 +112,6 @@ final class ClassMethodPropertyFetchManipulator
|
||||
if ($this->nodeNameResolver->isNames($node->expr, $paramNames)) {
|
||||
return null;
|
||||
}
|
||||
$parentClassMethod = $this->betterNodeFinder->findParentType($node, ClassMethod::class);
|
||||
if ($parentClassMethod !== $classMethod) {
|
||||
return null;
|
||||
}
|
||||
$assignExprs[] = $node->expr;
|
||||
return null;
|
||||
});
|
||||
|
2
vendor/autoload.php
vendored
2
vendor/autoload.php
vendored
@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
|
||||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInit2a46dd31cd0649b8ab5689ec3d5eed81::getLoader();
|
||||
return ComposerAutoloaderInit2378f77656410cec75dca53cf234ebb4::getLoader();
|
||||
|
10
vendor/composer/autoload_real.php
vendored
10
vendor/composer/autoload_real.php
vendored
@ -2,7 +2,7 @@
|
||||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInit2a46dd31cd0649b8ab5689ec3d5eed81
|
||||
class ComposerAutoloaderInit2378f77656410cec75dca53cf234ebb4
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
@ -22,17 +22,17 @@ class ComposerAutoloaderInit2a46dd31cd0649b8ab5689ec3d5eed81
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit2a46dd31cd0649b8ab5689ec3d5eed81', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit2378f77656410cec75dca53cf234ebb4', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit2a46dd31cd0649b8ab5689ec3d5eed81', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit2378f77656410cec75dca53cf234ebb4', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit2a46dd31cd0649b8ab5689ec3d5eed81::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit2378f77656410cec75dca53cf234ebb4::getInitializer($loader));
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit2a46dd31cd0649b8ab5689ec3d5eed81::$files;
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit2378f77656410cec75dca53cf234ebb4::$files;
|
||||
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||
|
8
vendor/composer/autoload_static.php
vendored
8
vendor/composer/autoload_static.php
vendored
@ -4,7 +4,7 @@
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInit2a46dd31cd0649b8ab5689ec3d5eed81
|
||||
class ComposerStaticInit2378f77656410cec75dca53cf234ebb4
|
||||
{
|
||||
public static $files = array (
|
||||
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
||||
@ -3127,9 +3127,9 @@ class ComposerStaticInit2a46dd31cd0649b8ab5689ec3d5eed81
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit2a46dd31cd0649b8ab5689ec3d5eed81::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit2a46dd31cd0649b8ab5689ec3d5eed81::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit2a46dd31cd0649b8ab5689ec3d5eed81::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit2378f77656410cec75dca53cf234ebb4::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit2378f77656410cec75dca53cf234ebb4::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit2378f77656410cec75dca53cf234ebb4::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user