Skip to content

Commit d4490af

Browse files
committed
skip compared to false
1 parent 66a4eed commit d4490af

File tree

2 files changed

+3
-13
lines changed

2 files changed

+3
-13
lines changed

rules-tests/DowngradePhp80/Rector/FuncCall/DowngradeSubstrFalsyRector/Fixture/skip_compared_to_false.php.inc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ class SkipComparedToFalse
66
{
77
public function run(string $name)
88
{
9-
substr($name, 2) == false;
109
substr($name, 2) === false;
1110
}
1211
}

rules/DowngradePhp80/Rector/FuncCall/DowngradeSubstrFalsyRector.php

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
use PhpParser\Node;
88
use PhpParser\Node\Expr;
9-
use PhpParser\Node\Expr\BinaryOp\Equal;
109
use PhpParser\Node\Expr\BinaryOp\Identical;
1110
use PhpParser\Node\Expr\BooleanNot;
1211
use PhpParser\Node\Expr\Cast;
@@ -49,19 +48,11 @@ public function getRuleDefinition(): RuleDefinition
4948
*/
5049
public function getNodeTypes(): array
5150
{
52-
return [
53-
Cast::class,
54-
Empty_::class,
55-
BooleanNot::class,
56-
Ternary::class,
57-
Equal::class,
58-
Identical::class,
59-
FuncCall::class,
60-
];
51+
return [Cast::class, Empty_::class, BooleanNot::class, Ternary::class, Identical::class, FuncCall::class];
6152
}
6253

6354
/**
64-
* @param Cast|Empty_|BooleanNot|Ternary|Equal|Identical|FuncCall $node
55+
* @param Cast|Empty_|BooleanNot|Ternary|Identical|FuncCall $node
6556
*/
6657
public function refactor(Node $node): ?Node
6758
{
@@ -78,7 +69,7 @@ public function refactor(Node $node): ?Node
7869
return null;
7970
}
8071

81-
if ($node instanceof Equal || $node instanceof Identical) {
72+
if ($node instanceof Identical) {
8273
if ($this->valueResolver->isFalse($node->left)) {
8374
$node->right->setAttribute(self::IS_UNCASTABLE, true);
8475
}

0 commit comments

Comments
 (0)