-
-
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.
[DeadCode] Skip Class Constant used in Enum on RemoveUnusedPrivateCla… (
#3174) * Add failing test fixture for RemoveUnusedPrivateClassConstantRector # Failing Test for RemoveUnusedPrivateClassConstantRector Based on https://getrector.org/demo/2333a008-e4b0-4d11-9ade-3b37412193d2 * [DeadCode] Skip Class Constant used in Enum on RemoveUnusedPrivateClassConstantRector * Explicitly check for class-like parent Co-authored-by: Abdul Malik Ikhsan <samsonasik@gmail.com> * Use class import Co-authored-by: Abdul Malik Ikhsan <samsonasik@gmail.com> Co-authored-by: Abdul Malik Ikhsan <samsonasik@gmail.com>
- Loading branch information
1 parent
4ba03ab
commit b23e1fb
Showing
2 changed files
with
23 additions
and
3 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
...t/RemoveUnusedPrivateClassConstantRector/Fixture/skip_class_constant_used_in_enum.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,19 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\DeadCode\Rector\ClassConst\RemoveUnusedPrivateClassConstantRector\Fixture; | ||
|
||
enum SkipClassConstantUsedInEnum | ||
{ | ||
case Foo; | ||
case Baz; | ||
|
||
private const SOME_CONST = [ | ||
self::Foo, | ||
self::Baz, | ||
]; | ||
|
||
public function run(): bool | ||
{ | ||
return in_array($this, self::SOME_CONST, true); | ||
} | ||
} |
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