Updated Rector to commit 56e2031ba3eb1886f534e87d6fb533f8b24f6889

56e2031ba3 [CodeQuality] Skip $counter variable exists on ForRepeatedCountToOwnVariableRector (#5828)
This commit is contained in:
Tomas Votruba 2024-04-17 21:03:14 +00:00
parent 83bfbc18b8
commit f42da12667
3 changed files with 10 additions and 6 deletions

View File

@ -13,13 +13,14 @@ use PhpParser\Node\Expr\Variable;
use PhpParser\Node\Stmt;
use PhpParser\Node\Stmt\Expression;
use PhpParser\Node\Stmt\For_;
use Rector\Rector\AbstractRector;
use PHPStan\Analyser\Scope;
use Rector\Rector\AbstractScopeAwareRector;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
/**
* @see \Rector\Tests\CodeQuality\Rector\For_\ForRepeatedCountToOwnVariableRector\ForRepeatedCountToOwnVariableRectorTest
*/
final class ForRepeatedCountToOwnVariableRector extends AbstractRector
final class ForRepeatedCountToOwnVariableRector extends AbstractScopeAwareRector
{
/**
* @var string
@ -63,8 +64,11 @@ CODE_SAMPLE
* @param For_ $node
* @return Stmt[]|null
*/
public function refactor(Node $node) : ?array
public function refactorWithScope(Node $node, Scope $scope) : ?array
{
if ($scope->hasVariableType(self::COUNTER_NAME)->yes()) {
return null;
}
$countInCond = null;
$counterVariable = new Variable(self::COUNTER_NAME);
foreach ($node->cond as $condExpr) {

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = 'd67342e4e23b577a259e2d2af0ed64461db9968b';
public const PACKAGE_VERSION = '56e2031ba3eb1886f534e87d6fb533f8b24f6889';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2024-04-17 10:01:56';
public const RELEASE_DATE = '2024-04-18 04:00:25';
/**
* @var int
*/

View File

@ -14,7 +14,7 @@ $loader = (static function () {
// Restore the backup and ensure the excluded files are properly marked as loaded
$GLOBALS['__composer_autoload_files'] = \array_merge(
$existingComposerAutoloadFiles,
\array_fill_keys(['5928a00fa978807cf85d90ec3f4b0147', '0e6d7bf4a5811bfa5cf40c5ccd6fae6a'], true)
\array_fill_keys(['0e6d7bf4a5811bfa5cf40c5ccd6fae6a', '5928a00fa978807cf85d90ec3f4b0147'], true)
);
return $loader;