Updated Rector to commit a4ecfaff521019bdbf10be992772e956ec9ae3ba

a4ecfaff52 [DeadCode] Using SideEffectNodeDetector on RemoveUnusedVariableAssignRector (#681)
This commit is contained in:
Tomas Votruba 2021-08-14 22:36:26 +00:00
parent 9b371536e4
commit 3626e37580
6 changed files with 20 additions and 32 deletions

View File

@ -5,10 +5,8 @@ namespace Rector\Defluent\Rector\MethodCall;
use PhpParser\Node;
use PhpParser\Node\Arg;
use PhpParser\Node\Expr\Cast;
use PhpParser\Node\Expr\MethodCall;
use PhpParser\Node\Expr\New_;
use PhpParser\Node\Stmt\Return_;
use Rector\Core\Rector\AbstractRector;
use Rector\Defluent\Matcher\AssignAndRootExprAndNodesToAddMatcher;
use Rector\Defluent\NodeAnalyzer\FluentChainMethodCallNodeAnalyzer;
@ -18,7 +16,6 @@ use Rector\Defluent\NodeFactory\NonFluentChainMethodCallFactory;
use Rector\Defluent\NodeFactory\VariableFromNewFactory;
use Rector\Defluent\ValueObject\AssignAndRootExprAndNodesToAdd;
use Rector\Defluent\ValueObject\FluentCallsKind;
use Rector\NodeNestingScope\ParentFinder;
use Rector\NodeTypeResolver\Node\AttributeKey;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
@ -51,11 +48,7 @@ final class InArgFluentChainMethodCallToStandaloneMethodCallRector extends \Rect
* @var \Rector\Defluent\NodeFactory\NonFluentChainMethodCallFactory
*/
private $nonFluentChainMethodCallFactory;
/**
* @var \Rector\NodeNestingScope\ParentFinder
*/
private $parentFinder;
public function __construct(\Rector\Defluent\NodeAnalyzer\NewFluentChainMethodCallNodeAnalyzer $newFluentChainMethodCallNodeAnalyzer, \Rector\Defluent\NodeFactory\VariableFromNewFactory $variableFromNewFactory, \Rector\Defluent\NodeFactory\FluentMethodCallAsArgFactory $fluentMethodCallAsArgFactory, \Rector\Defluent\Matcher\AssignAndRootExprAndNodesToAddMatcher $assignAndRootExprAndNodesToAddMatcher, \Rector\Defluent\NodeAnalyzer\FluentChainMethodCallNodeAnalyzer $fluentChainMethodCallNodeAnalyzer, \Rector\Defluent\NodeFactory\NonFluentChainMethodCallFactory $nonFluentChainMethodCallFactory, \Rector\NodeNestingScope\ParentFinder $parentFinder)
public function __construct(\Rector\Defluent\NodeAnalyzer\NewFluentChainMethodCallNodeAnalyzer $newFluentChainMethodCallNodeAnalyzer, \Rector\Defluent\NodeFactory\VariableFromNewFactory $variableFromNewFactory, \Rector\Defluent\NodeFactory\FluentMethodCallAsArgFactory $fluentMethodCallAsArgFactory, \Rector\Defluent\Matcher\AssignAndRootExprAndNodesToAddMatcher $assignAndRootExprAndNodesToAddMatcher, \Rector\Defluent\NodeAnalyzer\FluentChainMethodCallNodeAnalyzer $fluentChainMethodCallNodeAnalyzer, \Rector\Defluent\NodeFactory\NonFluentChainMethodCallFactory $nonFluentChainMethodCallFactory)
{
$this->newFluentChainMethodCallNodeAnalyzer = $newFluentChainMethodCallNodeAnalyzer;
$this->variableFromNewFactory = $variableFromNewFactory;
@ -63,7 +56,6 @@ final class InArgFluentChainMethodCallToStandaloneMethodCallRector extends \Rect
$this->assignAndRootExprAndNodesToAddMatcher = $assignAndRootExprAndNodesToAddMatcher;
$this->fluentChainMethodCallNodeAnalyzer = $fluentChainMethodCallNodeAnalyzer;
$this->nonFluentChainMethodCallFactory = $nonFluentChainMethodCallFactory;
$this->parentFinder = $parentFinder;
}
public function getRuleDefinition() : \Symplify\RuleDocGenerator\ValueObject\RuleDefinition
{
@ -121,10 +113,6 @@ CODE_SAMPLE
if (!$this->fluentChainMethodCallNodeAnalyzer->isLastChainMethodCall($node)) {
return null;
}
$isInReturnOrCast = (bool) $this->parentFinder->findByTypes($node, [\PhpParser\Node\Stmt\Return_::class, \PhpParser\Node\Expr\Cast::class]);
if ($isInReturnOrCast) {
return null;
}
// create instances from (new ...)->call, re-use from
if ($node->var instanceof \PhpParser\Node\Expr\New_) {
$this->refactorNew($node, $node->var);

View File

@ -16,11 +16,11 @@ final class VersionResolver
/**
* @var string
*/
public const PACKAGE_VERSION = '9dd6d63e140f1c8e1561b113aac12810f412628a';
public const PACKAGE_VERSION = 'a4ecfaff521019bdbf10be992772e956ec9ae3ba';
/**
* @var string
*/
public const RELEASE_DATE = '2021-08-15 00:24:21';
public const RELEASE_DATE = '2021-08-15 00:23:07';
public static function resolvePackageVersion() : string
{
$process = new \RectorPrefix20210814\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 ComposerAutoloaderInitc77f425bfacdb489bc77c103848b15e7::getLoader();
return ComposerAutoloaderInit51d1db393acf7094a5b94ac254b2f659::getLoader();

View File

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

View File

@ -4,7 +4,7 @@
namespace Composer\Autoload;
class ComposerStaticInitc77f425bfacdb489bc77c103848b15e7
class ComposerStaticInit51d1db393acf7094a5b94ac254b2f659
{
public static $files = array (
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
@ -3850,9 +3850,9 @@ class ComposerStaticInitc77f425bfacdb489bc77c103848b15e7
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInitc77f425bfacdb489bc77c103848b15e7::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInitc77f425bfacdb489bc77c103848b15e7::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInitc77f425bfacdb489bc77c103848b15e7::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit51d1db393acf7094a5b94ac254b2f659::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit51d1db393acf7094a5b94ac254b2f659::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit51d1db393acf7094a5b94ac254b2f659::$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('RectorPrefix20210814\AutoloadIncluder');
}
if (!class_exists('ComposerAutoloaderInitc77f425bfacdb489bc77c103848b15e7', false) && !interface_exists('ComposerAutoloaderInitc77f425bfacdb489bc77c103848b15e7', false) && !trait_exists('ComposerAutoloaderInitc77f425bfacdb489bc77c103848b15e7', false)) {
spl_autoload_call('RectorPrefix20210814\ComposerAutoloaderInitc77f425bfacdb489bc77c103848b15e7');
if (!class_exists('ComposerAutoloaderInit51d1db393acf7094a5b94ac254b2f659', false) && !interface_exists('ComposerAutoloaderInit51d1db393acf7094a5b94ac254b2f659', false) && !trait_exists('ComposerAutoloaderInit51d1db393acf7094a5b94ac254b2f659', false)) {
spl_autoload_call('RectorPrefix20210814\ComposerAutoloaderInit51d1db393acf7094a5b94ac254b2f659');
}
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('RectorPrefix20210814\Helmich\TypoScriptParser\Parser\AST\Statement');
@ -3308,9 +3308,9 @@ if (!function_exists('print_node')) {
return \RectorPrefix20210814\print_node(...func_get_args());
}
}
if (!function_exists('composerRequirec77f425bfacdb489bc77c103848b15e7')) {
function composerRequirec77f425bfacdb489bc77c103848b15e7() {
return \RectorPrefix20210814\composerRequirec77f425bfacdb489bc77c103848b15e7(...func_get_args());
if (!function_exists('composerRequire51d1db393acf7094a5b94ac254b2f659')) {
function composerRequire51d1db393acf7094a5b94ac254b2f659() {
return \RectorPrefix20210814\composerRequire51d1db393acf7094a5b94ac254b2f659(...func_get_args());
}
}
if (!function_exists('parseArgs')) {