Updated Rector to commit 837c2262f13e5b8faffdb02c5d9fb701d581fa61

837c2262f1 [EarlyReturn] Do not remove previous If_ stmts on ChangeNestedIfsToEarlyReturnRector (#2820)
This commit is contained in:
Tomas Votruba 2022-08-23 16:18:17 +00:00
parent 36d955f51d
commit cc69a886a3
5 changed files with 20 additions and 15 deletions

View File

@ -87,9 +87,14 @@ CODE_SAMPLE
if ($stmts === null) { if ($stmts === null) {
return null; return null;
} }
/** @var Stmt[] $previousStmts[] */
$previousStmts = [];
foreach ($stmts as $key => $stmt) { foreach ($stmts as $key => $stmt) {
$nextStmt = $stmts[$key + 1] ?? null; $nextStmt = $stmts[$key + 1] ?? null;
if (!$nextStmt instanceof Return_) { if (!$nextStmt instanceof Return_) {
if ($nextStmt instanceof Stmt) {
$previousStmts[] = $stmt;
}
continue; continue;
} }
if (!$stmt instanceof If_) { if (!$stmt instanceof If_) {
@ -99,7 +104,7 @@ CODE_SAMPLE
if ($nestedIfsWithOnlyReturn === []) { if ($nestedIfsWithOnlyReturn === []) {
continue; continue;
} }
$node->stmts = $this->processNestedIfsWithOnlyReturn($nestedIfsWithOnlyReturn, $nextStmt); $node->stmts = \array_merge($previousStmts, $this->processNestedIfsWithOnlyReturn($nestedIfsWithOnlyReturn, $nextStmt));
return $node; return $node;
} }
return null; return null;

View File

@ -17,12 +17,12 @@ final class VersionResolver
* @api * @api
* @var string * @var string
*/ */
public const PACKAGE_VERSION = 'cb7a84c8bb0343205b7c9ce5d6442187dd089b28'; public const PACKAGE_VERSION = '837c2262f13e5b8faffdb02c5d9fb701d581fa61';
/** /**
* @api * @api
* @var string * @var string
*/ */
public const RELEASE_DATE = '2022-08-23 18:11:13'; public const RELEASE_DATE = '2022-08-23 18:13:34';
/** /**
* @var int * @var int
*/ */

2
vendor/autoload.php vendored
View File

@ -9,4 +9,4 @@ if (PHP_VERSION_ID < 50600) {
require_once __DIR__ . '/composer/autoload_real.php'; require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit04728a237bd85a947e72064c342f9603::getLoader(); return ComposerAutoloaderInit056fb7a41d9848c9734584959af9dabf::getLoader();

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer // autoload_real.php @generated by Composer
class ComposerAutoloaderInit04728a237bd85a947e72064c342f9603 class ComposerAutoloaderInit056fb7a41d9848c9734584959af9dabf
{ {
private static $loader; private static $loader;
@ -22,19 +22,19 @@ class ComposerAutoloaderInit04728a237bd85a947e72064c342f9603
return self::$loader; return self::$loader;
} }
spl_autoload_register(array('ComposerAutoloaderInit04728a237bd85a947e72064c342f9603', 'loadClassLoader'), true, true); spl_autoload_register(array('ComposerAutoloaderInit056fb7a41d9848c9734584959af9dabf', '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('ComposerAutoloaderInit04728a237bd85a947e72064c342f9603', 'loadClassLoader')); spl_autoload_unregister(array('ComposerAutoloaderInit056fb7a41d9848c9734584959af9dabf', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php'; require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit04728a237bd85a947e72064c342f9603::getInitializer($loader)); call_user_func(\Composer\Autoload\ComposerStaticInit056fb7a41d9848c9734584959af9dabf::getInitializer($loader));
$loader->setClassMapAuthoritative(true); $loader->setClassMapAuthoritative(true);
$loader->register(true); $loader->register(true);
$includeFiles = \Composer\Autoload\ComposerStaticInit04728a237bd85a947e72064c342f9603::$files; $includeFiles = \Composer\Autoload\ComposerStaticInit056fb7a41d9848c9734584959af9dabf::$files;
foreach ($includeFiles as $fileIdentifier => $file) { foreach ($includeFiles as $fileIdentifier => $file) {
composerRequire04728a237bd85a947e72064c342f9603($fileIdentifier, $file); composerRequire056fb7a41d9848c9734584959af9dabf($fileIdentifier, $file);
} }
return $loader; return $loader;
@ -46,7 +46,7 @@ class ComposerAutoloaderInit04728a237bd85a947e72064c342f9603
* @param string $file * @param string $file
* @return void * @return void
*/ */
function composerRequire04728a237bd85a947e72064c342f9603($fileIdentifier, $file) function composerRequire056fb7a41d9848c9734584959af9dabf($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;

View File

@ -4,7 +4,7 @@
namespace Composer\Autoload; namespace Composer\Autoload;
class ComposerStaticInit04728a237bd85a947e72064c342f9603 class ComposerStaticInit056fb7a41d9848c9734584959af9dabf
{ {
public static $files = array ( public static $files = array (
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php', '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
@ -3256,9 +3256,9 @@ class ComposerStaticInit04728a237bd85a947e72064c342f9603
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 = ComposerStaticInit04728a237bd85a947e72064c342f9603::$prefixLengthsPsr4; $loader->prefixLengthsPsr4 = ComposerStaticInit056fb7a41d9848c9734584959af9dabf::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit04728a237bd85a947e72064c342f9603::$prefixDirsPsr4; $loader->prefixDirsPsr4 = ComposerStaticInit056fb7a41d9848c9734584959af9dabf::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit04728a237bd85a947e72064c342f9603::$classMap; $loader->classMap = ComposerStaticInit056fb7a41d9848c9734584959af9dabf::$classMap;
}, null, ClassLoader::class); }, null, ClassLoader::class);
} }