Updated Rector to commit cc89395feeb3ed2a85b186a93722f9dd27e06ec1

cc89395fee [EarlyReturn] Handle Repetitive If_ on use ReturnBinaryOrToEarlyReturnRector (#670)
This commit is contained in:
Tomas Votruba 2021-08-13 20:42:45 +00:00
parent 080ee3ab60
commit fd9090a133
7 changed files with 35 additions and 22 deletions

View File

@ -85,11 +85,11 @@ CODE_SAMPLE
if ($ifs === []) {
return null;
}
if (!$this->callAnalyzer->doesIfHasObjectCall($ifs)) {
return null;
}
$this->mirrorComments($ifs[0], $node);
foreach ($ifs as $if) {
if (!$this->callAnalyzer->isObjectCall($if->cond)) {
return null;
}
$this->addNodeBeforeNode($if, $node);
}
$lastReturnExpr = $this->assignAndBinaryMap->getTruthyExpr($booleanOr->right);

View File

@ -16,11 +16,11 @@ final class VersionResolver
/**
* @var string
*/
public const PACKAGE_VERSION = 'b53d44daeee982fd1d7a0711b86258e3d6ef70fe';
public const PACKAGE_VERSION = 'cc89395feeb3ed2a85b186a93722f9dd27e06ec1';
/**
* @var string
*/
public const RELEASE_DATE = '2021-08-13 22:30:26';
public const RELEASE_DATE = '2021-08-13 22:30:34';
public static function resolvePackageVersion() : string
{
$process = new \RectorPrefix20210813\Symfony\Component\Process\Process(['git', 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__);

View File

@ -9,6 +9,7 @@ use PhpParser\Node\Expr\BooleanNot;
use PhpParser\Node\Expr\MethodCall;
use PhpParser\Node\Expr\NullsafeMethodCall;
use PhpParser\Node\Expr\StaticCall;
use PhpParser\Node\Stmt\If_;
final class CallAnalyzer
{
/**
@ -32,4 +33,16 @@ final class CallAnalyzer
}
return \false;
}
/**
* @param If_[] $ifs
*/
public function doesIfHasObjectCall(array $ifs) : bool
{
foreach ($ifs as $if) {
if ($this->isObjectCall($if->cond)) {
return \true;
}
}
return \false;
}
}

2
vendor/autoload.php vendored
View File

@ -4,4 +4,4 @@
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInit06a8ec1243b82a6c9171fe9e06cad9bf::getLoader();
return ComposerAutoloaderInit5bcc09f43aae40430f1f4d2783d03a49::getLoader();

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit06a8ec1243b82a6c9171fe9e06cad9bf
class ComposerAutoloaderInit5bcc09f43aae40430f1f4d2783d03a49
{
private static $loader;
@ -22,15 +22,15 @@ class ComposerAutoloaderInit06a8ec1243b82a6c9171fe9e06cad9bf
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit06a8ec1243b82a6c9171fe9e06cad9bf', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit5bcc09f43aae40430f1f4d2783d03a49', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
spl_autoload_unregister(array('ComposerAutoloaderInit06a8ec1243b82a6c9171fe9e06cad9bf', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit5bcc09f43aae40430f1f4d2783d03a49', 'loadClassLoader'));
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) {
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInit06a8ec1243b82a6c9171fe9e06cad9bf::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit5bcc09f43aae40430f1f4d2783d03a49::getInitializer($loader));
} else {
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
@ -42,19 +42,19 @@ class ComposerAutoloaderInit06a8ec1243b82a6c9171fe9e06cad9bf
$loader->register(true);
if ($useStaticLoader) {
$includeFiles = Composer\Autoload\ComposerStaticInit06a8ec1243b82a6c9171fe9e06cad9bf::$files;
$includeFiles = Composer\Autoload\ComposerStaticInit5bcc09f43aae40430f1f4d2783d03a49::$files;
} else {
$includeFiles = require __DIR__ . '/autoload_files.php';
}
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequire06a8ec1243b82a6c9171fe9e06cad9bf($fileIdentifier, $file);
composerRequire5bcc09f43aae40430f1f4d2783d03a49($fileIdentifier, $file);
}
return $loader;
}
}
function composerRequire06a8ec1243b82a6c9171fe9e06cad9bf($fileIdentifier, $file)
function composerRequire5bcc09f43aae40430f1f4d2783d03a49($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
require $file;

View File

@ -4,7 +4,7 @@
namespace Composer\Autoload;
class ComposerStaticInit06a8ec1243b82a6c9171fe9e06cad9bf
class ComposerStaticInit5bcc09f43aae40430f1f4d2783d03a49
{
public static $files = array (
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
@ -3850,9 +3850,9 @@ class ComposerStaticInit06a8ec1243b82a6c9171fe9e06cad9bf
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit06a8ec1243b82a6c9171fe9e06cad9bf::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit06a8ec1243b82a6c9171fe9e06cad9bf::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit06a8ec1243b82a6c9171fe9e06cad9bf::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit5bcc09f43aae40430f1f4d2783d03a49::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit5bcc09f43aae40430f1f4d2783d03a49::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit5bcc09f43aae40430f1f4d2783d03a49::$classMap;
}, null, ClassLoader::class);
}

View File

@ -9,8 +9,8 @@ $loader = require_once __DIR__.'/autoload.php';
if (!class_exists('AutoloadIncluder', false) && !interface_exists('AutoloadIncluder', false) && !trait_exists('AutoloadIncluder', false)) {
spl_autoload_call('RectorPrefix20210813\AutoloadIncluder');
}
if (!class_exists('ComposerAutoloaderInit06a8ec1243b82a6c9171fe9e06cad9bf', false) && !interface_exists('ComposerAutoloaderInit06a8ec1243b82a6c9171fe9e06cad9bf', false) && !trait_exists('ComposerAutoloaderInit06a8ec1243b82a6c9171fe9e06cad9bf', false)) {
spl_autoload_call('RectorPrefix20210813\ComposerAutoloaderInit06a8ec1243b82a6c9171fe9e06cad9bf');
if (!class_exists('ComposerAutoloaderInit5bcc09f43aae40430f1f4d2783d03a49', false) && !interface_exists('ComposerAutoloaderInit5bcc09f43aae40430f1f4d2783d03a49', false) && !trait_exists('ComposerAutoloaderInit5bcc09f43aae40430f1f4d2783d03a49', false)) {
spl_autoload_call('RectorPrefix20210813\ComposerAutoloaderInit5bcc09f43aae40430f1f4d2783d03a49');
}
if (!class_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false) && !interface_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false) && !trait_exists('Helmich\TypoScriptParser\Parser\AST\Statement', false)) {
spl_autoload_call('RectorPrefix20210813\Helmich\TypoScriptParser\Parser\AST\Statement');
@ -3308,9 +3308,9 @@ if (!function_exists('print_node')) {
return \RectorPrefix20210813\print_node(...func_get_args());
}
}
if (!function_exists('composerRequire06a8ec1243b82a6c9171fe9e06cad9bf')) {
function composerRequire06a8ec1243b82a6c9171fe9e06cad9bf() {
return \RectorPrefix20210813\composerRequire06a8ec1243b82a6c9171fe9e06cad9bf(...func_get_args());
if (!function_exists('composerRequire5bcc09f43aae40430f1f4d2783d03a49')) {
function composerRequire5bcc09f43aae40430f1f4d2783d03a49() {
return \RectorPrefix20210813\composerRequire5bcc09f43aae40430f1f4d2783d03a49(...func_get_args());
}
}
if (!function_exists('parseArgs')) {