forked from rectorphp/rector
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PHP 8.0] Include instant returns in match (rectorphp#177)
- Loading branch information
1 parent
e3e31f5
commit ca1cdfa
Showing
3 changed files
with
63 additions
and
4 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
...Php80/Rector/Switch_/ChangeSwitchToMatchRector/Fixture/double_return_with_default.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,38 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Php80\Rector\Switch_\ChangeSwitchToMatchRector\Fixture; | ||
|
||
final class DoubleReturnWithDefault | ||
{ | ||
public static function toStorageValue($input): string | ||
{ | ||
switch ($input) { | ||
case 100: | ||
return 'yes'; | ||
case 200: | ||
return 'no'; | ||
default: | ||
throw new \RuntimeException; | ||
} | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\Php80\Rector\Switch_\ChangeSwitchToMatchRector\Fixture; | ||
|
||
final class DoubleReturnWithDefault | ||
{ | ||
public static function toStorageValue($input): string | ||
{ | ||
return match ($input) { | ||
100 => 'yes', | ||
200 => 'no', | ||
default => throw new \RuntimeException, | ||
}; | ||
} | ||
} | ||
|
||
?> |
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
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