Skip to content

Incorrect behavior of CombinedAssignRector #9468

@jlherren

Description

@jlherren

Bug Report

Subject Details
Rector version last dev-main
Installed as composer dependency

Minimal PHP Code Causing Issue

See https://getrector.com/demo/7ace8e91-e71e-4705-b944-177fe6ecda3f

<?php

$string = 'Hello world';
$string[5] = $string[5] ^ '\x06';
echo $string, "\n";

Rector changes:

 $string = 'Hello world';
-$string[5] = $string[5] ^ '\x06';
+$string[5] ^= '\x06';
 echo $string, "\n";

But this breaks the code: https://3v4l.org/MC8JK

Responsible rules

  • CombinedAssignRector

Expected Behavior

Code should not be changed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions