-
-
Notifications
You must be signed in to change notification settings - Fork 739
Closed
Description
Bug Report
| Subject | Details |
|---|---|
| Rector version | last master |
| Installed as | composer dependency |
I tried to run MoveVariableDeclarationNearReferenceRector on my code but had a false positive when a variable is used multiple time in a switch where each case can return. The issue is that the rector moves the variable on the first case so it's undefined later
Minimal PHP Code Causing Issue
public static function get_price($do_trt): array {
- $do_sfe = $do_trt->get_sfe_do();
switch($do_trt->get_mar_do()->get_cod_s()) {
case 'MAR1':
+ $do_sfe = $do_trt->get_sfe_do();
return class1::get_price_all($do_sfe);
case 'MAR2':
return class1::get_price_all($do_sfe);Expected Behaviour
The variable shouldn't move in this case
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels