File tree Expand file tree Collapse file tree
rules/DeadCode/Rector/Ternary Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -62,10 +62,6 @@ public function getNodeTypes(): array
6262 */
6363 public function refactor (Node $ node ): ?Node
6464 {
65- if ($ node ->if instanceof Expr && ! $ this ->nodeComparator ->areNodesEqual ($ node ->if , $ node ->cond )) {
66- return null ;
67- }
68-
6965 /**
7066 * if condition is negated, skip
7167 * switch negated ternary condition early via SwitchNegatedTernaryRector for that
@@ -75,6 +71,10 @@ public function refactor(Node $node): ?Node
7571 return null ;
7672 }
7773
74+ if ($ node ->if instanceof Expr && ! $ this ->nodeComparator ->areNodesEqual ($ node ->if , $ node ->cond )) {
75+ return null ;
76+ }
77+
7878 $ nativeType = $ this ->nodeTypeResolver ->getNativeType ($ node ->cond );
7979 if ($ nativeType instanceof BooleanType && $ this ->valueResolver ->isFalse ($ node ->else )) {
8080 return $ node ->cond ;
You can’t perform that action at this time.
0 commit comments