mirror of
https://github.com/rectorphp/rector.git
synced 2024-05-31 08:20:53 +00:00
Updated Rector to commit aedfc65a48
aedfc65a48
[DeadCode] Remove RemoveUnusedAssignVariableRector in favor of RemoveUnusedVariableAssignRector (#1988)
This commit is contained in:
parent
627cd57ffc
commit
22e128cb20
|
@ -1,4 +1,4 @@
|
|||
# 507 Rules Overview
|
||||
# 506 Rules Overview
|
||||
|
||||
<br>
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
|||
|
||||
- [Composer](#composer) (6)
|
||||
|
||||
- [DeadCode](#deadcode) (50)
|
||||
- [DeadCode](#deadcode) (49)
|
||||
|
||||
- [DependencyInjection](#dependencyinjection) (2)
|
||||
|
||||
|
@ -3354,31 +3354,6 @@ Remove unreachable statements
|
|||
|
||||
<br>
|
||||
|
||||
### RemoveUnusedAssignVariableRector
|
||||
|
||||
Remove assigned unused variable
|
||||
|
||||
- class: [`Rector\DeadCode\Rector\Assign\RemoveUnusedAssignVariableRector`](../rules/DeadCode/Rector/Assign/RemoveUnusedAssignVariableRector.php)
|
||||
|
||||
```diff
|
||||
class SomeClass
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
- $value = $this->process();
|
||||
+ $this->process();
|
||||
}
|
||||
|
||||
public function process()
|
||||
{
|
||||
// something going on
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
### RemoveUnusedConstructorParamRector
|
||||
|
||||
Remove unused parameter in constructor
|
||||
|
|
|
@ -1,88 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\DeadCode\NodeFinder;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr\Assign;
|
||||
use PhpParser\Node\Expr\Variable;
|
||||
use PhpParser\NodeTraverser;
|
||||
use Rector\Core\PhpParser\Comparing\NodeComparator;
|
||||
use Rector\Core\PhpParser\Node\BetterNodeFinder;
|
||||
use Rector\NodeNameResolver\NodeNameResolver;
|
||||
use Rector\NodeNestingScope\ParentScopeFinder;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
use RectorPrefix20220401\Symplify\Astral\NodeTraverser\SimpleCallableNodeTraverser;
|
||||
final class NextVariableUsageNodeFinder
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\PhpParser\Node\BetterNodeFinder
|
||||
*/
|
||||
private $betterNodeFinder;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Symplify\Astral\NodeTraverser\SimpleCallableNodeTraverser
|
||||
*/
|
||||
private $simpleCallableNodeTraverser;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\NodeNameResolver\NodeNameResolver
|
||||
*/
|
||||
private $nodeNameResolver;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\NodeNestingScope\ParentScopeFinder
|
||||
*/
|
||||
private $parentScopeFinder;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\PhpParser\Comparing\NodeComparator
|
||||
*/
|
||||
private $nodeComparator;
|
||||
public function __construct(\Rector\Core\PhpParser\Node\BetterNodeFinder $betterNodeFinder, \RectorPrefix20220401\Symplify\Astral\NodeTraverser\SimpleCallableNodeTraverser $simpleCallableNodeTraverser, \Rector\NodeNameResolver\NodeNameResolver $nodeNameResolver, \Rector\NodeNestingScope\ParentScopeFinder $parentScopeFinder, \Rector\Core\PhpParser\Comparing\NodeComparator $nodeComparator)
|
||||
{
|
||||
$this->betterNodeFinder = $betterNodeFinder;
|
||||
$this->simpleCallableNodeTraverser = $simpleCallableNodeTraverser;
|
||||
$this->nodeNameResolver = $nodeNameResolver;
|
||||
$this->parentScopeFinder = $parentScopeFinder;
|
||||
$this->nodeComparator = $nodeComparator;
|
||||
}
|
||||
public function find(\PhpParser\Node\Expr\Assign $assign) : ?\PhpParser\Node
|
||||
{
|
||||
$scopeNode = $this->parentScopeFinder->find($assign);
|
||||
if (!$scopeNode instanceof \PhpParser\Node) {
|
||||
return null;
|
||||
}
|
||||
/** @var Variable $expr */
|
||||
$expr = $assign->var;
|
||||
$this->simpleCallableNodeTraverser->traverseNodesWithCallable((array) $scopeNode->stmts, function (\PhpParser\Node $currentNode) use($expr, &$nextUsageOfVariable) : ?int {
|
||||
// used above the assign
|
||||
if ($currentNode->getStartTokenPos() < $expr->getStartTokenPos()) {
|
||||
return null;
|
||||
}
|
||||
// skip self
|
||||
if ($this->nodeComparator->areSameNode($currentNode, $expr)) {
|
||||
return null;
|
||||
}
|
||||
if (!$this->nodeComparator->areNodesEqual($currentNode, $expr)) {
|
||||
return null;
|
||||
}
|
||||
$currentNodeParent = $currentNode->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::PARENT_NODE);
|
||||
if ($currentNodeParent instanceof \PhpParser\Node\Expr\Assign && !$this->hasInParentExpression($currentNodeParent, $expr)) {
|
||||
return \PhpParser\NodeTraverser::STOP_TRAVERSAL;
|
||||
}
|
||||
$nextUsageOfVariable = $currentNode;
|
||||
return \PhpParser\NodeTraverser::STOP_TRAVERSAL;
|
||||
});
|
||||
return $nextUsageOfVariable;
|
||||
}
|
||||
private function hasInParentExpression(\PhpParser\Node\Expr\Assign $assign, \PhpParser\Node\Expr\Variable $variable) : bool
|
||||
{
|
||||
$name = $this->nodeNameResolver->getName($variable);
|
||||
if ($name === null) {
|
||||
return \false;
|
||||
}
|
||||
return $this->betterNodeFinder->hasVariableOfName($assign->expr, $name);
|
||||
}
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\DeadCode\NodeFinder;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr\Assign;
|
||||
use Rector\Core\PhpParser\Comparing\NodeComparator;
|
||||
use Rector\Core\PhpParser\Node\BetterNodeFinder;
|
||||
use Rector\NodeNameResolver\NodeNameResolver;
|
||||
final class PreviousVariableAssignNodeFinder
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\PhpParser\Node\BetterNodeFinder
|
||||
*/
|
||||
private $betterNodeFinder;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\NodeNameResolver\NodeNameResolver
|
||||
*/
|
||||
private $nodeNameResolver;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Core\PhpParser\Comparing\NodeComparator
|
||||
*/
|
||||
private $nodeComparator;
|
||||
public function __construct(\Rector\Core\PhpParser\Node\BetterNodeFinder $betterNodeFinder, \Rector\NodeNameResolver\NodeNameResolver $nodeNameResolver, \Rector\Core\PhpParser\Comparing\NodeComparator $nodeComparator)
|
||||
{
|
||||
$this->betterNodeFinder = $betterNodeFinder;
|
||||
$this->nodeNameResolver = $nodeNameResolver;
|
||||
$this->nodeComparator = $nodeComparator;
|
||||
}
|
||||
public function find(\PhpParser\Node\Expr\Assign $assign) : ?\PhpParser\Node
|
||||
{
|
||||
$currentAssign = $assign;
|
||||
$variableName = $this->nodeNameResolver->getName($assign->var);
|
||||
if ($variableName === null) {
|
||||
return null;
|
||||
}
|
||||
return $this->betterNodeFinder->findFirstPrevious($assign, function (\PhpParser\Node $node) use($variableName, $currentAssign) : bool {
|
||||
if (!$node instanceof \PhpParser\Node\Expr\Assign) {
|
||||
return \false;
|
||||
}
|
||||
// skip self
|
||||
if ($this->nodeComparator->areSameNode($node, $currentAssign)) {
|
||||
return \false;
|
||||
}
|
||||
return $this->nodeNameResolver->isName($node->var, $variableName);
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,176 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\DeadCode\Rector\Assign;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Expr\Assign;
|
||||
use PhpParser\Node\Expr\Variable;
|
||||
use PhpParser\Node\Stmt\Else_;
|
||||
use PhpParser\Node\Stmt\If_;
|
||||
use PHPStan\Analyser\Scope;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\DeadCode\NodeAnalyzer\ExprUsedInNextNodeAnalyzer;
|
||||
use Rector\DeadCode\NodeFinder\NextVariableUsageNodeFinder;
|
||||
use Rector\DeadCode\NodeFinder\PreviousVariableAssignNodeFinder;
|
||||
use Rector\DeadCode\SideEffect\SideEffectNodeDetector;
|
||||
use Rector\NodeNestingScope\ScopeNestingComparator;
|
||||
use Rector\NodeTypeResolver\Node\AttributeKey;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
/**
|
||||
* @see \Rector\Tests\DeadCode\Rector\Assign\RemoveUnusedAssignVariableRector\RemoveUnusedAssignVariableRectorTest
|
||||
*/
|
||||
final class RemoveUnusedAssignVariableRector extends \Rector\Core\Rector\AbstractRector
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\DeadCode\NodeFinder\NextVariableUsageNodeFinder
|
||||
*/
|
||||
private $nextVariableUsageNodeFinder;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\DeadCode\NodeFinder\PreviousVariableAssignNodeFinder
|
||||
*/
|
||||
private $previousVariableAssignNodeFinder;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\NodeNestingScope\ScopeNestingComparator
|
||||
*/
|
||||
private $scopeNestingComparator;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\DeadCode\SideEffect\SideEffectNodeDetector
|
||||
*/
|
||||
private $sideEffectNodeDetector;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\DeadCode\NodeAnalyzer\ExprUsedInNextNodeAnalyzer
|
||||
*/
|
||||
private $exprUsedInNextNodeAnalyzer;
|
||||
public function __construct(\Rector\DeadCode\NodeFinder\NextVariableUsageNodeFinder $nextVariableUsageNodeFinder, \Rector\DeadCode\NodeFinder\PreviousVariableAssignNodeFinder $previousVariableAssignNodeFinder, \Rector\NodeNestingScope\ScopeNestingComparator $scopeNestingComparator, \Rector\DeadCode\SideEffect\SideEffectNodeDetector $sideEffectNodeDetector, \Rector\DeadCode\NodeAnalyzer\ExprUsedInNextNodeAnalyzer $exprUsedInNextNodeAnalyzer)
|
||||
{
|
||||
$this->nextVariableUsageNodeFinder = $nextVariableUsageNodeFinder;
|
||||
$this->previousVariableAssignNodeFinder = $previousVariableAssignNodeFinder;
|
||||
$this->scopeNestingComparator = $scopeNestingComparator;
|
||||
$this->sideEffectNodeDetector = $sideEffectNodeDetector;
|
||||
$this->exprUsedInNextNodeAnalyzer = $exprUsedInNextNodeAnalyzer;
|
||||
}
|
||||
/**
|
||||
* @return array<class-string<Node>>
|
||||
*/
|
||||
public function getNodeTypes() : array
|
||||
{
|
||||
return [\PhpParser\Node\Expr\Assign::class];
|
||||
}
|
||||
public function getRuleDefinition() : \Symplify\RuleDocGenerator\ValueObject\RuleDefinition
|
||||
{
|
||||
return new \Symplify\RuleDocGenerator\ValueObject\RuleDefinition('Remove assigned unused variable', [new \Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample(<<<'CODE_SAMPLE'
|
||||
class SomeClass
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$value = $this->process();
|
||||
}
|
||||
|
||||
public function process()
|
||||
{
|
||||
// something going on
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
CODE_SAMPLE
|
||||
, <<<'CODE_SAMPLE'
|
||||
class SomeClass
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$this->process();
|
||||
}
|
||||
|
||||
public function process()
|
||||
{
|
||||
// something going on
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
CODE_SAMPLE
|
||||
)]);
|
||||
}
|
||||
/**
|
||||
* @param Assign $node
|
||||
*/
|
||||
public function refactor(\PhpParser\Node $node) : ?\PhpParser\Node
|
||||
{
|
||||
if ($this->shouldSkipAssign($node)) {
|
||||
return null;
|
||||
}
|
||||
if (!$this->isPreviousVariablePartOfOverridingAssign($node) && ($this->isVariableTypeInScope($node) || $this->exprUsedInNextNodeAnalyzer->isUsed($node->var))) {
|
||||
return null;
|
||||
}
|
||||
// @see https://github.com/rectorphp/rector/issues/6655
|
||||
// verify current statement is a Node before removing or use its Assign Expr
|
||||
$currentStatement = $node->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::CURRENT_STATEMENT);
|
||||
if (!$currentStatement instanceof \PhpParser\Node) {
|
||||
return null;
|
||||
}
|
||||
// is scalar assign? remove whole
|
||||
if (!$this->sideEffectNodeDetector->detect($node->expr)) {
|
||||
$this->removeNode($node);
|
||||
return null;
|
||||
}
|
||||
return $node->expr;
|
||||
}
|
||||
private function shouldSkipAssign(\PhpParser\Node\Expr\Assign $assign) : bool
|
||||
{
|
||||
$variable = $assign->var;
|
||||
if (!$variable instanceof \PhpParser\Node\Expr\Variable) {
|
||||
return \true;
|
||||
}
|
||||
// unable to resolve name
|
||||
$variableName = $this->getName($variable);
|
||||
if ($variableName === null) {
|
||||
return \true;
|
||||
}
|
||||
if ($this->isNestedAssign($assign)) {
|
||||
return \true;
|
||||
}
|
||||
$parentIf = $this->betterNodeFinder->findParentType($assign, \PhpParser\Node\Stmt\If_::class);
|
||||
if (!$parentIf instanceof \PhpParser\Node\Stmt\If_) {
|
||||
return (bool) $this->nextVariableUsageNodeFinder->find($assign);
|
||||
}
|
||||
if (!$parentIf->else instanceof \PhpParser\Node\Stmt\Else_) {
|
||||
return (bool) $this->nextVariableUsageNodeFinder->find($assign);
|
||||
}
|
||||
return (bool) $this->betterNodeFinder->findFirstNext($parentIf, function (\PhpParser\Node $node) use($variable) : bool {
|
||||
return $this->nodeComparator->areNodesEqual($node, $variable);
|
||||
});
|
||||
}
|
||||
private function isVariableTypeInScope(\PhpParser\Node\Expr\Assign $assign) : bool
|
||||
{
|
||||
$scope = $assign->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::SCOPE);
|
||||
if (!$scope instanceof \PHPStan\Analyser\Scope) {
|
||||
return \false;
|
||||
}
|
||||
/** @var string $variableName */
|
||||
$variableName = $this->getName($assign->var);
|
||||
return !$scope->hasVariableType($variableName)->no();
|
||||
}
|
||||
private function isPreviousVariablePartOfOverridingAssign(\PhpParser\Node\Expr\Assign $assign) : bool
|
||||
{
|
||||
// is previous variable node as part of assign?
|
||||
$previousVariableAssign = $this->previousVariableAssignNodeFinder->find($assign);
|
||||
if (!$previousVariableAssign instanceof \PhpParser\Node) {
|
||||
return \false;
|
||||
}
|
||||
return $this->scopeNestingComparator->areScopeNestingEqual($assign, $previousVariableAssign);
|
||||
}
|
||||
/**
|
||||
* Nested assign, e.g "$oldValues = <$values> = 5;"
|
||||
*/
|
||||
private function isNestedAssign(\PhpParser\Node\Expr\Assign $assign) : bool
|
||||
{
|
||||
$parent = $assign->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::PARENT_NODE);
|
||||
return $parent instanceof \PhpParser\Node\Expr\Assign;
|
||||
}
|
||||
}
|
|
@ -16,11 +16,11 @@ final class VersionResolver
|
|||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '24d20f3f094c98db7320ef788a3d5b9cac96d3e8';
|
||||
public const PACKAGE_VERSION = 'aedfc65a48ac74d90e6f95804755f7062dcbaf16';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2022-04-01 05:43:13';
|
||||
public const RELEASE_DATE = '2022-04-01 09:13:23';
|
||||
public static function resolvePackageVersion() : string
|
||||
{
|
||||
$process = new \RectorPrefix20220401\Symfony\Component\Process\Process(['git', 'log', '--pretty="%H"', '-n1', 'HEAD'], __DIR__);
|
||||
|
|
2
vendor/autoload.php
vendored
2
vendor/autoload.php
vendored
|
@ -4,4 +4,4 @@
|
|||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInite27d4aaeae0cf1c799971adef504f4a8::getLoader();
|
||||
return ComposerAutoloaderInit9d58afb2ac14687ed52c8a599893de73::getLoader();
|
||||
|
|
3
vendor/composer/autoload_classmap.php
vendored
3
vendor/composer/autoload_classmap.php
vendored
|
@ -1810,8 +1810,6 @@ return array(
|
|||
'Rector\\DeadCode\\NodeCollector\\ModifiedVariableNamesCollector' => $baseDir . '/rules/DeadCode/NodeCollector/ModifiedVariableNamesCollector.php',
|
||||
'Rector\\DeadCode\\NodeCollector\\NodeByTypeAndPositionCollector' => $baseDir . '/rules/DeadCode/NodeCollector/NodeByTypeAndPositionCollector.php',
|
||||
'Rector\\DeadCode\\NodeCollector\\UnusedParameterResolver' => $baseDir . '/rules/DeadCode/NodeCollector/UnusedParameterResolver.php',
|
||||
'Rector\\DeadCode\\NodeFinder\\NextVariableUsageNodeFinder' => $baseDir . '/rules/DeadCode/NodeFinder/NextVariableUsageNodeFinder.php',
|
||||
'Rector\\DeadCode\\NodeFinder\\PreviousVariableAssignNodeFinder' => $baseDir . '/rules/DeadCode/NodeFinder/PreviousVariableAssignNodeFinder.php',
|
||||
'Rector\\DeadCode\\NodeFinder\\VariableUseFinder' => $baseDir . '/rules/DeadCode/NodeFinder/VariableUseFinder.php',
|
||||
'Rector\\DeadCode\\NodeManipulator\\ControllerClassMethodManipulator' => $baseDir . '/rules/DeadCode/NodeManipulator/ControllerClassMethodManipulator.php',
|
||||
'Rector\\DeadCode\\NodeManipulator\\CountManipulator' => $baseDir . '/rules/DeadCode/NodeManipulator/CountManipulator.php',
|
||||
|
@ -1825,7 +1823,6 @@ return array(
|
|||
'Rector\\DeadCode\\PhpDoc\\TagRemover\\VarTagRemover' => $baseDir . '/rules/DeadCode/PhpDoc/TagRemover/VarTagRemover.php',
|
||||
'Rector\\DeadCode\\Rector\\Array_\\RemoveDuplicatedArrayKeyRector' => $baseDir . '/rules/DeadCode/Rector/Array_/RemoveDuplicatedArrayKeyRector.php',
|
||||
'Rector\\DeadCode\\Rector\\Assign\\RemoveDoubleAssignRector' => $baseDir . '/rules/DeadCode/Rector/Assign/RemoveDoubleAssignRector.php',
|
||||
'Rector\\DeadCode\\Rector\\Assign\\RemoveUnusedAssignVariableRector' => $baseDir . '/rules/DeadCode/Rector/Assign/RemoveUnusedAssignVariableRector.php',
|
||||
'Rector\\DeadCode\\Rector\\Assign\\RemoveUnusedVariableAssignRector' => $baseDir . '/rules/DeadCode/Rector/Assign/RemoveUnusedVariableAssignRector.php',
|
||||
'Rector\\DeadCode\\Rector\\BinaryOp\\RemoveDuplicatedInstanceOfRector' => $baseDir . '/rules/DeadCode/Rector/BinaryOp/RemoveDuplicatedInstanceOfRector.php',
|
||||
'Rector\\DeadCode\\Rector\\BooleanAnd\\RemoveAndTrueRector' => $baseDir . '/rules/DeadCode/Rector/BooleanAnd/RemoveAndTrueRector.php',
|
||||
|
|
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 ComposerAutoloaderInite27d4aaeae0cf1c799971adef504f4a8
|
||||
class ComposerAutoloaderInit9d58afb2ac14687ed52c8a599893de73
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
|
@ -22,19 +22,19 @@ class ComposerAutoloaderInite27d4aaeae0cf1c799971adef504f4a8
|
|||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInite27d4aaeae0cf1c799971adef504f4a8', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit9d58afb2ac14687ed52c8a599893de73', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInite27d4aaeae0cf1c799971adef504f4a8', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit9d58afb2ac14687ed52c8a599893de73', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
\Composer\Autoload\ComposerStaticInite27d4aaeae0cf1c799971adef504f4a8::getInitializer($loader)();
|
||||
\Composer\Autoload\ComposerStaticInit9d58afb2ac14687ed52c8a599893de73::getInitializer($loader)();
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
$includeFiles = \Composer\Autoload\ComposerStaticInite27d4aaeae0cf1c799971adef504f4a8::$files;
|
||||
$includeFiles = \Composer\Autoload\ComposerStaticInit9d58afb2ac14687ed52c8a599893de73::$files;
|
||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||
composerRequiree27d4aaeae0cf1c799971adef504f4a8($fileIdentifier, $file);
|
||||
composerRequire9d58afb2ac14687ed52c8a599893de73($fileIdentifier, $file);
|
||||
}
|
||||
|
||||
return $loader;
|
||||
|
@ -46,7 +46,7 @@ class ComposerAutoloaderInite27d4aaeae0cf1c799971adef504f4a8
|
|||
* @param string $file
|
||||
* @return void
|
||||
*/
|
||||
function composerRequiree27d4aaeae0cf1c799971adef504f4a8($fileIdentifier, $file)
|
||||
function composerRequire9d58afb2ac14687ed52c8a599893de73($fileIdentifier, $file)
|
||||
{
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||
|
|
11
vendor/composer/autoload_static.php
vendored
11
vendor/composer/autoload_static.php
vendored
|
@ -4,7 +4,7 @@
|
|||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInite27d4aaeae0cf1c799971adef504f4a8
|
||||
class ComposerStaticInit9d58afb2ac14687ed52c8a599893de73
|
||||
{
|
||||
public static $files = array (
|
||||
'320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
|
||||
|
@ -2179,8 +2179,6 @@ class ComposerStaticInite27d4aaeae0cf1c799971adef504f4a8
|
|||
'Rector\\DeadCode\\NodeCollector\\ModifiedVariableNamesCollector' => __DIR__ . '/../..' . '/rules/DeadCode/NodeCollector/ModifiedVariableNamesCollector.php',
|
||||
'Rector\\DeadCode\\NodeCollector\\NodeByTypeAndPositionCollector' => __DIR__ . '/../..' . '/rules/DeadCode/NodeCollector/NodeByTypeAndPositionCollector.php',
|
||||
'Rector\\DeadCode\\NodeCollector\\UnusedParameterResolver' => __DIR__ . '/../..' . '/rules/DeadCode/NodeCollector/UnusedParameterResolver.php',
|
||||
'Rector\\DeadCode\\NodeFinder\\NextVariableUsageNodeFinder' => __DIR__ . '/../..' . '/rules/DeadCode/NodeFinder/NextVariableUsageNodeFinder.php',
|
||||
'Rector\\DeadCode\\NodeFinder\\PreviousVariableAssignNodeFinder' => __DIR__ . '/../..' . '/rules/DeadCode/NodeFinder/PreviousVariableAssignNodeFinder.php',
|
||||
'Rector\\DeadCode\\NodeFinder\\VariableUseFinder' => __DIR__ . '/../..' . '/rules/DeadCode/NodeFinder/VariableUseFinder.php',
|
||||
'Rector\\DeadCode\\NodeManipulator\\ControllerClassMethodManipulator' => __DIR__ . '/../..' . '/rules/DeadCode/NodeManipulator/ControllerClassMethodManipulator.php',
|
||||
'Rector\\DeadCode\\NodeManipulator\\CountManipulator' => __DIR__ . '/../..' . '/rules/DeadCode/NodeManipulator/CountManipulator.php',
|
||||
|
@ -2194,7 +2192,6 @@ class ComposerStaticInite27d4aaeae0cf1c799971adef504f4a8
|
|||
'Rector\\DeadCode\\PhpDoc\\TagRemover\\VarTagRemover' => __DIR__ . '/../..' . '/rules/DeadCode/PhpDoc/TagRemover/VarTagRemover.php',
|
||||
'Rector\\DeadCode\\Rector\\Array_\\RemoveDuplicatedArrayKeyRector' => __DIR__ . '/../..' . '/rules/DeadCode/Rector/Array_/RemoveDuplicatedArrayKeyRector.php',
|
||||
'Rector\\DeadCode\\Rector\\Assign\\RemoveDoubleAssignRector' => __DIR__ . '/../..' . '/rules/DeadCode/Rector/Assign/RemoveDoubleAssignRector.php',
|
||||
'Rector\\DeadCode\\Rector\\Assign\\RemoveUnusedAssignVariableRector' => __DIR__ . '/../..' . '/rules/DeadCode/Rector/Assign/RemoveUnusedAssignVariableRector.php',
|
||||
'Rector\\DeadCode\\Rector\\Assign\\RemoveUnusedVariableAssignRector' => __DIR__ . '/../..' . '/rules/DeadCode/Rector/Assign/RemoveUnusedVariableAssignRector.php',
|
||||
'Rector\\DeadCode\\Rector\\BinaryOp\\RemoveDuplicatedInstanceOfRector' => __DIR__ . '/../..' . '/rules/DeadCode/Rector/BinaryOp/RemoveDuplicatedInstanceOfRector.php',
|
||||
'Rector\\DeadCode\\Rector\\BooleanAnd\\RemoveAndTrueRector' => __DIR__ . '/../..' . '/rules/DeadCode/Rector/BooleanAnd/RemoveAndTrueRector.php',
|
||||
|
@ -3841,9 +3838,9 @@ class ComposerStaticInite27d4aaeae0cf1c799971adef504f4a8
|
|||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInite27d4aaeae0cf1c799971adef504f4a8::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInite27d4aaeae0cf1c799971adef504f4a8::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInite27d4aaeae0cf1c799971adef504f4a8::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit9d58afb2ac14687ed52c8a599893de73::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit9d58afb2ac14687ed52c8a599893de73::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit9d58afb2ac14687ed52c8a599893de73::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
|
8
vendor/composer/installed.json
vendored
8
vendor/composer/installed.json
vendored
|
@ -2415,12 +2415,12 @@
|
|||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/rectorphp\/rector-nette.git",
|
||||
"reference": "0aaf0a6d587b387982a6844538bce58c96cda86f"
|
||||
"reference": "1c9a431e806e0214cb38ffd33bbd225bbf34ee42"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-nette\/zipball\/0aaf0a6d587b387982a6844538bce58c96cda86f",
|
||||
"reference": "0aaf0a6d587b387982a6844538bce58c96cda86f",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-nette\/zipball\/1c9a431e806e0214cb38ffd33bbd225bbf34ee42",
|
||||
"reference": "1c9a431e806e0214cb38ffd33bbd225bbf34ee42",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -2452,7 +2452,7 @@
|
|||
"symplify\/rule-doc-generator": "^10.0",
|
||||
"symplify\/vendor-patches": "^10.0"
|
||||
},
|
||||
"time": "2022-03-10T07:53:32+00:00",
|
||||
"time": "2022-04-01T07:12:16+00:00",
|
||||
"default-branch": true,
|
||||
"type": "rector-extension",
|
||||
"extra": {
|
||||
|
|
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 d1fa93d'), '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 96ff8cb'), '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 68d30fe'), '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 31d9892'), '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 0aaf0a6'), '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 1e12437'), '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 7d2e438'), '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 513df7e'), 'ssch/typo3-rector' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/ssch/typo3-rector', 'relative_install_path' => '../../../ssch/typo3-rector', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 203d91c'));
|
||||
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 d1fa93d'), '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 96ff8cb'), '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 68d30fe'), '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 31d9892'), '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 1c9a431'), '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 1e12437'), '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 7d2e438'), '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 513df7e'), 'ssch/typo3-rector' => array('install_path' => '/home/runner/work/rector-src/rector-src/vendor/ssch/typo3-rector', 'relative_install_path' => '../../../ssch/typo3-rector', 'extra' => array('includes' => array(0 => 'config/config.php')), 'version' => 'dev-main 203d91c'));
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -27,8 +27,10 @@ final class NetteInjectPropertyAnalyzer
|
|||
if (!$phpDocInfo->hasByName('inject')) {
|
||||
throw new \Rector\Core\Exception\ShouldNotHappenException();
|
||||
}
|
||||
/** @var Scope $scope */
|
||||
$scope = $property->getAttribute(\Rector\NodeTypeResolver\Node\AttributeKey::SCOPE);
|
||||
if (!$scope instanceof \PHPStan\Analyser\Scope) {
|
||||
return \false;
|
||||
}
|
||||
$classReflection = $scope->getClassReflection();
|
||||
if (!$classReflection instanceof \PHPStan\Reflection\ClassReflection) {
|
||||
return \false;
|
||||
|
|
|
@ -102,10 +102,7 @@ final class FormFieldsFinder
|
|||
if (!$methodCallVariable instanceof \PhpParser\Node\Expr\Variable) {
|
||||
return \false;
|
||||
}
|
||||
if ($methodCallVariable->name !== $form->name) {
|
||||
return \false;
|
||||
}
|
||||
return \true;
|
||||
return $methodCallVariable->name === $form->name;
|
||||
}
|
||||
private function findMethodCallVariable(\PhpParser\Node\Expr\MethodCall $methodCall) : ?\PhpParser\Node\Expr\Variable
|
||||
{
|
||||
|
|
|
@ -54,9 +54,6 @@ final class FormOnSuccessCallbackFinder
|
|||
if (!$arrayDimFetch->var->name instanceof \PhpParser\Node\Identifier) {
|
||||
return \false;
|
||||
}
|
||||
if ($arrayDimFetch->var->name->name !== 'onSuccess') {
|
||||
return \false;
|
||||
}
|
||||
return \true;
|
||||
return $arrayDimFetch->var->name->name === 'onSuccess';
|
||||
}
|
||||
}
|
||||
|
|
10
vendor/scoper-autoload.php
vendored
10
vendor/scoper-autoload.php
vendored
|
@ -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('RectorPrefix20220401\AutoloadIncluder');
|
||||
}
|
||||
if (!class_exists('ComposerAutoloaderInite27d4aaeae0cf1c799971adef504f4a8', false) && !interface_exists('ComposerAutoloaderInite27d4aaeae0cf1c799971adef504f4a8', false) && !trait_exists('ComposerAutoloaderInite27d4aaeae0cf1c799971adef504f4a8', false)) {
|
||||
spl_autoload_call('RectorPrefix20220401\ComposerAutoloaderInite27d4aaeae0cf1c799971adef504f4a8');
|
||||
if (!class_exists('ComposerAutoloaderInit9d58afb2ac14687ed52c8a599893de73', false) && !interface_exists('ComposerAutoloaderInit9d58afb2ac14687ed52c8a599893de73', false) && !trait_exists('ComposerAutoloaderInit9d58afb2ac14687ed52c8a599893de73', false)) {
|
||||
spl_autoload_call('RectorPrefix20220401\ComposerAutoloaderInit9d58afb2ac14687ed52c8a599893de73');
|
||||
}
|
||||
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('RectorPrefix20220401\Helmich\TypoScriptParser\Parser\AST\Statement');
|
||||
|
@ -59,9 +59,9 @@ if (!function_exists('print_node')) {
|
|||
return \RectorPrefix20220401\print_node(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('composerRequiree27d4aaeae0cf1c799971adef504f4a8')) {
|
||||
function composerRequiree27d4aaeae0cf1c799971adef504f4a8() {
|
||||
return \RectorPrefix20220401\composerRequiree27d4aaeae0cf1c799971adef504f4a8(...func_get_args());
|
||||
if (!function_exists('composerRequire9d58afb2ac14687ed52c8a599893de73')) {
|
||||
function composerRequire9d58afb2ac14687ed52c8a599893de73() {
|
||||
return \RectorPrefix20220401\composerRequire9d58afb2ac14687ed52c8a599893de73(...func_get_args());
|
||||
}
|
||||
}
|
||||
if (!function_exists('scanPath')) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user