-
-
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.
MyCLabs enum equals + keeping methods (#4645)
* MyCLabs enums: keep enum custom methods (#8051) * Enabled more usage variants of MyCLabs\Enum->equals() * Removed tests cases for invalid use cases - there is no need to refactor non existing enum constant * Code quality improvements
- Loading branch information
Showing
7 changed files
with
170 additions
and
68 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
rules-tests/Php81/Rector/Class_/MyCLabsClassToEnumRector/Fixture/keep_methods.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,37 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Php81\Rector\Class_\MyCLabsClassToEnumRector\Fixture; | ||
|
||
use MyCLabs\Enum\Enum; | ||
|
||
final class KeepMethods extends Enum | ||
{ | ||
private const VIEW = 'view'; | ||
|
||
private const EDIT = 'edit'; | ||
|
||
public function isItSame(self $other): bool | ||
{ | ||
return $this === $other; | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\Php81\Rector\Class_\MyCLabsClassToEnumRector\Fixture; | ||
|
||
use MyCLabs\Enum\Enum; | ||
|
||
enum KeepMethods : string | ||
{ | ||
case VIEW = 'view'; | ||
case EDIT = 'edit'; | ||
public function isItSame(self $other): bool | ||
{ | ||
return $this === $other; | ||
} | ||
} | ||
|
||
?> |
31 changes: 0 additions & 31 deletions
31
...81/Rector/MethodCall/MyCLabsMethodCallToEnumConstRector/Fixture/usage_of_constant.php.inc
This file was deleted.
Oops, something went wrong.
31 changes: 0 additions & 31 deletions
31
...tor/MethodCall/MyCLabsMethodCallToEnumConstRector/Fixture/usage_of_constant_value.php.inc
This file was deleted.
Oops, something went wrong.
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
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