mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-02 09:20:52 +00:00
Updated Rector to commit 63ca8727cbf38fdbcc1a68c429ce3dc2340f268e
63ca8727cb
[DeadCode] Fix RemoveJustPropertyFetchRector to skip concat assigns (#3123)
This commit is contained in:
parent
7a4c4657bb
commit
d60996d358
|
@ -6,6 +6,7 @@ namespace Rector\DeadCode\Rector\StmtsAwareInterface;
|
|||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr\Assign;
|
||||
use PhpParser\Node\Expr\AssignOp\Concat;
|
||||
use PhpParser\Node\Expr\Closure;
|
||||
use PhpParser\Node\Expr\ClosureUse;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
|
@ -105,6 +106,9 @@ CODE_SAMPLE
|
|||
}
|
||||
// filter out variable usages that are part of nested property fetch, or change variable
|
||||
$variableUsages = $this->filterOutReferencedVariableUsages($variableUsages);
|
||||
if ($this->isOverridenWithConcatAssign($variableUsages)) {
|
||||
return null;
|
||||
}
|
||||
if (!$variableToPropertyAssign instanceof PropertyFetchToVariableAssign) {
|
||||
return null;
|
||||
}
|
||||
|
@ -205,4 +209,20 @@ CODE_SAMPLE
|
|||
$nodeObjectType = new ObjectType('PhpParser\\Node');
|
||||
return $nodeObjectType->isSuperTypeOf($propertyFetchCallerType)->yes();
|
||||
}
|
||||
/**
|
||||
* @param Variable[] $variables
|
||||
*/
|
||||
private function isOverridenWithConcatAssign(array $variables) : bool
|
||||
{
|
||||
foreach ($variables as $variable) {
|
||||
$parentNode = $variable->getAttribute(AttributeKey::PARENT_NODE);
|
||||
if (!$parentNode instanceof Concat) {
|
||||
continue;
|
||||
}
|
||||
if ($parentNode->var === $variable) {
|
||||
return \true;
|
||||
}
|
||||
}
|
||||
return \false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,12 +17,12 @@ final class VersionResolver
|
|||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '67ec259ce70190a02d29c697dfb2d325f781d8aa';
|
||||
public const PACKAGE_VERSION = '63ca8727cbf38fdbcc1a68c429ce3dc2340f268e';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2022-11-28 16:05:47';
|
||||
public const RELEASE_DATE = '2022-11-28 16:54:30';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
|
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 ComposerAutoloaderInit5f9183588b6db777ff4245abd84de731::getLoader();
|
||||
return ComposerAutoloaderInit83a37a0b2827f72d28f454f73250a859::getLoader();
|
||||
|
|
14
vendor/composer/autoload_real.php
vendored
14
vendor/composer/autoload_real.php
vendored
|
@ -2,7 +2,7 @@
|
|||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInit5f9183588b6db777ff4245abd84de731
|
||||
class ComposerAutoloaderInit83a37a0b2827f72d28f454f73250a859
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
|
@ -22,19 +22,19 @@ class ComposerAutoloaderInit5f9183588b6db777ff4245abd84de731
|
|||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit5f9183588b6db777ff4245abd84de731', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit83a37a0b2827f72d28f454f73250a859', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit5f9183588b6db777ff4245abd84de731', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit83a37a0b2827f72d28f454f73250a859', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit5f9183588b6db777ff4245abd84de731::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit83a37a0b2827f72d28f454f73250a859::getInitializer($loader));
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
$includeFiles = \Composer\Autoload\ComposerStaticInit5f9183588b6db777ff4245abd84de731::$files;
|
||||
$includeFiles = \Composer\Autoload\ComposerStaticInit83a37a0b2827f72d28f454f73250a859::$files;
|
||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||
composerRequire5f9183588b6db777ff4245abd84de731($fileIdentifier, $file);
|
||||
composerRequire83a37a0b2827f72d28f454f73250a859($fileIdentifier, $file);
|
||||
}
|
||||
|
||||
return $loader;
|
||||
|
@ -46,7 +46,7 @@ class ComposerAutoloaderInit5f9183588b6db777ff4245abd84de731
|
|||
* @param string $file
|
||||
* @return void
|
||||
*/
|
||||
function composerRequire5f9183588b6db777ff4245abd84de731($fileIdentifier, $file)
|
||||
function composerRequire83a37a0b2827f72d28f454f73250a859($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 ComposerStaticInit5f9183588b6db777ff4245abd84de731
|
||||
class ComposerStaticInit83a37a0b2827f72d28f454f73250a859
|
||||
{
|
||||
public static $files = array (
|
||||
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
||||
|
@ -3013,9 +3013,9 @@ class ComposerStaticInit5f9183588b6db777ff4245abd84de731
|
|||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit5f9183588b6db777ff4245abd84de731::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit5f9183588b6db777ff4245abd84de731::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit5f9183588b6db777ff4245abd84de731::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit83a37a0b2827f72d28f454f73250a859::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit83a37a0b2827f72d28f454f73250a859::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit83a37a0b2827f72d28f454f73250a859::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user