-
-
Notifications
You must be signed in to change notification settings - Fork 343
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PHP 8.0] Add property support to ConstantListClassToEnumRector (#2422)
* add property enum support * fixup! add property enum support
- Loading branch information
1 parent
7722a57
commit 0df2351
Showing
4 changed files
with
124 additions
and
22 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
...ests/Php80/Rector/Class_/ConstantListClassToEnumRector/Fixture/enum_type_property.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,28 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Php80\Rector\Class_\ConstantListClassToEnumRector\Fixture; | ||
|
||
use Rector\Tests\Php80\Rector\Class_\ConstantListClassToEnumRector\Source\Gear; | ||
|
||
final class EnumTypeProperty | ||
{ | ||
/** | ||
* @var Gear::* $gear | ||
*/ | ||
private $gear; | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\Php80\Rector\Class_\ConstantListClassToEnumRector\Fixture; | ||
|
||
use Rector\Tests\Php80\Rector\Class_\ConstantListClassToEnumRector\Source\Gear; | ||
|
||
final class EnumTypeProperty | ||
{ | ||
private \Rector\Tests\Php80\Rector\Class_\ConstantListClassToEnumRector\Source\Gear $gear; | ||
} | ||
|
||
?> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Rector\Php80\ValueObject; | ||
|
||
use PHPStan\PhpDocParser\Ast\PhpDoc\ParamTagValueNode; | ||
use PHPStan\PhpDocParser\Ast\PhpDoc\ReturnTagValueNode; | ||
use PHPStan\PhpDocParser\Ast\PhpDoc\VarTagValueNode; | ||
|
||
final class ClassNameAndTagValueNode | ||
{ | ||
public function __construct( | ||
private readonly string $enumClass, | ||
private readonly ParamTagValueNode|ReturnTagValueNode|VarTagValueNode $tagValueNode | ||
) { | ||
} | ||
|
||
public function getEnumClass(): string | ||
{ | ||
return $this->enumClass; | ||
} | ||
|
||
public function getTagValueNode(): ParamTagValueNode|ReturnTagValueNode|VarTagValueNode | ||
{ | ||
return $this->tagValueNode; | ||
} | ||
} |