You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The rule should not touch anything outside the initial switch statement. Here it’s removing the $value = "A"; instruction in the other branch of the if/else block. This means that if I call this function with (99, false), it will have an undefined return value, where it should have returned "A" before running Rector.
By the way, but this is an unrelated issue, I think it’s dangerous to advertise this as a part of a simple automatic upgrade for PHP 8, as the switch->match conversion will likely introduce some bugs because of the strict comparison being used in match.
The text was updated successfully, but these errors were encountered:
Bug Report
Minimal PHP Code Causing Issue
See https://getrector.org/demo/b0d8696f-23ae-44b1-afb3-9c5ce9443bdf
Responsible rules
ChangeSwitchToMatchRector
Expected Behavior
The rule should not touch anything outside the initial switch statement. Here it’s removing the
$value = "A";
instruction in the other branch of the if/else block. This means that if I call this function with(99, false)
, it will have an undefined return value, where it should have returned"A"
before running Rector.By the way, but this is an unrelated issue, I think it’s dangerous to advertise this as a part of a simple automatic upgrade for PHP 8, as the switch->match conversion will likely introduce some bugs because of the strict comparison being used in
match
.The text was updated successfully, but these errors were encountered: