mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-15 15:42:22 +00:00
Updated Rector to commit b45066c505a7bd3569819cee71706ebf0f763b6e
b45066c505
[dx] remove direct assigns (#2617)
This commit is contained in:
parent
189f399cf2
commit
fbcfb0e30f
|
@ -252,8 +252,7 @@ CODE_SAMPLE
|
|||
}
|
||||
$param = new Param(new Variable($argumentName), BuilderHelpers::normalizeValue($defaultValue));
|
||||
if ($type !== null) {
|
||||
$typeNode = $this->staticTypeMapper->mapPHPStanTypeToPhpParserNode($type, TypeKind::PARAM);
|
||||
$param->type = $typeNode;
|
||||
$param->type = $this->staticTypeMapper->mapPHPStanTypeToPhpParserNode($type, TypeKind::PARAM);
|
||||
}
|
||||
$classMethod->params[$position] = $param;
|
||||
$this->haveArgumentsChanged = \true;
|
||||
|
|
|
@ -112,8 +112,7 @@ final class LocalPropertyAnalyzer
|
|||
if (!$parentFunctionLike instanceof ClassMethod) {
|
||||
return null;
|
||||
}
|
||||
$propertyFetchType = $this->resolvePropertyFetchType($node);
|
||||
$fetchedLocalPropertyNameToTypes[$propertyName][] = $propertyFetchType;
|
||||
$fetchedLocalPropertyNameToTypes[$propertyName][] = $this->resolvePropertyFetchType($node);
|
||||
return null;
|
||||
});
|
||||
return $this->normalizeToSingleType($fetchedLocalPropertyNameToTypes);
|
||||
|
|
|
@ -103,8 +103,7 @@ CODE_SAMPLE
|
|||
if ($expectedArgOrParamOrder === null) {
|
||||
return null;
|
||||
}
|
||||
$newParams = $this->argumentSorter->sortArgsByExpectedParamOrder($classMethod->params, $expectedArgOrParamOrder);
|
||||
$classMethod->params = $newParams;
|
||||
$classMethod->params = $this->argumentSorter->sortArgsByExpectedParamOrder($classMethod->params, $expectedArgOrParamOrder);
|
||||
return $classMethod;
|
||||
}
|
||||
private function refactorNew(New_ $new) : ?New_
|
||||
|
|
|
@ -144,8 +144,7 @@ final class ShortNameResolver
|
|||
if (\strpos($originalName->toString(), '\\') !== \false) {
|
||||
return null;
|
||||
}
|
||||
$fullyQualifiedName = $this->nodeNameResolver->getName($node);
|
||||
$shortNamesToFullyQualifiedNames[$originalName->toString()] = $fullyQualifiedName;
|
||||
$shortNamesToFullyQualifiedNames[$originalName->toString()] = $this->nodeNameResolver->getName($node);
|
||||
return null;
|
||||
});
|
||||
$docBlockShortNamesToFullyQualifiedNames = $this->resolveFromStmtsDocBlocks($stmts);
|
||||
|
|
|
@ -157,8 +157,7 @@ CODE_SAMPLE
|
|||
if ($propertyType instanceof NullableType) {
|
||||
$propertyType = $propertyType->type;
|
||||
}
|
||||
$param = new Param(new Variable($propertyName), null, $propertyType, \false, \false, [], $property->flags);
|
||||
$params[] = $param;
|
||||
$params[] = new Param(new Variable($propertyName), null, $propertyType, \false, \false, [], $property->flags);
|
||||
$propertyPhpDocInfo = $requiredPropertyWithPhpDocInfo->getPhpDocInfo();
|
||||
// remove required
|
||||
$this->phpDocTagRemover->removeByName($propertyPhpDocInfo, 'Doctrine\\Common\\Annotations\\Annotation\\Required');
|
||||
|
|
|
@ -76,8 +76,7 @@ CODE_SAMPLE
|
|||
if ($livingCode === [$node->expr]) {
|
||||
return null;
|
||||
}
|
||||
$firstExpr = \array_shift($livingCode);
|
||||
$node->expr = $firstExpr;
|
||||
$node->expr = \array_shift($livingCode);
|
||||
$newNodes = [];
|
||||
foreach ($livingCode as $singleLivingCode) {
|
||||
$newNodes[] = new Expression($singleLivingCode);
|
||||
|
|
|
@ -129,8 +129,7 @@ CODE_SAMPLE
|
|||
$afterStmts = [];
|
||||
if (!$nextStmt instanceof Return_) {
|
||||
$afterStmts[] = $stmt->stmts[0];
|
||||
$newStmts = \array_merge($newStmts, $this->processReplaceIfs($stmt, $booleanAndConditions, new Return_(), $afterStmts));
|
||||
$node->stmts = $newStmts;
|
||||
$node->stmts = \array_merge($newStmts, $this->processReplaceIfs($stmt, $booleanAndConditions, new Return_(), $afterStmts));
|
||||
return $node;
|
||||
}
|
||||
// remove next node
|
||||
|
@ -141,9 +140,8 @@ CODE_SAMPLE
|
|||
$afterStmts[] = new Return_();
|
||||
}
|
||||
$changedStmts = $this->processReplaceIfs($stmt, $booleanAndConditions, $ifNextReturnClone, $afterStmts);
|
||||
$changedStmts = \array_merge($newStmts, $changedStmts);
|
||||
// update stmts
|
||||
$node->stmts = $changedStmts;
|
||||
$node->stmts = \array_merge($newStmts, $changedStmts);
|
||||
return $node;
|
||||
}
|
||||
return null;
|
||||
|
|
|
@ -51,8 +51,7 @@ final class ClosureNestedUsesDecorator
|
|||
$parentOfParent = $this->betterNodeFinder->findParentType($parentOfParent, Closure::class);
|
||||
}
|
||||
$uses = \array_merge($parent->uses, $uses);
|
||||
$uses = $this->cleanClosureUses($uses);
|
||||
$parent->uses = $uses;
|
||||
$parent->uses = $this->cleanClosureUses($uses);
|
||||
$parent = $this->betterNodeFinder->findParentType($parent, Closure::class);
|
||||
}
|
||||
return $anonymousFunctionNode;
|
||||
|
|
|
@ -145,8 +145,7 @@ CODE_SAMPLE
|
|||
$paramTagValueNode->setAttribute(PhpDocAttributeKey::ORIG_NODE, null);
|
||||
}
|
||||
// property name has higher priority
|
||||
$propertyName = $this->getName($property);
|
||||
$param->var->name = $propertyName;
|
||||
$param->var->name = $this->getName($property);
|
||||
$param->flags = $property->flags;
|
||||
// Copy over attributes of the "old" property
|
||||
$param->attrGroups = $property->attrGroups;
|
||||
|
|
|
@ -70,8 +70,7 @@ final class PropertyFetchByMethodAnalyzer
|
|||
if (!$this->isPropertyChanging($classMethod, $propertyName)) {
|
||||
continue;
|
||||
}
|
||||
$classMethodName = $this->nodeNameResolver->getName($classMethod);
|
||||
$propertyUsageByMethods[$propertyName][] = $classMethodName;
|
||||
$propertyUsageByMethods[$propertyName][] = $this->nodeNameResolver->getName($classMethod);
|
||||
}
|
||||
}
|
||||
return $propertyUsageByMethods;
|
||||
|
|
|
@ -127,8 +127,7 @@ CODE_SAMPLE
|
|||
}
|
||||
private function addAllowDynamicPropertiesAttribute(Class_ $class) : Class_
|
||||
{
|
||||
$attributeGroup = $this->phpAttributeGroupFactory->createFromClass(self::ATTRIBUTE);
|
||||
$class->attrGroups[] = $attributeGroup;
|
||||
$class->attrGroups[] = $this->phpAttributeGroupFactory->createFromClass(self::ATTRIBUTE);
|
||||
return $class;
|
||||
}
|
||||
private function shouldSkip(Class_ $class) : bool
|
||||
|
|
|
@ -48,8 +48,7 @@ final class CallTypesResolver
|
|||
if (!$arg instanceof Arg) {
|
||||
continue;
|
||||
}
|
||||
$argValueType = $this->resolveStrictArgValueType($arg);
|
||||
$staticTypesByArgumentPosition[$position][] = $argValueType;
|
||||
$staticTypesByArgumentPosition[$position][] = $this->resolveStrictArgValueType($arg);
|
||||
}
|
||||
}
|
||||
// unite to single type
|
||||
|
@ -78,8 +77,7 @@ final class CallTypesResolver
|
|||
foreach ($staticTypesByArgumentPosition as $position => $staticTypes) {
|
||||
$unionedType = $this->typeFactory->createMixedPassedOrUnionType($staticTypes);
|
||||
// narrow parents to most child type
|
||||
$unionedType = $this->narrowParentObjectTreeToSingleObjectChildType($unionedType);
|
||||
$staticTypeByArgumentPosition[$position] = $unionedType;
|
||||
$staticTypeByArgumentPosition[$position] = $this->narrowParentObjectTreeToSingleObjectChildType($unionedType);
|
||||
}
|
||||
if (\count($staticTypeByArgumentPosition) !== 1) {
|
||||
return $staticTypeByArgumentPosition;
|
||||
|
|
|
@ -128,8 +128,7 @@ CODE_SAMPLE
|
|||
if ($this->shouldSkipType($classMethod, $newType)) {
|
||||
return;
|
||||
}
|
||||
$returnTypeNode = $this->staticTypeMapper->mapPHPStanTypeToPhpParserNode($newType, TypeKind::RETURN);
|
||||
$classMethod->returnType = $returnTypeNode;
|
||||
$classMethod->returnType = $this->staticTypeMapper->mapPHPStanTypeToPhpParserNode($newType, TypeKind::RETURN);
|
||||
$this->hasChanged = \true;
|
||||
}
|
||||
private function shouldSkipType(ClassMethod $classMethod, Type $newType) : bool
|
||||
|
|
|
@ -110,8 +110,7 @@ CODE_SAMPLE
|
|||
$newTypes[] = $this->createObjectTypeFromNew($new);
|
||||
}
|
||||
$returnType = $this->typeFactory->createMixedPassedOrUnionType($newTypes);
|
||||
$returnTypeNode = $this->staticTypeMapper->mapPHPStanTypeToPhpParserNode($returnType, TypeKind::RETURN);
|
||||
$node->returnType = $returnTypeNode;
|
||||
$node->returnType = $this->staticTypeMapper->mapPHPStanTypeToPhpParserNode($returnType, TypeKind::RETURN);
|
||||
return $node;
|
||||
}
|
||||
public function provideMinPhpVersion() : int
|
||||
|
|
|
@ -136,8 +136,7 @@ CODE_SAMPLE
|
|||
if ($this->phpVersionProvider->isAtLeastPhpVersion(PhpVersionFeature::UNION_TYPES)) {
|
||||
/** @var PhpParserUnionType[] $returnedStrictTypes */
|
||||
$unwrappedTypes = $this->typeNodeUnwrapper->unwrapNullableUnionTypes($returnedStrictTypes);
|
||||
$returnType = new PhpParserUnionType($unwrappedTypes);
|
||||
$node->returnType = $returnType;
|
||||
$node->returnType = new PhpParserUnionType($unwrappedTypes);
|
||||
return $node;
|
||||
}
|
||||
return null;
|
||||
|
|
|
@ -17,12 +17,12 @@ final class VersionResolver
|
|||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '0660b21ecec553393226003c16432a626e20f8ec';
|
||||
public const PACKAGE_VERSION = 'b45066c505a7bd3569819cee71706ebf0f763b6e';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2022-07-03 13:35:02';
|
||||
public const RELEASE_DATE = '2022-07-03 14:09:32';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
|
2
vendor/autoload.php
vendored
2
vendor/autoload.php
vendored
|
@ -9,4 +9,4 @@ if (PHP_VERSION_ID < 50600) {
|
|||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInit962f084182d33365088c47167dbd9d4a::getLoader();
|
||||
return ComposerAutoloaderInit5efc915aaba0ea1bf59e274752d51ea9::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 ComposerAutoloaderInit962f084182d33365088c47167dbd9d4a
|
||||
class ComposerAutoloaderInit5efc915aaba0ea1bf59e274752d51ea9
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
|
@ -22,19 +22,19 @@ class ComposerAutoloaderInit962f084182d33365088c47167dbd9d4a
|
|||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit962f084182d33365088c47167dbd9d4a', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit5efc915aaba0ea1bf59e274752d51ea9', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit962f084182d33365088c47167dbd9d4a', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit5efc915aaba0ea1bf59e274752d51ea9', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit962f084182d33365088c47167dbd9d4a::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit5efc915aaba0ea1bf59e274752d51ea9::getInitializer($loader));
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
$includeFiles = \Composer\Autoload\ComposerStaticInit962f084182d33365088c47167dbd9d4a::$files;
|
||||
$includeFiles = \Composer\Autoload\ComposerStaticInit5efc915aaba0ea1bf59e274752d51ea9::$files;
|
||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||
composerRequire962f084182d33365088c47167dbd9d4a($fileIdentifier, $file);
|
||||
composerRequire5efc915aaba0ea1bf59e274752d51ea9($fileIdentifier, $file);
|
||||
}
|
||||
|
||||
return $loader;
|
||||
|
@ -46,7 +46,7 @@ class ComposerAutoloaderInit962f084182d33365088c47167dbd9d4a
|
|||
* @param string $file
|
||||
* @return void
|
||||
*/
|
||||
function composerRequire962f084182d33365088c47167dbd9d4a($fileIdentifier, $file)
|
||||
function composerRequire5efc915aaba0ea1bf59e274752d51ea9($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 ComposerStaticInit962f084182d33365088c47167dbd9d4a
|
||||
class ComposerStaticInit5efc915aaba0ea1bf59e274752d51ea9
|
||||
{
|
||||
public static $files = array (
|
||||
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
|
||||
|
@ -3415,9 +3415,9 @@ class ComposerStaticInit962f084182d33365088c47167dbd9d4a
|
|||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit962f084182d33365088c47167dbd9d4a::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit962f084182d33365088c47167dbd9d4a::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit962f084182d33365088c47167dbd9d4a::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit5efc915aaba0ea1bf59e274752d51ea9::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit5efc915aaba0ea1bf59e274752d51ea9::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit5efc915aaba0ea1bf59e274752d51ea9::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
|
10
vendor/composer/installed.json
vendored
10
vendor/composer/installed.json
vendored
|
@ -2202,12 +2202,12 @@
|
|||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/rectorphp\/rector-nette.git",
|
||||
"reference": "45ba400e07e360010f0702260ac32e602ec05535"
|
||||
"reference": "9489bdb38f8bea75bf7071f6313900363c5ae332"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-nette\/zipball\/45ba400e07e360010f0702260ac32e602ec05535",
|
||||
"reference": "45ba400e07e360010f0702260ac32e602ec05535",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-nette\/zipball\/9489bdb38f8bea75bf7071f6313900363c5ae332",
|
||||
"reference": "9489bdb38f8bea75bf7071f6313900363c5ae332",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2239,7 +2239,7 @@
|
|||
"symplify\/rule-doc-generator": "^11.0",
|
||||
"symplify\/vendor-patches": "^11.0"
|
||||
},
|
||||
"time": "2022-07-01T09:37:34+00:00",
|
||||
"time": "2022-07-03T11:55:16+00:00",
|
||||
"default-branch": true,
|
||||
"type": "rector-extension",
|
||||
"extra": {
|
||||
|
@ -2269,7 +2269,7 @@
|
|||
"description": "Rector upgrades rules for Nette Framework",
|
||||
"support": {
|
||||
"issues": "https:\/\/github.com\/rectorphp\/rector-nette\/issues",
|
||||
"source": "https:\/\/github.com\/rectorphp\/rector-nette\/tree\/main"
|
||||
"source": "https:\/\/github.com\/rectorphp\/rector-nette\/tree\/0.13.1"
|
||||
},
|
||||
"install-path": "..\/rector\/rector-nette"
|
||||
},
|
||||
|
|
2
vendor/composer/installed.php
vendored
2
vendor/composer/installed.php
vendored
File diff suppressed because one or more lines are too long
|
@ -9,7 +9,7 @@ namespace Rector\RectorInstaller;
|
|||
*/
|
||||
final class GeneratedConfig
|
||||
{
|
||||
public const EXTENSIONS = array('rector/rector-cakephp' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-cakephp', 'relative_install_path' => '../../rector-cakephp', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 86ab8c3'), 'rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main b177492'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main c857264'), 'rector/rector-generator' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-generator', 'relative_install_path' => '../../rector-generator', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 644d45b'), 'rector/rector-laravel' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-laravel', 'relative_install_path' => '../../rector-laravel', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 7d3c734'), 'rector/rector-nette' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-nette', 'relative_install_path' => '../../rector-nette', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 45ba400'), 'rector/rector-phpoffice' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpoffice', 'relative_install_path' => '../../rector-phpoffice', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main d826618'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 97b5397'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main d4e61a1'));
|
||||
public const EXTENSIONS = array('rector/rector-cakephp' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-cakephp', 'relative_install_path' => '../../rector-cakephp', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 86ab8c3'), 'rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main b177492'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main c857264'), 'rector/rector-generator' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-generator', 'relative_install_path' => '../../rector-generator', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 644d45b'), 'rector/rector-laravel' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-laravel', 'relative_install_path' => '../../rector-laravel', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 7d3c734'), 'rector/rector-nette' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-nette', 'relative_install_path' => '../../rector-nette', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 9489bdb'), 'rector/rector-phpoffice' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpoffice', 'relative_install_path' => '../../rector-phpoffice', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main d826618'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 97b5397'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main d4e61a1'));
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -133,7 +133,7 @@ CODE_SAMPLE
|
|||
if (!$this->staticCallAnalyzer->isParentCallNamed($staticCall, MethodName::CONSTRUCT)) {
|
||||
return null;
|
||||
}
|
||||
foreach ($staticCall->args as $staticCallArg) {
|
||||
foreach ($staticCall->args as $position => $staticCallArg) {
|
||||
if (!$staticCallArg->value instanceof Variable) {
|
||||
continue;
|
||||
}
|
||||
|
@ -142,9 +142,9 @@ CODE_SAMPLE
|
|||
if (!$this->isNames($variable, [self::NAME, self::PARENT])) {
|
||||
continue;
|
||||
}
|
||||
$this->removeNode($staticCallArg);
|
||||
unset($staticCall->args[$position]);
|
||||
}
|
||||
if ($this->shouldRemoveEmptyCall($staticCall)) {
|
||||
if ($staticCall->args === []) {
|
||||
$this->removeNode($staticCall);
|
||||
return null;
|
||||
}
|
||||
|
@ -171,7 +171,7 @@ CODE_SAMPLE
|
|||
if (!\in_array($parameterName, [self::PARENT, self::NAME], \true)) {
|
||||
continue;
|
||||
}
|
||||
$this->removeNode($arg);
|
||||
unset($new->args[$position]);
|
||||
}
|
||||
}
|
||||
private function isInsideNetteComponentClass(Node $node) : bool
|
||||
|
@ -201,14 +201,4 @@ CODE_SAMPLE
|
|||
}
|
||||
}
|
||||
}
|
||||
private function shouldRemoveEmptyCall(StaticCall $staticCall) : bool
|
||||
{
|
||||
foreach ($staticCall->args as $arg) {
|
||||
if ($this->nodesToRemoveCollector->isNodeRemoved($arg)) {
|
||||
continue;
|
||||
}
|
||||
return \false;
|
||||
}
|
||||
return \true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user