Updated Rector to commit 8e48e498234ac51af25b584f866ddd200803f02f

8e48e49823 [EarlyReturn] Skip complex if cond and with ChangeAndIfToEarlyReturnRector and RemoveAlwaysElseRector (#654)
This commit is contained in:
Tomas Votruba 2021-08-12 13:13:24 +00:00
parent 93cc8dacbc
commit 359cdb2450
10 changed files with 37 additions and 29 deletions

View File

@ -4,6 +4,7 @@ declare (strict_types=1);
namespace Rector\EarlyReturn\Rector\If_;
use PhpParser\Node;
use PhpParser\Node\Expr\BinaryOp\BooleanAnd;
use PhpParser\Node\Expr\BinaryOp\BooleanOr;
use PhpParser\Node\Expr\Exit_;
use PhpParser\Node\Stmt\Continue_;
@ -71,6 +72,11 @@ CODE_SAMPLE
if ($node->cond instanceof \PhpParser\Node\Expr\BinaryOp\BooleanOr) {
return null;
}
// to avoid repetitive flipped elseif above return when used along with ChangeAndIfReturnToEarlyReturnRector
// @see https://github.com/rectorphp/rector-src/pull/654
if ($node->cond instanceof \PhpParser\Node\Expr\BinaryOp\BooleanAnd && \count($node->elseifs) > 1) {
return null;
}
if ($node->elseifs !== []) {
$originalNode = clone $node;
$if = new \PhpParser\Node\Stmt\If_($node->cond);

View File

@ -16,11 +16,11 @@ final class VersionResolver
/**
* @var string
*/
public const PACKAGE_VERSION = '906bb39c8df09c9a7c554dd97a2fde070b076861';
public const PACKAGE_VERSION = '8e48e498234ac51af25b584f866ddd200803f02f';
/**
* @var string
*/
public const RELEASE_DATE = '2021-08-12 11:42:21';
public const RELEASE_DATE = '2021-08-12 13:01:47';
public static function resolvePackageVersion() : string
{
$process = new \RectorPrefix20210812\Symfony\Component\Process\Process(['git', 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__);

2
vendor/autoload.php vendored
View File

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

View File

@ -2,7 +2,7 @@
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit53cd74857977f8d0cc97c1232738cf7c
class ComposerAutoloaderInitd3fefe2aaa18e81a090620c6e55610a3
{
private static $loader;
@ -22,15 +22,15 @@ class ComposerAutoloaderInit53cd74857977f8d0cc97c1232738cf7c
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit53cd74857977f8d0cc97c1232738cf7c', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInitd3fefe2aaa18e81a090620c6e55610a3', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
spl_autoload_unregister(array('ComposerAutoloaderInit53cd74857977f8d0cc97c1232738cf7c', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInitd3fefe2aaa18e81a090620c6e55610a3', '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\ComposerStaticInit53cd74857977f8d0cc97c1232738cf7c::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInitd3fefe2aaa18e81a090620c6e55610a3::getInitializer($loader));
} else {
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
@ -42,19 +42,19 @@ class ComposerAutoloaderInit53cd74857977f8d0cc97c1232738cf7c
$loader->register(true);
if ($useStaticLoader) {
$includeFiles = Composer\Autoload\ComposerStaticInit53cd74857977f8d0cc97c1232738cf7c::$files;
$includeFiles = Composer\Autoload\ComposerStaticInitd3fefe2aaa18e81a090620c6e55610a3::$files;
} else {
$includeFiles = require __DIR__ . '/autoload_files.php';
}
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequire53cd74857977f8d0cc97c1232738cf7c($fileIdentifier, $file);
composerRequired3fefe2aaa18e81a090620c6e55610a3($fileIdentifier, $file);
}
return $loader;
}
}
function composerRequire53cd74857977f8d0cc97c1232738cf7c($fileIdentifier, $file)
function composerRequired3fefe2aaa18e81a090620c6e55610a3($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
require $file;

View File

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

View File

@ -899,22 +899,22 @@
},
{
"name": "phpstan\/phpstan-phpunit",
"version": "0.12.21",
"version_normalized": "0.12.21.0",
"version": "0.12.22",
"version_normalized": "0.12.22.0",
"source": {
"type": "git",
"url": "https:\/\/github.com\/phpstan\/phpstan-phpunit.git",
"reference": "6aaff1196c4f808769774b49a94a60e5fdf18de7"
"reference": "7c01ef93bf128b4ac8bdad38c54b2a4fd6b0b3cc"
},
"dist": {
"type": "zip",
"url": "https:\/\/api.github.com\/repos\/phpstan\/phpstan-phpunit\/zipball\/6aaff1196c4f808769774b49a94a60e5fdf18de7",
"reference": "6aaff1196c4f808769774b49a94a60e5fdf18de7",
"url": "https:\/\/api.github.com\/repos\/phpstan\/phpstan-phpunit\/zipball\/7c01ef93bf128b4ac8bdad38c54b2a4fd6b0b3cc",
"reference": "7c01ef93bf128b4ac8bdad38c54b2a4fd6b0b3cc",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0",
"phpstan\/phpstan": "^0.12.86"
"phpstan\/phpstan": "^0.12.92"
},
"conflict": {
"phpunit\/phpunit": "<7.0"
@ -924,7 +924,7 @@
"phpstan\/phpstan-strict-rules": "^0.12.6",
"phpunit\/phpunit": "^9.5"
},
"time": "2021-07-14T10:48:30+00:00",
"time": "2021-08-12T10:53:43+00:00",
"type": "phpstan-extension",
"extra": {
"branch-alias": {
@ -950,7 +950,7 @@
"description": "PHPUnit extensions and rules for PHPStan",
"support": {
"issues": "https:\/\/github.com\/phpstan\/phpstan-phpunit\/issues",
"source": "https:\/\/github.com\/phpstan\/phpstan-phpunit\/tree\/0.12.21"
"source": "https:\/\/github.com\/phpstan\/phpstan-phpunit\/tree\/0.12.22"
},
"install-path": "..\/phpstan\/phpstan-phpunit"
},

File diff suppressed because one or more lines are too long

View File

@ -7,7 +7,7 @@
],
"require": {
"php": "^7.1 || ^8.0",
"phpstan\/phpstan": "^0.12.86"
"phpstan\/phpstan": "^0.12.92"
},
"conflict": {
"phpunit\/phpunit": "<7.0"

View File

@ -173,6 +173,8 @@ class AssertTypeSpecifyingExtensionHelper
return new \PhpParser\Node\Expr\FuncCall(new \PhpParser\Node\Name($functionName), [$value]);
}, 'ArrayHasKey' => function (\PHPStan\Analyser\Scope $scope, \PhpParser\Node\Arg $key, \PhpParser\Node\Arg $array) : FuncCall {
return new \PhpParser\Node\Expr\FuncCall(new \PhpParser\Node\Name('array_key_exists'), [$key, $array]);
}, 'ObjectHasAttribute' => function (\PHPStan\Analyser\Scope $scope, \PhpParser\Node\Arg $property, \PhpParser\Node\Arg $object) : FuncCall {
return new \PhpParser\Node\Expr\FuncCall(new \PhpParser\Node\Name('property_exists'), [$object, $property]);
}];
}
return self::$resolvers;

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('RectorPrefix20210812\AutoloadIncluder');
}
if (!class_exists('ComposerAutoloaderInit53cd74857977f8d0cc97c1232738cf7c', false) && !interface_exists('ComposerAutoloaderInit53cd74857977f8d0cc97c1232738cf7c', false) && !trait_exists('ComposerAutoloaderInit53cd74857977f8d0cc97c1232738cf7c', false)) {
spl_autoload_call('RectorPrefix20210812\ComposerAutoloaderInit53cd74857977f8d0cc97c1232738cf7c');
if (!class_exists('ComposerAutoloaderInitd3fefe2aaa18e81a090620c6e55610a3', false) && !interface_exists('ComposerAutoloaderInitd3fefe2aaa18e81a090620c6e55610a3', false) && !trait_exists('ComposerAutoloaderInitd3fefe2aaa18e81a090620c6e55610a3', false)) {
spl_autoload_call('RectorPrefix20210812\ComposerAutoloaderInitd3fefe2aaa18e81a090620c6e55610a3');
}
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('RectorPrefix20210812\Helmich\TypoScriptParser\Parser\AST\Statement');
@ -3308,9 +3308,9 @@ if (!function_exists('print_node')) {
return \RectorPrefix20210812\print_node(...func_get_args());
}
}
if (!function_exists('composerRequire53cd74857977f8d0cc97c1232738cf7c')) {
function composerRequire53cd74857977f8d0cc97c1232738cf7c() {
return \RectorPrefix20210812\composerRequire53cd74857977f8d0cc97c1232738cf7c(...func_get_args());
if (!function_exists('composerRequired3fefe2aaa18e81a090620c6e55610a3')) {
function composerRequired3fefe2aaa18e81a090620c6e55610a3() {
return \RectorPrefix20210812\composerRequired3fefe2aaa18e81a090620c6e55610a3(...func_get_args());
}
}
if (!function_exists('parseArgs')) {