-
-
Notifications
You must be signed in to change notification settings - Fork 339
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] Keep use stmts in MyCLabsClassToEnumRector enum (#2696)
- Loading branch information
1 parent
963c48c
commit 49a8343
Showing
3 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
rules-tests/Php81/Rector/Class_/MyCLabsClassToEnumRector/Fixture/keep_used_trait.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_\MyCLabsClassToEnumRector\Fixture; | ||
|
||
use MyCLabs\Enum\Enum; | ||
use Rector\Tests\Php81\Rector\Class_\MyCLabsClassToEnumRector\Source\ComparingTrait; | ||
|
||
final class KeepUsedTrait extends Enum | ||
{ | ||
use ComparingTrait; | ||
|
||
/** | ||
* Some comment | ||
*/ | ||
private const VIEW = 'view'; | ||
|
||
private const EDIT = 'edit'; | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\Php81\Rector\Class_\MyCLabsClassToEnumRector\Fixture; | ||
|
||
use MyCLabs\Enum\Enum; | ||
use Rector\Tests\Php81\Rector\Class_\MyCLabsClassToEnumRector\Source\ComparingTrait; | ||
|
||
enum KeepUsedTrait : string | ||
{ | ||
use ComparingTrait; | ||
/** | ||
* Some comment | ||
*/ | ||
case VIEW = 'view'; | ||
case EDIT = 'edit'; | ||
} | ||
|
||
?> |
18 changes: 18 additions & 0 deletions
18
rules-tests/Php81/Rector/Class_/MyCLabsClassToEnumRector/Source/ComparingTrait.php
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,18 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Rector\Tests\Php81\Rector\Class_\MyCLabsClassToEnumRector\Source; | ||
|
||
use MyCLabs\Enum\Enum; | ||
|
||
trait ComparingTrait | ||
{ | ||
/** | ||
* @param Enum | ||
*/ | ||
public function equalsEnum(self $other): bool | ||
{ | ||
return $other->getValue() === $this->getValue(); | ||
} | ||
} |
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