diff --git a/config/parameters.php b/config/parameters.php index f170aa7410b..fed8974c108 100644 --- a/config/parameters.php +++ b/config/parameters.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Rector\Core\Configuration\Option; -use Rector\Core\ValueObject\ProjectType; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; return static function (ContainerConfigurator $containerConfigurator): void { @@ -23,7 +22,6 @@ $parameters->set(Option::IMPORT_DOC_BLOCKS, true); $parameters->set(Option::PHP_VERSION_FEATURES, null); - $parameters->set(Option::PROJECT_TYPE, ProjectType::PROPRIETARY); $parameters->set(Option::NESTED_CHAIN_METHOD_CALL_LIMIT, 30); $parameters->set(Option::SKIP, []); diff --git a/rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/Fixture/assert_email.php.inc b/rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/Fixture/assert_email.php.inc deleted file mode 100644 index 29fdd273796..00000000000 --- a/rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/Fixture/assert_email.php.inc +++ /dev/null @@ -1,29 +0,0 @@ - ------ - diff --git a/rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/Fixture/assert_not_blank.php.inc b/rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/Fixture/assert_not_blank.php.inc deleted file mode 100644 index c144045270a..00000000000 --- a/rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/Fixture/assert_not_blank.php.inc +++ /dev/null @@ -1,37 +0,0 @@ - ------ - diff --git a/rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/Fixture/donot_reorder_annotation.php.inc b/rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/Fixture/donot_reorder_annotation.php.inc index 19b42390072..e790bbb53a9 100644 --- a/rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/Fixture/donot_reorder_annotation.php.inc +++ b/rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/Fixture/donot_reorder_annotation.php.inc @@ -4,12 +4,6 @@ namespace Rector\Tests\Php80\Rector\Class_\AnnotationToAttributeRector\FixtureAu use Doctrine\ORM\Mapping as ORM; -/** - * News - * - * @ORM\Table(name="news") - * @ORM\Entity(repositoryClass="DoctrineFixtureDemo\Repository\NewsRepository") - */ class News { /** @@ -17,7 +11,6 @@ class News * * @ORM\Column(name="id", type="bigint", nullable=false) * @ORM\Id - * @ORM\GeneratedValue(strategy="IDENTITY") */ private $id; /** @@ -42,11 +35,6 @@ namespace Rector\Tests\Php80\Rector\Class_\AnnotationToAttributeRector\FixtureAu use Doctrine\ORM\Mapping as ORM; -/** - * News - */ -#[\Doctrine\ORM\Mapping\Table(name: 'news')] -#[\Doctrine\ORM\Mapping\Entity(repositoryClass: 'DoctrineFixtureDemo\Repository\NewsRepository')] class News { /** @@ -54,7 +42,6 @@ class News */ #[\Doctrine\ORM\Mapping\Column(name: 'id', type: 'bigint', nullable: false)] #[\Doctrine\ORM\Mapping\Id] - #[\Doctrine\ORM\Mapping\GeneratedValue(strategy: 'IDENTITY')] private $id; /** * @var string diff --git a/rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/Fixture/multiple_same_attribute.php.inc b/rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/Fixture/multiple_same_attribute.php.inc deleted file mode 100644 index 8e12e7c5843..00000000000 --- a/rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/Fixture/multiple_same_attribute.php.inc +++ /dev/null @@ -1,31 +0,0 @@ - ------ - diff --git a/rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/FixtureAutoImported/donot_reorder_annotation.php.inc b/rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/FixtureAutoImported/donot_reorder_annotation.php.inc index 439fe17c40f..2424da60bcc 100644 --- a/rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/FixtureAutoImported/donot_reorder_annotation.php.inc +++ b/rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/FixtureAutoImported/donot_reorder_annotation.php.inc @@ -4,12 +4,6 @@ namespace Rector\Tests\Php80\Rector\Class_\AnnotationToAttributeRector\FixtureAu use Doctrine\ORM\Mapping as ORM; -/** - * News - * - * @ORM\Table(name="news") - * @ORM\Entity(repositoryClass="DoctrineFixtureDemo\Repository\NewsRepository") - */ class News { /** @@ -17,7 +11,6 @@ class News * * @ORM\Column(name="id", type="bigint", nullable=false) * @ORM\Id - * @ORM\GeneratedValue(strategy="IDENTITY") */ private $id; /** @@ -40,18 +33,10 @@ class News namespace Rector\Tests\Php80\Rector\Class_\AnnotationToAttributeRector\FixtureAutoImported; -use Doctrine\ORM\Mapping\Table; -use Doctrine\ORM\Mapping\Entity; use Doctrine\ORM\Mapping\Column; use Doctrine\ORM\Mapping\Id; -use Doctrine\ORM\Mapping\GeneratedValue; use Doctrine\ORM\Mapping as ORM; -/** - * News - */ -#[Table(name: 'news')] -#[Entity(repositoryClass: 'DoctrineFixtureDemo\Repository\NewsRepository')] class News { /** @@ -59,7 +44,6 @@ class News */ #[Column(name: 'id', type: 'bigint', nullable: false)] #[Id] - #[GeneratedValue(strategy: 'IDENTITY')] private $id; /** * @var string diff --git a/rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/config/configured_rule.php b/rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/config/configured_rule.php index b47ad42b84c..4d7432cca53 100644 --- a/rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/config/configured_rule.php +++ b/rules-tests/Php80/Rector/Class_/AnnotationToAttributeRector/config/configured_rule.php @@ -2,6 +2,7 @@ declare(strict_types=1); +use Rector\Php74\Rector\LNumber\AddLiteralSeparatorToNumberRector; use Rector\Php80\Rector\Class_\AnnotationToAttributeRector; use Rector\Php80\ValueObject\AnnotationToAttribute; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; @@ -19,19 +20,15 @@ new AnnotationToAttribute('Symfony\Component\Routing\Annotation\Route'), // symfony/validation - new AnnotationToAttribute('Symfony\Component\Validator\Constraints\Email',), new AnnotationToAttribute('Symfony\Component\Validator\Constraints\Range',), - new AnnotationToAttribute('Symfony\Component\Validator\Constraints\NotBlank',), - new AnnotationToAttribute('Symfony\Component\Validator\Constraints\Choice',), + new AnnotationToAttribute('Symfony\Component\Validator\Constraints\Choice'), - new AnnotationToAttribute('Doctrine\ORM\Mapping\Table'), - new AnnotationToAttribute('Doctrine\ORM\Mapping\Entity'), new AnnotationToAttribute('Doctrine\ORM\Mapping\Id'), - new AnnotationToAttribute('Doctrine\ORM\Mapping\GeneratedValue'), new AnnotationToAttribute('Doctrine\ORM\Mapping\Column'), - new AnnotationToAttribute('Doctrine\ORM\Mapping\ChangeTrackingPolicy'), new AnnotationToAttribute('Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter'), new AnnotationToAttribute('ApiPlatform\Core\Annotation\ApiResource'), ]), ]]); + + $services->set(AddLiteralSeparatorToNumberRector::class); }; diff --git a/rules-tests/Privatization/Rector/Property/PrivatizeLocalPropertyToPrivatePropertyRector/Fixture/skip_abstract.php.inc b/rules-tests/Privatization/Rector/Property/PrivatizeLocalPropertyToPrivatePropertyRector/Fixture/skip_abstract.php.inc new file mode 100644 index 00000000000..ac40efe0046 --- /dev/null +++ b/rules-tests/Privatization/Rector/Property/PrivatizeLocalPropertyToPrivatePropertyRector/Fixture/skip_abstract.php.inc @@ -0,0 +1,8 @@ +parameters(); - $parameters->set(Option::PROJECT_TYPE, ProjectType::OPEN_SOURCE); - - $services = $containerConfigurator->services(); - $services->set(PrivatizeLocalPropertyToPrivatePropertyRector::class); -}; diff --git a/rules/Php74/Rector/LNumber/AddLiteralSeparatorToNumberRector.php b/rules/Php74/Rector/LNumber/AddLiteralSeparatorToNumberRector.php index 533e5a5ae39..78b6c65f8e6 100644 --- a/rules/Php74/Rector/LNumber/AddLiteralSeparatorToNumberRector.php +++ b/rules/Php74/Rector/LNumber/AddLiteralSeparatorToNumberRector.php @@ -137,8 +137,14 @@ private function shouldSkip(Node $node, string $numericValueAsString): bool { /** @var int $startToken */ $startToken = $node->getAttribute(AttributeKey::START_TOKEN_POSITION); - /** @var File $file */ + $file = $node->getAttribute(AttributeKey::FILE); + + // new node + if (! $file instanceof File) { + return true; + } + $oldTokens = $file->getOldTokens(); foreach ($oldTokens[$startToken] as $token) { diff --git a/rules/Privatization/Rector/Property/PrivatizeLocalPropertyToPrivatePropertyRector.php b/rules/Privatization/Rector/Property/PrivatizeLocalPropertyToPrivatePropertyRector.php index 5f625a69982..84300933887 100644 --- a/rules/Privatization/Rector/Property/PrivatizeLocalPropertyToPrivatePropertyRector.php +++ b/rules/Privatization/Rector/Property/PrivatizeLocalPropertyToPrivatePropertyRector.php @@ -158,11 +158,7 @@ private function shouldSkipClass(ClassLike $classLike): bool return true; } - if ($classLike->isAbstract()) { - return true; - } - - return $this->isOpenSourceProjectType(); + return $classLike->isAbstract(); } private function shouldSkipProperty(Property $property): bool diff --git a/rules/TypeDeclaration/TypeInferer/PropertyTypeInferer/DoctrineColumnPropertyTypeInferer.php b/rules/TypeDeclaration/TypeInferer/PropertyTypeInferer/DoctrineColumnPropertyTypeInferer.php index 06f19cf2748..27d9d1cc537 100644 --- a/rules/TypeDeclaration/TypeInferer/PropertyTypeInferer/DoctrineColumnPropertyTypeInferer.php +++ b/rules/TypeDeclaration/TypeInferer/PropertyTypeInferer/DoctrineColumnPropertyTypeInferer.php @@ -29,7 +29,6 @@ final class DoctrineColumnPropertyTypeInferer implements PropertyTypeInfererInte /** * @var Type[] * - * @see \Doctrine\DBAL\Platforms\MySqlPlatform::initializeDoctrineTypeMappings() * @see https://www.doctrine-project.org/projects/doctrine-orm/en/2.6/reference/basic-mapping.html#doctrine-mapping-types */ private array $doctrineTypeToScalarType = []; diff --git a/src/Configuration/Option.php b/src/Configuration/Option.php index bb383675804..c3397536f1a 100644 --- a/src/Configuration/Option.php +++ b/src/Configuration/Option.php @@ -83,11 +83,6 @@ final class Option */ public const CACHE_DEBUG = 'cache-debug'; - /** - * @var string - */ - public const PROJECT_TYPE = 'project_type'; - /** * @var string */ diff --git a/src/Rector/AbstractRector.php b/src/Rector/AbstractRector.php index ba2d32a9f4a..b91b422d5c1 100644 --- a/src/Rector/AbstractRector.php +++ b/src/Rector/AbstractRector.php @@ -23,7 +23,6 @@ use Rector\ChangesReporting\ValueObject\RectorWithLineChange; use Rector\Core\Application\FileSystem\RemovedAndAddedFilesCollector; use Rector\Core\Configuration\CurrentNodeProvider; -use Rector\Core\Configuration\Option; use Rector\Core\Contract\Rector\PhpRectorInterface; use Rector\Core\Exception\ShouldNotHappenException; use Rector\Core\Exclusion\ExclusionManager; @@ -38,7 +37,6 @@ use Rector\Core\Provider\CurrentFileProvider; use Rector\Core\Validation\InfiniteLoopValidator; use Rector\Core\ValueObject\Application\File; -use Rector\Core\ValueObject\ProjectType; use Rector\NodeCollector\NodeCollector\NodeRepository; use Rector\NodeNameResolver\NodeNameResolver; use Rector\NodeRemoval\NodeRemover; @@ -397,12 +395,6 @@ protected function unwrapStmts(array $stmts, Node $node): void } } - protected function isOpenSourceProjectType(): bool - { - $projectType = $this->parameterProvider->provideStringParameter(Option::PROJECT_TYPE); - return $projectType === ProjectType::OPEN_SOURCE; - } - /** * @param Arg[] $currentArgs * @param Arg[] $appendingArgs diff --git a/src/ValueObject/ProjectType.php b/src/ValueObject/ProjectType.php deleted file mode 100644 index 4aaf383680c..00000000000 --- a/src/ValueObject/ProjectType.php +++ /dev/null @@ -1,18 +0,0 @@ -