-
-
Notifications
You must be signed in to change notification settings - Fork 336
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Php80] Handle default in previous not used in next switch (#2335)
* [Php80] Handle default in previous not used in next switch * debug * Fixed 🎉 * Fixed 🎉
- Loading branch information
1 parent
3f0a0b7
commit 1a56ec1
Showing
2 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
...witch_/ChangeSwitchToMatchRector/Fixture/default_in_previous_not_used_next_switch.php.inc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Php80\Rector\Switch_\ChangeSwitchToMatchRector\Fixture; | ||
|
||
final class DefaultInPreviousNotUsedNextSwitch | ||
{ | ||
public function run($input) | ||
{ | ||
$result = ''; | ||
switch ($input) { | ||
case 'a': | ||
case 'b': | ||
$result = 0; | ||
break; | ||
case 'Monsieur': | ||
$result = 1; | ||
break; | ||
} | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\Php80\Rector\Switch_\ChangeSwitchToMatchRector\Fixture; | ||
|
||
final class DefaultInPreviousNotUsedNextSwitch | ||
{ | ||
public function run($input) | ||
{ | ||
$result = match ($input) { | ||
'a', 'b' => 0, | ||
'Monsieur' => 1, | ||
default => '', | ||
}; | ||
} | ||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters