mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-18 22:08:00 +01:00
Updated Rector to commit b5cafa24ba8c2ac4d7a92341adb6af686dd0581f
b5cafa24ba
[PhpParser] Remove parent lookup on BetterNodeFinder::findInstancesOfInFunctionLikeScoped() (#4253)
This commit is contained in:
parent
89c1a25d91
commit
9c5daaf368
@ -19,12 +19,12 @@ final class VersionResolver
|
|||||||
* @api
|
* @api
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public const PACKAGE_VERSION = 'aebf30995293f3ba2cb6bb2d10e3084f7e925a11';
|
public const PACKAGE_VERSION = 'b5cafa24ba8c2ac4d7a92341adb6af686dd0581f';
|
||||||
/**
|
/**
|
||||||
* @api
|
* @api
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public const RELEASE_DATE = '2023-06-17 17:33:17';
|
public const RELEASE_DATE = '2023-06-17 17:42:31';
|
||||||
/**
|
/**
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
|
@ -26,6 +26,7 @@ use PhpParser\Node\Stmt\Return_;
|
|||||||
use PhpParser\Node\Stmt\Switch_;
|
use PhpParser\Node\Stmt\Switch_;
|
||||||
use PhpParser\Node\Stmt\While_;
|
use PhpParser\Node\Stmt\While_;
|
||||||
use PhpParser\NodeFinder;
|
use PhpParser\NodeFinder;
|
||||||
|
use PhpParser\NodeTraverser;
|
||||||
use Rector\Core\Contract\PhpParser\Node\StmtsAwareInterface;
|
use Rector\Core\Contract\PhpParser\Node\StmtsAwareInterface;
|
||||||
use Rector\Core\Exception\StopSearchException;
|
use Rector\Core\Exception\StopSearchException;
|
||||||
use Rector\Core\NodeAnalyzer\ClassAnalyzer;
|
use Rector\Core\NodeAnalyzer\ClassAnalyzer;
|
||||||
@ -36,6 +37,7 @@ use Rector\Core\Util\MultiInstanceofChecker;
|
|||||||
use Rector\Core\ValueObject\Application\File;
|
use Rector\Core\ValueObject\Application\File;
|
||||||
use Rector\NodeNameResolver\NodeNameResolver;
|
use Rector\NodeNameResolver\NodeNameResolver;
|
||||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||||
|
use Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser;
|
||||||
use RectorPrefix202306\Webmozart\Assert\Assert;
|
use RectorPrefix202306\Webmozart\Assert\Assert;
|
||||||
/**
|
/**
|
||||||
* @see \Rector\Core\Tests\PhpParser\Node\BetterNodeFinder\BetterNodeFinderTest
|
* @see \Rector\Core\Tests\PhpParser\Node\BetterNodeFinder\BetterNodeFinderTest
|
||||||
@ -72,7 +74,12 @@ final class BetterNodeFinder
|
|||||||
* @var \Rector\Core\Provider\CurrentFileProvider
|
* @var \Rector\Core\Provider\CurrentFileProvider
|
||||||
*/
|
*/
|
||||||
private $currentFileProvider;
|
private $currentFileProvider;
|
||||||
public function __construct(NodeFinder $nodeFinder, NodeNameResolver $nodeNameResolver, NodeComparator $nodeComparator, ClassAnalyzer $classAnalyzer, MultiInstanceofChecker $multiInstanceofChecker, CurrentFileProvider $currentFileProvider)
|
/**
|
||||||
|
* @readonly
|
||||||
|
* @var \Rector\PhpDocParser\NodeTraverser\SimpleCallableNodeTraverser
|
||||||
|
*/
|
||||||
|
private $simpleCallableNodeTraverser;
|
||||||
|
public function __construct(NodeFinder $nodeFinder, NodeNameResolver $nodeNameResolver, NodeComparator $nodeComparator, ClassAnalyzer $classAnalyzer, MultiInstanceofChecker $multiInstanceofChecker, CurrentFileProvider $currentFileProvider, SimpleCallableNodeTraverser $simpleCallableNodeTraverser)
|
||||||
{
|
{
|
||||||
$this->nodeFinder = $nodeFinder;
|
$this->nodeFinder = $nodeFinder;
|
||||||
$this->nodeNameResolver = $nodeNameResolver;
|
$this->nodeNameResolver = $nodeNameResolver;
|
||||||
@ -80,6 +87,7 @@ final class BetterNodeFinder
|
|||||||
$this->classAnalyzer = $classAnalyzer;
|
$this->classAnalyzer = $classAnalyzer;
|
||||||
$this->multiInstanceofChecker = $multiInstanceofChecker;
|
$this->multiInstanceofChecker = $multiInstanceofChecker;
|
||||||
$this->currentFileProvider = $currentFileProvider;
|
$this->currentFileProvider = $currentFileProvider;
|
||||||
|
$this->simpleCallableNodeTraverser = $simpleCallableNodeTraverser;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @deprecated Make use of child nodes instead
|
* @deprecated Make use of child nodes instead
|
||||||
@ -335,23 +343,18 @@ final class BetterNodeFinder
|
|||||||
}
|
}
|
||||||
/** @var T[] $foundNodes */
|
/** @var T[] $foundNodes */
|
||||||
$foundNodes = [];
|
$foundNodes = [];
|
||||||
foreach ($types as $type) {
|
$this->simpleCallableNodeTraverser->traverseNodesWithCallable((array) $functionLike->stmts, static function (Node $subNode) use($types, &$foundNodes) : ?int {
|
||||||
/** @var T[] $nodes */
|
if ($subNode instanceof Class_ || $subNode instanceof Function_ || $subNode instanceof Closure) {
|
||||||
$nodes = $this->findInstanceOf((array) $functionLike->stmts, $type);
|
return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN;
|
||||||
if ($nodes === []) {
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
foreach ($nodes as $key => $node) {
|
foreach ($types as $type) {
|
||||||
$parentFunctionLike = $this->findParentByTypes($node, [ClassMethod::class, Function_::class, Closure::class]);
|
if ($subNode instanceof $type) {
|
||||||
if ($parentFunctionLike !== $functionLike) {
|
$foundNodes[] = $subNode;
|
||||||
unset($nodes[$key]);
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($nodes === []) {
|
return null;
|
||||||
continue;
|
});
|
||||||
}
|
|
||||||
$foundNodes = \array_merge($foundNodes, $nodes);
|
|
||||||
}
|
|
||||||
return $foundNodes;
|
return $foundNodes;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
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';
|
require_once __DIR__ . '/composer/autoload_real.php';
|
||||||
|
|
||||||
return ComposerAutoloaderInite73eb82043fbea86adc9ecc4b98e94ff::getLoader();
|
return ComposerAutoloaderInit43e31d337be7dc1648be8823b77b2b05::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
|
// autoload_real.php @generated by Composer
|
||||||
|
|
||||||
class ComposerAutoloaderInite73eb82043fbea86adc9ecc4b98e94ff
|
class ComposerAutoloaderInit43e31d337be7dc1648be8823b77b2b05
|
||||||
{
|
{
|
||||||
private static $loader;
|
private static $loader;
|
||||||
|
|
||||||
@ -22,17 +22,17 @@ class ComposerAutoloaderInite73eb82043fbea86adc9ecc4b98e94ff
|
|||||||
return self::$loader;
|
return self::$loader;
|
||||||
}
|
}
|
||||||
|
|
||||||
spl_autoload_register(array('ComposerAutoloaderInite73eb82043fbea86adc9ecc4b98e94ff', 'loadClassLoader'), true, true);
|
spl_autoload_register(array('ComposerAutoloaderInit43e31d337be7dc1648be8823b77b2b05', 'loadClassLoader'), true, true);
|
||||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||||
spl_autoload_unregister(array('ComposerAutoloaderInite73eb82043fbea86adc9ecc4b98e94ff', 'loadClassLoader'));
|
spl_autoload_unregister(array('ComposerAutoloaderInit43e31d337be7dc1648be8823b77b2b05', 'loadClassLoader'));
|
||||||
|
|
||||||
require __DIR__ . '/autoload_static.php';
|
require __DIR__ . '/autoload_static.php';
|
||||||
call_user_func(\Composer\Autoload\ComposerStaticInite73eb82043fbea86adc9ecc4b98e94ff::getInitializer($loader));
|
call_user_func(\Composer\Autoload\ComposerStaticInit43e31d337be7dc1648be8823b77b2b05::getInitializer($loader));
|
||||||
|
|
||||||
$loader->setClassMapAuthoritative(true);
|
$loader->setClassMapAuthoritative(true);
|
||||||
$loader->register(true);
|
$loader->register(true);
|
||||||
|
|
||||||
$filesToLoad = \Composer\Autoload\ComposerStaticInite73eb82043fbea86adc9ecc4b98e94ff::$files;
|
$filesToLoad = \Composer\Autoload\ComposerStaticInit43e31d337be7dc1648be8823b77b2b05::$files;
|
||||||
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
|
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
|
||||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
$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;
|
namespace Composer\Autoload;
|
||||||
|
|
||||||
class ComposerStaticInite73eb82043fbea86adc9ecc4b98e94ff
|
class ComposerStaticInit43e31d337be7dc1648be8823b77b2b05
|
||||||
{
|
{
|
||||||
public static $files = array (
|
public static $files = array (
|
||||||
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
||||||
@ -3094,9 +3094,9 @@ class ComposerStaticInite73eb82043fbea86adc9ecc4b98e94ff
|
|||||||
public static function getInitializer(ClassLoader $loader)
|
public static function getInitializer(ClassLoader $loader)
|
||||||
{
|
{
|
||||||
return \Closure::bind(function () use ($loader) {
|
return \Closure::bind(function () use ($loader) {
|
||||||
$loader->prefixLengthsPsr4 = ComposerStaticInite73eb82043fbea86adc9ecc4b98e94ff::$prefixLengthsPsr4;
|
$loader->prefixLengthsPsr4 = ComposerStaticInit43e31d337be7dc1648be8823b77b2b05::$prefixLengthsPsr4;
|
||||||
$loader->prefixDirsPsr4 = ComposerStaticInite73eb82043fbea86adc9ecc4b98e94ff::$prefixDirsPsr4;
|
$loader->prefixDirsPsr4 = ComposerStaticInit43e31d337be7dc1648be8823b77b2b05::$prefixDirsPsr4;
|
||||||
$loader->classMap = ComposerStaticInite73eb82043fbea86adc9ecc4b98e94ff::$classMap;
|
$loader->classMap = ComposerStaticInit43e31d337be7dc1648be8823b77b2b05::$classMap;
|
||||||
|
|
||||||
}, null, ClassLoader::class);
|
}, null, ClassLoader::class);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user