File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed
rules-tests/CodeQuality/Rector/Assign/CombinedAssignRector/Fixture
rules/CodeQuality/Rector/Assign Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace Rector \Tests \CodeQuality \Rector \Assign \CombinedAssignRector \Fixture ;
6+
7+ class skipXorArrayDimFetch
8+ {
9+ public function run ()
10+ {
11+ $ string = 'Hello world ' ;
12+ $ string [5 ] = $ string [5 ] ^ '\x06 ' ;
13+ echo $ string , "\n" ;
14+ }
15+ }
16+
17+ ?>
Original file line number Diff line number Diff line change 55namespace Rector \CodeQuality \Rector \Assign ;
66
77use PhpParser \Node ;
8+ use PhpParser \Node \Expr \ArrayDimFetch ;
89use PhpParser \Node \Expr \Assign ;
910use PhpParser \Node \Expr \BinaryOp ;
11+ use PhpParser \Node \Expr \BinaryOp \BitwiseXor ;
1012use Rector \PhpParser \Node \AssignAndBinaryMap ;
1113use Rector \Rector \AbstractRector ;
1214use Symplify \RuleDocGenerator \ValueObject \CodeSample \CodeSample ;
@@ -54,6 +56,12 @@ public function refactor(Node $node): ?Node
5456 return null ;
5557 }
5658
59+ if ($ binaryNode ->left instanceof ArrayDimFetch &&
60+ $ node ->expr instanceof BitwiseXor
61+ ) {
62+ return null ;
63+ }
64+
5765 $ assignClass = $ this ->assignAndBinaryMap ->getAlternative ($ binaryNode );
5866 if ($ assignClass === null ) {
5967 return null ;
You can’t perform that action at this time.
0 commit comments