mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-12 14:12:23 +00:00
Updated Rector to commit fa28385f9b46b0119073fb4209762fce23f8c09a
fa28385f9b
Refactor BetterNodeFinder::findFirstInFunctionLikeScoped() to work with SilentVoidResolver (#4931)
This commit is contained in:
parent
94613faf8f
commit
549a072c08
|
@ -49,13 +49,10 @@ final class SilentVoidResolver
|
|||
if ($this->betterNodeFinder->hasInstancesOfInFunctionLikeScoped($functionLike, Yield_::class)) {
|
||||
return \false;
|
||||
}
|
||||
$returns = $this->betterNodeFinder->findInstancesOfInFunctionLikeScoped($functionLike, Return_::class);
|
||||
foreach ($returns as $return) {
|
||||
if ($return->expr instanceof Expr) {
|
||||
return \false;
|
||||
}
|
||||
}
|
||||
return \true;
|
||||
$return = $this->betterNodeFinder->findFirstInFunctionLikeScoped($functionLike, static function (Node $node) : bool {
|
||||
return $node instanceof Return_ && $node->expr instanceof Expr;
|
||||
});
|
||||
return !$return instanceof Return_;
|
||||
}
|
||||
public function hasSilentVoid(FunctionLike $functionLike) : bool
|
||||
{
|
||||
|
|
|
@ -19,12 +19,12 @@ final class VersionResolver
|
|||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '54799fc3d3a341643d050d06ecf72b467c8d37e8';
|
||||
public const PACKAGE_VERSION = 'fa28385f9b46b0119073fb4209762fce23f8c09a';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2023-09-07 02:07:31';
|
||||
public const RELEASE_DATE = '2023-09-07 04:00:30';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
|
|
@ -225,7 +225,7 @@ final class BetterNodeFinder
|
|||
return $foundNode;
|
||||
}
|
||||
$scopedNode = null;
|
||||
$this->simpleCallableNodeTraverser->traverseNodesWithCallable($functionLike->stmts, static function (Node $subNode) use(&$scopedNode, $foundNode) : ?int {
|
||||
$this->simpleCallableNodeTraverser->traverseNodesWithCallable($functionLike->stmts, function (Node $subNode) use(&$scopedNode, $foundNode, $filter) : ?int {
|
||||
if ($subNode instanceof Class_ || $subNode instanceof Function_ || $subNode instanceof Closure) {
|
||||
if ($foundNode instanceof $subNode && $subNode === $foundNode) {
|
||||
$scopedNode = $subNode;
|
||||
|
@ -233,7 +233,13 @@ final class BetterNodeFinder
|
|||
}
|
||||
return NodeTraverser::DONT_TRAVERSE_CURRENT_AND_CHILDREN;
|
||||
}
|
||||
if ($foundNode instanceof $subNode && $subNode === $foundNode) {
|
||||
if (!$foundNode instanceof $subNode) {
|
||||
return null;
|
||||
}
|
||||
// handle after Closure
|
||||
// @see https://github.com/rectorphp/rector-src/pull/4931
|
||||
$scopedFoundNode = $this->findFirst($subNode, $filter);
|
||||
if ($scopedFoundNode === $subNode) {
|
||||
$scopedNode = $subNode;
|
||||
return NodeTraverser::STOP_TRAVERSAL;
|
||||
}
|
||||
|
|
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 ComposerAutoloaderInitedff5d0460f6c5a02f977a6f9323808d::getLoader();
|
||||
return ComposerAutoloaderInit294ccb2f3aaeaa1f54035fb7085078c5::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 ComposerAutoloaderInitedff5d0460f6c5a02f977a6f9323808d
|
||||
class ComposerAutoloaderInit294ccb2f3aaeaa1f54035fb7085078c5
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
|
@ -22,17 +22,17 @@ class ComposerAutoloaderInitedff5d0460f6c5a02f977a6f9323808d
|
|||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInitedff5d0460f6c5a02f977a6f9323808d', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit294ccb2f3aaeaa1f54035fb7085078c5', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitedff5d0460f6c5a02f977a6f9323808d', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit294ccb2f3aaeaa1f54035fb7085078c5', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInitedff5d0460f6c5a02f977a6f9323808d::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit294ccb2f3aaeaa1f54035fb7085078c5::getInitializer($loader));
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInitedff5d0460f6c5a02f977a6f9323808d::$files;
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit294ccb2f3aaeaa1f54035fb7085078c5::$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 ComposerStaticInitedff5d0460f6c5a02f977a6f9323808d
|
||||
class ComposerStaticInit294ccb2f3aaeaa1f54035fb7085078c5
|
||||
{
|
||||
public static $files = array (
|
||||
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
||||
|
@ -2603,9 +2603,9 @@ class ComposerStaticInitedff5d0460f6c5a02f977a6f9323808d
|
|||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInitedff5d0460f6c5a02f977a6f9323808d::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInitedff5d0460f6c5a02f977a6f9323808d::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInitedff5d0460f6c5a02f977a6f9323808d::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit294ccb2f3aaeaa1f54035fb7085078c5::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit294ccb2f3aaeaa1f54035fb7085078c5::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit294ccb2f3aaeaa1f54035fb7085078c5::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user