-
-
Notifications
You must be signed in to change notification settings - Fork 337
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allows to convert Spatie enum names to snake upper case (#5435)
* allows to convert Spatie enum names to snake upper case through toUpperSnakeCase configuration * - adds a new Fixture for upper case enum names - rebase main * fix cs related errors * fix phpstan related errors * move regexp to a class constant and add links to regex101.com * renames constant
- Loading branch information
1 parent
a8cc19a
commit 86e7402
Showing
3 changed files
with
70 additions
and
6 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
...hp81/Rector/Class_/SpatieEnumClassToEnumRector/Fixture/enum_with_camel_case_names.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,33 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Php81\Rector\Class_\SpatieEnumClassToEnumRector\Fixture; | ||
|
||
use Spatie\Enum\Enum; | ||
|
||
/** | ||
* @method static self isOK() | ||
* @method static self needsReview() | ||
* @method static self isV2() | ||
* @method static self IS_OBSOLETE() | ||
*/ | ||
class StatusEnum extends Enum | ||
{ | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\Php81\Rector\Class_\SpatieEnumClassToEnumRector\Fixture; | ||
|
||
use Spatie\Enum\Enum; | ||
|
||
enum StatusEnum : string | ||
{ | ||
case ISOK = 'isOK'; | ||
case NEEDSREVIEW = 'needsReview'; | ||
case ISV2 = 'isV2'; | ||
case IS_OBSOLETE = 'IS_OBSOLETE'; | ||
} | ||
|
||
?> |
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