Skip to content

Commit bf4b7e4

Browse files
committed
Updated Rector to commit dcc3c8c2a7d2fc378641f3a37b190309512fff38
rectorphp/rector-src@dcc3c8c [deprecation] deprecate file, use getFile() instead (#7962)
1 parent fc9d780 commit bf4b7e4

26 files changed

Lines changed: 44 additions & 36 deletions

File tree

rules/CodeQuality/Rector/Coalesce/CoalesceToTernaryRector.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@
33
declare (strict_types=1);
44
namespace Rector\CodeQuality\Rector\Coalesce;
55

6-
use PHPStan\Type\UnionType;
7-
use PHPStan\Type\NullType;
86
use PhpParser\Node;
97
use PhpParser\Node\Expr\ArrayDimFetch;
108
use PhpParser\Node\Expr\BinaryOp\Coalesce;
119
use PhpParser\Node\Expr\Ternary;
1210
use PHPStan\Type\ErrorType;
1311
use PHPStan\Type\MixedType;
12+
use PHPStan\Type\NullType;
13+
use PHPStan\Type\UnionType;
14+
use Rector\PHPStan\ScopeFetcher;
1415
use Rector\Rector\AbstractRector;
1516
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
1617
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
17-
use Rector\PHPStan\ScopeFetcher;
1818
/**
1919
* @see \Rector\Tests\CodeQuality\Rector\Coalesce\CoalesceToTernaryRector\CoalesceToTernaryRectorTest
2020
*/

rules/CodeQuality/Rector/Empty_/SimplifyEmptyCheckOnEmptyArrayRector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ private function isAllowedExpr(Expr $expr, Scope $scope): bool
145145
if (!$property instanceof Property) {
146146
return \false;
147147
}
148-
$type = $this->allAssignNodePropertyTypeInferer->inferProperty($property, $classReflection, $this->file);
148+
$type = $this->allAssignNodePropertyTypeInferer->inferProperty($property, $classReflection, $this->getFile());
149149
if (!$type instanceof Type) {
150150
return \false;
151151
}

rules/CodeQuality/Rector/If_/CompleteMissingIfElseBracketRector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function refactor(Node $node): ?Node
5959
if ($this->isBareNewNode($node)) {
6060
return null;
6161
}
62-
$oldTokens = $this->file->getOldTokens();
62+
$oldTokens = $this->getFile()->getOldTokens();
6363
if ($this->isIfConditionFollowedByOpeningCurlyBracket($node, $oldTokens)) {
6464
return null;
6565
}

rules/CodeQuality/Rector/NotEqual/CommonNotEqualRector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function refactor(Node $node): ?NotEqual
5050
$tokenStartPos = $node->getStartTokenPos();
5151
$tokenEndPos = $node->getEndTokenPos();
5252
for ($i = $tokenStartPos; $i < $tokenEndPos; ++$i) {
53-
$token = $this->file->getOldTokens()[$i];
53+
$token = $this->getFile()->getOldTokens()[$i];
5454
if ((string) $token === '<>') {
5555
$token->text = '!=';
5656
return $node;

rules/CodingStyle/Rector/Encapsed/WrapEncapsedVariableInCurlyBracesRector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function getNodeTypes(): array
4444
public function refactor(Node $node): ?Node
4545
{
4646
$hasVariableBeenWrapped = \false;
47-
$oldTokens = $this->file->getOldTokens();
47+
$oldTokens = $this->getFile()->getOldTokens();
4848
foreach ($node->parts as $index => $nodePart) {
4949
if ($nodePart instanceof Variable && $nodePart->getStartTokenPos() >= 0) {
5050
$start = $oldTokens[$nodePart->getStartTokenPos() - 1] ?? null;

rules/DeadCode/Rector/Concat/RemoveConcatAutocastRector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ private function removeStringCast(Expr $expr): Expr
6464
return $expr;
6565
}
6666
$targetExpr = $expr->expr;
67-
$tokens = $this->file->getOldTokens();
67+
$tokens = $this->getFile()->getOldTokens();
6868
if ($expr->expr instanceof BinaryOp) {
6969
$castStartTokenPos = $expr->getStartTokenPos();
7070
$targetExprStartTokenPos = $targetExpr->getStartTokenPos();

rules/DeadCode/Rector/Plus/RemoveDeadZeroAndOneOperationRector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ private function processBinaryMulAndDiv($binaryOp): ?Expr
169169
return null;
170170
}
171171
if ($binaryOp instanceof Mul && $this->isLiteralOne($binaryOp->left) && $this->nodeTypeResolver->isNumberType($binaryOp->right)) {
172-
if ($this->isMulParenthesized($this->file, $binaryOp)) {
172+
if ($this->isMulParenthesized($this->getFile(), $binaryOp)) {
173173
$binaryOp->right->setAttribute(AttributeKey::WRAPPED_IN_PARENTHESES, \true);
174174
}
175175
return $binaryOp->right;

rules/Php53/Rector/Ternary/TernaryToElvisRector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function provideMinPhpVersion(): int
6363
}
6464
private function isParenthesized(Expr $ifExpr, Expr $elseExpr): bool
6565
{
66-
$tokens = $this->file->getOldTokens();
66+
$tokens = $this->getFile()->getOldTokens();
6767
$ifExprTokenEnd = $ifExpr->getEndTokenPos();
6868
$elseExprTokenStart = $elseExpr->getStartTokenPos();
6969
if ($ifExprTokenEnd < 0 || $elseExprTokenStart < 0 || $elseExprTokenStart <= $ifExprTokenEnd) {

rules/Php54/Rector/Array_/LongArrayToShortArrayRector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function refactor(Node $node): ?Node
6363
return null;
6464
}
6565
$node->setAttribute(AttributeKey::KIND, Array_::KIND_SHORT);
66-
$tokens = $this->file->getOldTokens();
66+
$tokens = $this->getFile()->getOldTokens();
6767
$startTokenPos = $node->getStartTokenPos();
6868
$endTokenPos = $node->getEndTokenPos();
6969
if (!isset($tokens[$startTokenPos], $tokens[$endTokenPos])) {

rules/Php70/Rector/Ternary/TernaryToNullCoalescingRector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ private function processTernaryWithIsset(Ternary $ternary, Isset_ $isset): ?Coal
9595
if (!$this->nodeComparator->areNodesEqual($ternary->if, $isset->vars[0])) {
9696
return null;
9797
}
98-
if (($ternary->else instanceof Ternary || $ternary->else instanceof BinaryOp) && $this->isTernaryParenthesized($this->file, $ternary->cond, $ternary)) {
98+
if (($ternary->else instanceof Ternary || $ternary->else instanceof BinaryOp) && $this->isTernaryParenthesized($this->getFile(), $ternary->cond, $ternary)) {
9999
$ternary->else->setAttribute(AttributeKey::WRAPPED_IN_PARENTHESES, \true);
100100
}
101101
return new Coalesce($ternary->if, $ternary->else);

0 commit comments

Comments
 (0)