-
-
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.
[PHP 8.1] Add support for values method in SpatieEnumClassToEnumRector (
#3196) Co-authored-by: jools <julien.dephix.nagoya@accopilot.com>
- Loading branch information
1 parent
e71df1b
commit 40f6d19
Showing
2 changed files
with
106 additions
and
6 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
rules-tests/Php81/Rector/Class_/SpatieEnumClassToEnumRector/Fixture/enum_with_values.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,39 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Php81\Rector\Class_\SpatieEnumClassToEnumRector\Fixture; | ||
|
||
use Spatie\Enum\Enum; | ||
|
||
/** | ||
* @method static self draft() | ||
* @method static self published() | ||
* @method static self archived() | ||
*/ | ||
class StatusEnum extends Enum | ||
{ | ||
protected static function values(): array | ||
{ | ||
return [ | ||
'draft' => 1, | ||
'published' => 2, | ||
'archived' => 3, | ||
]; | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\Php81\Rector\Class_\SpatieEnumClassToEnumRector\Fixture; | ||
|
||
use Spatie\Enum\Enum; | ||
|
||
enum StatusEnum : int | ||
{ | ||
case DRAFT = 1; | ||
case PUBLISHED = 2; | ||
case ARCHIVED = 3; | ||
} | ||
|
||
?> |
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