-
-
Notifications
You must be signed in to change notification settings - Fork 338
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DowngradePhp80] Add Static Call Support on DowngradeMatchToSwitchRec…
…tor (#2175) * [DowngradePhp80] Add Static Call Support on DowngradeMatchToSwitchRector * implemented * [ci-review] Rector Rectify * move to last for instanceof Expr * back to CallLike * [ci-review] Rector Rectify Co-authored-by: GitHub Action <action@github.com>
- Loading branch information
1 parent
6680bd8
commit c5c620a
Showing
2 changed files
with
61 additions
and
5 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
...DowngradePhp80/Rector/Expression/DowngradeMatchToSwitchRector/Fixture/static_call.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,52 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\DowngradePhp80\Rector\Expression\DowngradeMatchToSwitchRector\Fixture; | ||
|
||
class SomeStaticCall | ||
{ | ||
public static function output($value) | ||
{ | ||
echo $value; | ||
} | ||
|
||
public function run($statusCode) | ||
{ | ||
self::output(match ($statusCode) { | ||
200, 300 => null, | ||
400 => 'not found', | ||
default => 'unknown status code', | ||
}); | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\DowngradePhp80\Rector\Expression\DowngradeMatchToSwitchRector\Fixture; | ||
|
||
class SomeStaticCall | ||
{ | ||
public static function output($value) | ||
{ | ||
echo $value; | ||
} | ||
|
||
public function run($statusCode) | ||
{ | ||
switch ($statusCode) { | ||
case 200: | ||
case 300: | ||
self::output(null); | ||
break; | ||
case 400: | ||
self::output('not found'); | ||
break; | ||
default: | ||
self::output('unknown status code'); | ||
break; | ||
} | ||
} | ||
} | ||
|
||
?> |
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