[PHP 8.1] Move ConstantListClassToEnumRector to PHP 8.1 (#2444)

This commit is contained in:
Tomas Votruba 2022-06-06 17:48:45 +02:00 committed by GitHub
parent ddd88a8800
commit 0eba231b07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 62 additions and 62 deletions

View File

@ -8273,7 +8273,7 @@ Change simple property init and assign to constructor promotion
Upgrade constant list classes to full blown enum
- class: [`Rector\Php80\Rector\Class_\ConstantListClassToEnumRector`](../rules/Php80/Rector/Class_/ConstantListClassToEnumRector.php)
- class: [`Rector\Php81\Rector\Class_\ConstantListClassToEnumRector`](../rules/Php80/Rector/Class_/ConstantListClassToEnumRector.php)
```diff
-class Direction

View File

@ -705,13 +705,13 @@ parameters:
message: '#Class has a static method must so must contains "Static" in its name#'
path: rules/CodingStyle/Enum/PreferenceSelfThis.php
# optional rule for PHP 8.0
- '#Register "Rector\\Php80\\Rector\\Class_\\ConstantListClassToEnumRector" service to "php80\.php" config set#'
- '#Rule Rector\\Php80\\Rector\\Class_\\ConstantListClassToEnumRector must implements Rector\\VersionBonding\\Contract\\MinPhpVersionInterface#'
# optional rule for PHP 8.1
- '#Register "Rector\\Php81\\Rector\\Class_\\ConstantListClassToEnumRector" service to "php81\.php" config set#'
- '#Rule Rector\\Php81\\Rector\\Class_\\ConstantListClassToEnumRector must implements Rector\\VersionBonding\\Contract\\MinPhpVersionInterface#'
- '#Register "Rector\\DowngradePhp80\\Rector\\Enum_\\DowngradeEnumToConstantListClassRector" service to "downgrade\-php80\.php" config set#'
-
message: '#Method "refactor(Params|Return)\(\)" returns bool type, so the name should start with is/has/was#'
path: rules/Php80/Rector/Class_/ConstantListClassToEnumRector.php
path: rules/Php81/Rector/Class_/ConstantListClassToEnumRector.php
# known values
-

View File

@ -1,28 +0,0 @@
<?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;
}
?>

View File

@ -2,7 +2,7 @@
declare(strict_types=1);
namespace Rector\Tests\Php80\Rector\Class_\ConstantListClassToEnumRector;
namespace Rector\Tests\Php81\Rector\Class_\ConstantListClassToEnumRector;
use Iterator;
use Rector\Testing\PHPUnit\AbstractRectorTestCase;

View File

@ -1,8 +1,8 @@
<?php
namespace Rector\Tests\Php80\Rector\Class_\ConstantListClassToEnumRector\Fixture;
namespace Rector\Tests\Php81\Rector\Class_\ConstantListClassToEnumRector\Fixture;
use Rector\Tests\Php80\Rector\Class_\ConstantListClassToEnumRector\Source\Gear;
use Rector\Tests\Php81\Rector\Class_\ConstantListClassToEnumRector\Source\Gear;
final class ChangeParamType
{
@ -18,13 +18,13 @@ final class ChangeParamType
-----
<?php
namespace Rector\Tests\Php80\Rector\Class_\ConstantListClassToEnumRector\Fixture;
namespace Rector\Tests\Php81\Rector\Class_\ConstantListClassToEnumRector\Fixture;
use Rector\Tests\Php80\Rector\Class_\ConstantListClassToEnumRector\Source\Gear;
use Rector\Tests\Php81\Rector\Class_\ConstantListClassToEnumRector\Source\Gear;
final class ChangeParamType
{
public function changeGear(\Rector\Tests\Php80\Rector\Class_\ConstantListClassToEnumRector\Source\Gear $gear)
public function changeGear(\Rector\Tests\Php81\Rector\Class_\ConstantListClassToEnumRector\Source\Gear $gear)
{
}
}

View File

@ -1,8 +1,8 @@
<?php
namespace Rector\Tests\Php80\Rector\Class_\ConstantListClassToEnumRector\Fixture;
namespace Rector\Tests\Php81\Rector\Class_\ConstantListClassToEnumRector\Fixture;
use Rector\Tests\Php80\Rector\Class_\ConstantListClassToEnumRector\Source\Gear;
use Rector\Tests\Php81\Rector\Class_\ConstantListClassToEnumRector\Source\Gear;
final class ChangeReturnType
{
@ -19,13 +19,13 @@ final class ChangeReturnType
-----
<?php
namespace Rector\Tests\Php80\Rector\Class_\ConstantListClassToEnumRector\Fixture;
namespace Rector\Tests\Php81\Rector\Class_\ConstantListClassToEnumRector\Fixture;
use Rector\Tests\Php80\Rector\Class_\ConstantListClassToEnumRector\Source\Gear;
use Rector\Tests\Php81\Rector\Class_\ConstantListClassToEnumRector\Source\Gear;
final class ChangeReturnType
{
public function changeGear(): \Rector\Tests\Php80\Rector\Class_\ConstantListClassToEnumRector\Source\Gear
public function changeGear(): \Rector\Tests\Php81\Rector\Class_\ConstantListClassToEnumRector\Source\Gear
{
return Gear::FIRST;
}

View File

@ -0,0 +1,28 @@
<?php
namespace Rector\Tests\Php81\Rector\Class_\ConstantListClassToEnumRector\Fixture;
use Rector\Tests\Php81\Rector\Class_\ConstantListClassToEnumRector\Source\Gear;
final class EnumTypeProperty
{
/**
* @var Gear::* $gear
*/
private $gear;
}
?>
-----
<?php
namespace Rector\Tests\Php81\Rector\Class_\ConstantListClassToEnumRector\Fixture;
use Rector\Tests\Php81\Rector\Class_\ConstantListClassToEnumRector\Source\Gear;
final class EnumTypeProperty
{
private \Rector\Tests\Php81\Rector\Class_\ConstantListClassToEnumRector\Source\Gear $gear;
}
?>

View File

@ -1,8 +1,8 @@
<?php
namespace Rector\Tests\Php80\Rector\Class_\ConstantListClassToEnumRector\Fixture;
namespace Rector\Tests\Php81\Rector\Class_\ConstantListClassToEnumRector\Fixture;
use Rector\Tests\Php80\Rector\Class_\ConstantListClassToEnumRector\Source\Gear;
use Rector\Tests\Php81\Rector\Class_\ConstantListClassToEnumRector\Source\Gear;
final class MultipleParamsChange
{
@ -20,9 +20,9 @@ final class MultipleParamsChange
-----
<?php
namespace Rector\Tests\Php80\Rector\Class_\ConstantListClassToEnumRector\Fixture;
namespace Rector\Tests\Php81\Rector\Class_\ConstantListClassToEnumRector\Fixture;
use Rector\Tests\Php80\Rector\Class_\ConstantListClassToEnumRector\Source\Gear;
use Rector\Tests\Php81\Rector\Class_\ConstantListClassToEnumRector\Source\Gear;
final class MultipleParamsChange
{
@ -30,7 +30,7 @@ final class MultipleParamsChange
* @param string $carType
* @param int $speed
*/
public function changeGear($carType, \Rector\Tests\Php80\Rector\Class_\ConstantListClassToEnumRector\Source\Gear $gear, $speed)
public function changeGear($carType, \Rector\Tests\Php81\Rector\Class_\ConstantListClassToEnumRector\Source\Gear $gear, $speed)
{
}
}

View File

@ -1,6 +1,6 @@
<?php
namespace Rector\Tests\Php80\Rector\Class_\ConstantListClassToEnumRector\Fixture;
namespace Rector\Tests\Php81\Rector\Class_\ConstantListClassToEnumRector\Fixture;
final class SkipAlsoOtherElements
{

View File

@ -1,6 +1,6 @@
<?php
namespace Rector\Tests\Php80\Rector\Class_\ConstantListClassToEnumRector\Fixture;
namespace Rector\Tests\Php81\Rector\Class_\ConstantListClassToEnumRector\Fixture;
final class SkipDifferentType
{

View File

@ -1,6 +1,6 @@
<?php
namespace Rector\Tests\Php80\Rector\Class_\ConstantListClassToEnumRector\Fixture;
namespace Rector\Tests\Php81\Rector\Class_\ConstantListClassToEnumRector\Fixture;
final class SkipNonPublicConst
{

View File

@ -1,6 +1,6 @@
<?php
namespace Rector\Tests\Php80\Rector\Class_\ConstantListClassToEnumRector\Fixture;
namespace Rector\Tests\Php81\Rector\Class_\ConstantListClassToEnumRector\Fixture;
final class SkipNonScalarTypes
{

View File

@ -1,6 +1,6 @@
<?php
namespace Rector\Tests\Php80\Rector\Class_\ConstantListClassToEnumRector\Fixture;
namespace Rector\Tests\Php81\Rector\Class_\ConstantListClassToEnumRector\Fixture;
final class SkipUnknownClass
{

View File

@ -1,6 +1,6 @@
<?php
namespace Rector\Tests\Php80\Rector\Class_\ConstantListClassToEnumRector\Fixture;
namespace Rector\Tests\Php81\Rector\Class_\ConstantListClassToEnumRector\Fixture;
class Direction
{
@ -13,7 +13,7 @@ class Direction
-----
<?php
namespace Rector\Tests\Php80\Rector\Class_\ConstantListClassToEnumRector\Fixture;
namespace Rector\Tests\Php81\Rector\Class_\ConstantListClassToEnumRector\Fixture;
enum Direction : string
{

View File

@ -2,7 +2,7 @@
declare(strict_types=1);
namespace Rector\Tests\Php80\Rector\Class_\ConstantListClassToEnumRector\Source;
namespace Rector\Tests\Php81\Rector\Class_\ConstantListClassToEnumRector\Source;
final class Gear
{

View File

@ -3,7 +3,7 @@
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\Php80\Rector\Class_\ConstantListClassToEnumRector;
use Rector\Php81\Rector\Class_\ConstantListClassToEnumRector;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->rule(ConstantListClassToEnumRector::class);

View File

@ -2,7 +2,7 @@
declare(strict_types=1);
namespace Rector\Php80\NodeAnalyzer;
namespace Rector\Php81\NodeAnalyzer;
use PhpParser\Node\Scalar;
use PhpParser\Node\Stmt\Class_;

View File

@ -2,7 +2,7 @@
declare(strict_types=1);
namespace Rector\Php80\Rector\Class_;
namespace Rector\Php81\Rector\Class_;
use PhpParser\Node;
use PhpParser\Node\Name\FullyQualified;
@ -16,15 +16,15 @@ use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
use Rector\BetterPhpDocParser\PhpDocManipulator\PhpDocTagRemover;
use Rector\Core\Rector\AbstractRector;
use Rector\Core\Reflection\ReflectionResolver;
use Rector\Php80\NodeAnalyzer\EnumConstListClassDetector;
use Rector\Php80\NodeAnalyzer\EnumParamAnalyzer;
use Rector\Php80\ValueObject\ClassNameAndTagValueNode;
use Rector\Php81\NodeAnalyzer\EnumConstListClassDetector;
use Rector\Php81\NodeFactory\EnumFactory;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
/**
* @see \Rector\Tests\Php80\Rector\Class_\ConstantListClassToEnumRector\ConstantListClassToEnumRectorTest
* @see \Rector\Tests\Php81\Rector\Class_\ConstantListClassToEnumRector\ConstantListClassToEnumRectorTest
*/
final class ConstantListClassToEnumRector extends AbstractRector
{