mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-07 11:50:51 +00:00
Updated Rector to commit 56e2031ba3eb1886f534e87d6fb533f8b24f6889
56e2031ba3
[CodeQuality] Skip $counter variable exists on ForRepeatedCountToOwnVariableRector (#5828)
This commit is contained in:
parent
83bfbc18b8
commit
f42da12667
|
@ -13,13 +13,14 @@ use PhpParser\Node\Expr\Variable;
|
||||||
use PhpParser\Node\Stmt;
|
use PhpParser\Node\Stmt;
|
||||||
use PhpParser\Node\Stmt\Expression;
|
use PhpParser\Node\Stmt\Expression;
|
||||||
use PhpParser\Node\Stmt\For_;
|
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\CodeSample\CodeSample;
|
||||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||||
/**
|
/**
|
||||||
* @see \Rector\Tests\CodeQuality\Rector\For_\ForRepeatedCountToOwnVariableRector\ForRepeatedCountToOwnVariableRectorTest
|
* @see \Rector\Tests\CodeQuality\Rector\For_\ForRepeatedCountToOwnVariableRector\ForRepeatedCountToOwnVariableRectorTest
|
||||||
*/
|
*/
|
||||||
final class ForRepeatedCountToOwnVariableRector extends AbstractRector
|
final class ForRepeatedCountToOwnVariableRector extends AbstractScopeAwareRector
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
|
@ -63,8 +64,11 @@ CODE_SAMPLE
|
||||||
* @param For_ $node
|
* @param For_ $node
|
||||||
* @return Stmt[]|null
|
* @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;
|
$countInCond = null;
|
||||||
$counterVariable = new Variable(self::COUNTER_NAME);
|
$counterVariable = new Variable(self::COUNTER_NAME);
|
||||||
foreach ($node->cond as $condExpr) {
|
foreach ($node->cond as $condExpr) {
|
||||||
|
|
|
@ -19,12 +19,12 @@ final class VersionResolver
|
||||||
* @api
|
* @api
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public const PACKAGE_VERSION = 'd67342e4e23b577a259e2d2af0ed64461db9968b';
|
public const PACKAGE_VERSION = '56e2031ba3eb1886f534e87d6fb533f8b24f6889';
|
||||||
/**
|
/**
|
||||||
* @api
|
* @api
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public const RELEASE_DATE = '2024-04-17 10:01:56';
|
public const RELEASE_DATE = '2024-04-18 04:00:25';
|
||||||
/**
|
/**
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
|
|
2
vendor/scoper-autoload.php
vendored
2
vendor/scoper-autoload.php
vendored
|
@ -14,7 +14,7 @@ $loader = (static function () {
|
||||||
// Restore the backup and ensure the excluded files are properly marked as loaded
|
// Restore the backup and ensure the excluded files are properly marked as loaded
|
||||||
$GLOBALS['__composer_autoload_files'] = \array_merge(
|
$GLOBALS['__composer_autoload_files'] = \array_merge(
|
||||||
$existingComposerAutoloadFiles,
|
$existingComposerAutoloadFiles,
|
||||||
\array_fill_keys(['5928a00fa978807cf85d90ec3f4b0147', '0e6d7bf4a5811bfa5cf40c5ccd6fae6a'], true)
|
\array_fill_keys(['0e6d7bf4a5811bfa5cf40c5ccd6fae6a', '5928a00fa978807cf85d90ec3f4b0147'], true)
|
||||||
);
|
);
|
||||||
|
|
||||||
return $loader;
|
return $loader;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user