-
-
Notifications
You must be signed in to change notification settings - Fork 359
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Php80] Handle crash on multi next stmts on ChangeSwitchToMatchRector (…
- Loading branch information
1 parent
8017dac
commit 654d5a2
Showing
2 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
rules-tests/Php80/Rector/Switch_/ChangeSwitchToMatchRector/Fixture/multi_next_stmt.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,46 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Php80\Rector\Switch_\ChangeSwitchToMatchRector\Fixture; | ||
|
||
final class MultiNextStmt | ||
{ | ||
public function run($value) | ||
{ | ||
switch ($value) { | ||
case 'number': | ||
case 'percentage': | ||
case 'integer': | ||
case 'price': | ||
case 'decimal': | ||
$sort = SORT_NUMERIC; | ||
break; | ||
case 'string': | ||
case 'list': | ||
case 'text': | ||
$sort = SORT_NATURAL | SORT_FLAG_CASE; | ||
break; | ||
default: | ||
$sort = SORT_REGULAR; | ||
} | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\Php80\Rector\Switch_\ChangeSwitchToMatchRector\Fixture; | ||
|
||
final class MultiNextStmt | ||
{ | ||
public function run($value) | ||
{ | ||
$sort = match ($value) { | ||
'number', 'percentage', 'integer', 'price', 'decimal' => SORT_NUMERIC, | ||
'string', 'list', 'text' => SORT_NATURAL | SORT_FLAG_CASE, | ||
default => SORT_REGULAR, | ||
}; | ||
} | ||
} | ||
|
||
?> |
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