diff --git a/composer.json b/composer.json index ab414afa35c..6dc263c13c7 100644 --- a/composer.json +++ b/composer.json @@ -86,10 +86,7 @@ "Rector\\TypeDeclaration\\": "packages/TypeDeclaration/src", "Rector\\Utils\\DocumentationGenerator\\": "utils/DocumentationGenerator/src", "Rector\\Utils\\RectorGenerator\\": "utils/RectorGenerator/src" - }, - "classmap": [ - "stubs" - ] + } }, "autoload-dev": { "psr-4": { diff --git a/packages/Doctrine/src/Collector/UuidMigrationDataCollector.php b/packages/Doctrine/src/Collector/UuidMigrationDataCollector.php index d6630d54de7..26c03964d5d 100644 --- a/packages/Doctrine/src/Collector/UuidMigrationDataCollector.php +++ b/packages/Doctrine/src/Collector/UuidMigrationDataCollector.php @@ -2,39 +2,58 @@ namespace Rector\Doctrine\Collector; +use Rector\DoctrinePhpDocParser\Contract\Ast\PhpDoc\DoctrineRelationTagValueNodeInterface; +use Rector\DoctrinePhpDocParser\Contract\Ast\PhpDoc\ToManyTagNodeInterface; + final class UuidMigrationDataCollector { /** - * @var mixed[] + * @var string[][][] */ - private $propertiesByClass = []; + private $columnPropertiesByClass = []; - public function addClassAndProperty(string $class, string $property): void + /** + * @var string[][][][] + */ + private $relationPropertiesByClass = []; + + public function addClassAndColumnProperty(string $class, string $propertyName): void { - $this->propertiesByClass[$class]['properties'][] = $property; + $this->columnPropertiesByClass[$class]['properties'][] = $propertyName; } public function addClassToManyRelationProperty( string $class, string $oldPropertyName, - string $uuidPropertyName + string $uuidPropertyName, + DoctrineRelationTagValueNodeInterface $doctrineRelationTagValueNode ): void { - $this->propertiesByClass[$class]['to_many_relations'][] = [ + $kind = $this->resolveKind($doctrineRelationTagValueNode); + + $this->relationPropertiesByClass[$class][$kind][] = [ 'property_name' => $oldPropertyName, 'uuid_property_name' => $uuidPropertyName, ]; } - public function addClassToOneRelationProperty(string $class, string $property): void - { - $this->propertiesByClass[$class]['to_one_relations'][] = $property; - } - /** * @return string[][][] */ - public function getPropertiesByClass(): array + public function getColumnPropertiesByClass(): array { - return $this->propertiesByClass; + return $this->columnPropertiesByClass; + } + + /** + * @return string[][][][] + */ + public function getRelationPropertiesByClass(): array + { + return $this->relationPropertiesByClass; + } + + private function resolveKind(DoctrineRelationTagValueNodeInterface $doctrineRelationTagValueNode): string + { + return $doctrineRelationTagValueNode instanceof ToManyTagNodeInterface ? 'to_many_relations' : 'to_one_relations'; } } diff --git a/packages/Doctrine/src/Extension/ReportEntitiesWithAddedPropertiesFinishExtension.php b/packages/Doctrine/src/Extension/ReportEntitiesWithAddedPropertiesFinishExtension.php index 6367498567a..877e6f44268 100644 --- a/packages/Doctrine/src/Extension/ReportEntitiesWithAddedPropertiesFinishExtension.php +++ b/packages/Doctrine/src/Extension/ReportEntitiesWithAddedPropertiesFinishExtension.php @@ -30,23 +30,31 @@ final class ReportEntitiesWithAddedPropertiesFinishExtension implements Finishin public function run(): void { - $propertiesByClass = $this->uuidMigrationDataCollector->getPropertiesByClass(); - if ($propertiesByClass === []) { + $this->generatePropertiesJsonWithFileName( + 'uuid-migration-new-column-properties.json', + $this->uuidMigrationDataCollector->getColumnPropertiesByClass() + ); + + $this->generatePropertiesJsonWithFileName( + 'uuid-migration-new-relation-properties.json', + $this->uuidMigrationDataCollector->getRelationPropertiesByClass() + ); + } + + /** + * @param mixed[] $data + */ + private function generatePropertiesJsonWithFileName(string $fileName, array $data): void + { + if ($data === []) { return; } - $data = [ - 'title' => 'Entities with new properties', - 'added_properties_by_class' => $propertiesByClass, - ]; + $jsonContent = Json::encode(['new_columns_by_class' => $data], Json::PRETTY); - $jsonContent = Json::encode($data, Json::PRETTY); - - $filePath = getcwd() . '/uuid-migration.json'; + $filePath = getcwd() . '/' . $fileName; FileSystem::write($filePath, $jsonContent); - $this->symfonyStyle->warning( - 'See freshly created "uuid-migration.json" file for changes on entities and further SQL migration steps' - ); + $this->symfonyStyle->warning(sprintf('See freshly created "%s" file for changes on entities', $fileName)); } } diff --git a/packages/Doctrine/src/PhpDocParser/Ast/PhpDoc/PhpDocTagNodeFactory.php b/packages/Doctrine/src/PhpDocParser/Ast/PhpDoc/PhpDocTagNodeFactory.php index 1dd1f87c1ca..e3f04e31c8d 100644 --- a/packages/Doctrine/src/PhpDocParser/Ast/PhpDoc/PhpDocTagNodeFactory.php +++ b/packages/Doctrine/src/PhpDocParser/Ast/PhpDoc/PhpDocTagNodeFactory.php @@ -36,9 +36,8 @@ final class PhpDocTagNodeFactory public function createVarTagUuidInterface(): PhpDocTagNode { - $varTagValueNode = new VarTagValueNode(new IdentifierTypeNode( - '\\' . DoctrineClass::RAMSEY_UUID_INTERFACE - ), '', ''); + $identifierTypeNode = new IdentifierTypeNode('\\' . DoctrineClass::RAMSEY_UUID_INTERFACE); + $varTagValueNode = new VarTagValueNode($identifierTypeNode, '', ''); return new PhpDocTagNode('@var', $varTagValueNode); } @@ -78,12 +77,14 @@ final class PhpDocTagNodeFactory public function createJoinTableTagNode(Property $property): PhpDocTagNode { - $joinTableName = $this->joinTableNameResolver->resolveManyToManyTableNameForProperty($property); - $uuidJoinTable = $joinTableName . '_uuid'; + $uuidJoinTable = $this->joinTableNameResolver->resolveManyToManyUuidTableNameForProperty($property); - $joinTableTagValueNode = new JoinTableTagValueNode($uuidJoinTable, null, [ - new JoinColumnTagValueNode(null, 'uuid'), - ], [new JoinColumnTagValueNode(null, 'uuid')]); + $joinTableTagValueNode = new JoinTableTagValueNode( + $uuidJoinTable, + null, + [new JoinColumnTagValueNode(null, 'uuid')], + [new JoinColumnTagValueNode(null, 'uuid')] + ); return new AttributeAwarePhpDocTagNode(JoinTableTagValueNode::SHORT_NAME, $joinTableTagValueNode); } diff --git a/packages/Doctrine/src/Rector/Class_/AddUuidMirrorForRelationPropertyRector.php b/packages/Doctrine/src/Rector/Class_/AddUuidMirrorForRelationPropertyRector.php index 875c69464e5..44af9d549a7 100644 --- a/packages/Doctrine/src/Rector/Class_/AddUuidMirrorForRelationPropertyRector.php +++ b/packages/Doctrine/src/Rector/Class_/AddUuidMirrorForRelationPropertyRector.php @@ -96,7 +96,7 @@ final class AddUuidMirrorForRelationPropertyRector extends AbstractRector */ private function createMirrorNullable(Property $property): Property { - $oldProperytName = $this->getName($property); + $oldPropertyName = $this->getName($property); $propertyWithUuid = clone $property; @@ -105,11 +105,11 @@ final class AddUuidMirrorForRelationPropertyRector extends AbstractRector // name must be changed after the doc comment update, because the reflection annotation needed for update of doc comment // would miss non existing *Uuid property - $uuidPropertyName = $oldProperytName . 'Uuid'; + $uuidPropertyName = $oldPropertyName . 'Uuid'; $newPropertyProperty = new PropertyProperty(new VarLikeIdentifier($uuidPropertyName)); $propertyWithUuid->props = [$newPropertyProperty]; - $this->addNewPropertyToCollector($property, $oldProperytName, $uuidPropertyName); + $this->addNewPropertyToCollector($property, $oldPropertyName, $uuidPropertyName); return $propertyWithUuid; } @@ -186,6 +186,10 @@ final class AddUuidMirrorForRelationPropertyRector extends AbstractRector return true; } + if (! property_exists($targetEntity, 'uuid')) { + return true; + } + return false; } @@ -200,14 +204,11 @@ final class AddUuidMirrorForRelationPropertyRector extends AbstractRector /** @var DoctrineRelationTagValueNodeInterface $doctrineRelationTagValueNode */ $doctrineRelationTagValueNode = $this->getDoctrineRelationTagValueNode($property); - if ($doctrineRelationTagValueNode instanceof ToManyTagNodeInterface) { - $this->uuidMigrationDataCollector->addClassToManyRelationProperty( - $className, - $oldPropertyName, - $uuidPropertyName - ); - } elseif ($doctrineRelationTagValueNode instanceof ToOneTagNodeInterface) { - $this->uuidMigrationDataCollector->addClassToOneRelationProperty($className, $uuidPropertyName); - } + $this->uuidMigrationDataCollector->addClassToManyRelationProperty( + $className, + $oldPropertyName, + $uuidPropertyName, + $doctrineRelationTagValueNode + ); } } diff --git a/packages/Doctrine/src/Rector/Class_/AddUuidToEntityWhereMissingRector.php b/packages/Doctrine/src/Rector/Class_/AddUuidToEntityWhereMissingRector.php index fe96e0fee90..c488556350a 100644 --- a/packages/Doctrine/src/Rector/Class_/AddUuidToEntityWhereMissingRector.php +++ b/packages/Doctrine/src/Rector/Class_/AddUuidToEntityWhereMissingRector.php @@ -86,7 +86,7 @@ final class AddUuidToEntityWhereMissingRector extends AbstractRector /** @var string $class */ $class = $this->getName($node); - $this->uuidMigrationDataCollector->addClassAndProperty($class, 'uuid'); + $this->uuidMigrationDataCollector->addClassAndColumnProperty($class, 'uuid'); return $node; } diff --git a/packages/Doctrine/src/Uuid/JoinTableNameResolver.php b/packages/Doctrine/src/Uuid/JoinTableNameResolver.php index 6f8e5655d08..23de3a6cc82 100644 --- a/packages/Doctrine/src/Uuid/JoinTableNameResolver.php +++ b/packages/Doctrine/src/Uuid/JoinTableNameResolver.php @@ -3,11 +3,9 @@ namespace Rector\Doctrine\Uuid; use Nette\Utils\Strings; -use PhpParser\Node\Stmt\Class_; use PhpParser\Node\Stmt\Property; use Rector\Doctrine\PhpDocParser\DoctrineDocBlockResolver; use Rector\Exception\ShouldNotHappenException; -use Rector\NodeContainer\ParsedNodesByType; use Rector\NodeTypeResolver\Node\AttributeKey; final class JoinTableNameResolver @@ -17,42 +15,28 @@ final class JoinTableNameResolver */ private $doctrineDocBlockResolver; - /** - * @var ParsedNodesByType - */ - private $parsedNodesByType; - - public function __construct( - DoctrineDocBlockResolver $doctrineDocBlockResolver, - ParsedNodesByType $parsedNodesByType - ) { + public function __construct(DoctrineDocBlockResolver $doctrineDocBlockResolver) + { $this->doctrineDocBlockResolver = $doctrineDocBlockResolver; - $this->parsedNodesByType = $parsedNodesByType; } /** - * Guessed many-to-many table name like: first_table_second_table + * Create many-to-many table name like: "first_table_second_table_uuid" */ - public function resolveManyToManyTableNameForProperty(Property $property): string + public function resolveManyToManyUuidTableNameForProperty(Property $property): string { - /** @var Class_ $currentClass */ - $currentClass = $property->getAttribute(AttributeKey::CLASS_NODE); - $currentTableName = $this->resolveTableNameFromClass($currentClass); + /** @var string $className */ + $className = $property->getAttribute(AttributeKey::CLASS_NAME); + $currentTableName = $this->resolveShortClassName($className); $targetEntity = $this->doctrineDocBlockResolver->getTargetEntity($property); if ($targetEntity === null) { throw new ShouldNotHappenException(__METHOD__); } - $targetEntityClass = $this->parsedNodesByType->findClass($targetEntity); - if ($targetEntityClass === null) { - // dummy fallback - $targetTableName = $this->resolveShortClassName($targetEntity); - } else { - $targetTableName = $this->resolveTableNameFromClass($targetEntityClass); - } + $targetTableName = $this->resolveShortClassName($targetEntity); - return strtolower($currentTableName . '_' . $targetTableName); + return strtolower($currentTableName . '_' . $targetTableName) . '_uuid'; } private function resolveShortClassName(string $currentClass): string @@ -63,20 +47,4 @@ final class JoinTableNameResolver return (string) Strings::after($currentClass, '\\', -1); } - - private function resolveTableNameFromClass(Class_ $class): string - { - $tableTagValueNode = $this->doctrineDocBlockResolver->getDoctrineTableTagValueNode($class); - if ($tableTagValueNode !== null) { - $tableName = $tableTagValueNode->getName(); - if ($tableName !== null) { - return $tableName; - } - } - - /** @var string $className */ - $className = $class->getAttribute(AttributeKey::CLASS_NAME); - - return $this->resolveShortClassName($className); - } } diff --git a/packages/Doctrine/tests/Rector/Class_/AddUuidMirrorForRelationPropertyRector/AddUuidMirrorForRelationPropertyRectorTest.php b/packages/Doctrine/tests/Rector/Class_/AddUuidMirrorForRelationPropertyRector/AddUuidMirrorForRelationPropertyRectorTest.php index 438964982a2..d8a1c5126e6 100644 --- a/packages/Doctrine/tests/Rector/Class_/AddUuidMirrorForRelationPropertyRector/AddUuidMirrorForRelationPropertyRectorTest.php +++ b/packages/Doctrine/tests/Rector/Class_/AddUuidMirrorForRelationPropertyRector/AddUuidMirrorForRelationPropertyRectorTest.php @@ -23,6 +23,7 @@ final class AddUuidMirrorForRelationPropertyRectorTest extends AbstractRectorTes yield [__DIR__ . '/Fixture/to_one.php.inc']; yield [__DIR__ . '/Fixture/to_many.php.inc']; yield [__DIR__ . '/Fixture/skip_already_added.php.inc']; + yield [__DIR__ . '/Fixture/skip_to_many_without_target_entity_uuid.php.inc']; } protected function getRectorClass(): string diff --git a/packages/Doctrine/tests/Rector/Class_/AddUuidMirrorForRelationPropertyRector/Fixture/skip_to_many_without_target_entity_uuid.php.inc b/packages/Doctrine/tests/Rector/Class_/AddUuidMirrorForRelationPropertyRector/Fixture/skip_to_many_without_target_entity_uuid.php.inc new file mode 100644 index 00000000000..88162413f71 --- /dev/null +++ b/packages/Doctrine/tests/Rector/Class_/AddUuidMirrorForRelationPropertyRector/Fixture/skip_to_many_without_target_entity_uuid.php.inc @@ -0,0 +1,31 @@ + @@ -50,7 +52,7 @@ class ToMany private $amenity; /** * @ORM\ManyToMany(targetEntity="Rector\Doctrine\Tests\Rector\Class_\AddUuidMirrorForRelationPropertyRector\Fixture\FooEntity", cascade={"persist", "merge"}) - * @ORM\JoinTable (name="wohoo_fooentity_uuid", joinColumns={@ORM\JoinColumn(referencedColumnName="uuid")}, inverseJoinColumns={@ORM\JoinColumn(referencedColumnName="uuid")}) + * @ORM\JoinTable (name="tomany_fooentity_uuid", joinColumns={@ORM\JoinColumn(referencedColumnName="uuid")}, inverseJoinColumns={@ORM\JoinColumn(referencedColumnName="uuid")}) */ private $amenityUuid; } @@ -67,6 +69,8 @@ class FooEntity * @ORM\GeneratedValue(strategy="AUTO") */ private $id; + + private $uuid; } ?> diff --git a/packages/Doctrine/tests/Rector/Class_/AddUuidMirrorForRelationPropertyRector/Fixture/to_one.php.inc b/packages/Doctrine/tests/Rector/Class_/AddUuidMirrorForRelationPropertyRector/Fixture/to_one.php.inc index 490b8603d22..f40ecb0eb57 100644 --- a/packages/Doctrine/tests/Rector/Class_/AddUuidMirrorForRelationPropertyRector/Fixture/to_one.php.inc +++ b/packages/Doctrine/tests/Rector/Class_/AddUuidMirrorForRelationPropertyRector/Fixture/to_one.php.inc @@ -28,6 +28,8 @@ class AnotherEntity * @ORM\GeneratedValue(strategy="AUTO") */ private $id; + + private $uuid; } ?> @@ -67,6 +69,8 @@ class AnotherEntity * @ORM\GeneratedValue(strategy="AUTO") */ private $id; + + private $uuid; } ?> diff --git a/packages/PHPUnit/src/Rector/Class_/ArrayArgumentInTestToDataProviderRector.php b/packages/PHPUnit/src/Rector/Class_/ArrayArgumentInTestToDataProviderRector.php index 571c557a88e..8b89e1aed07 100644 --- a/packages/PHPUnit/src/Rector/Class_/ArrayArgumentInTestToDataProviderRector.php +++ b/packages/PHPUnit/src/Rector/Class_/ArrayArgumentInTestToDataProviderRector.php @@ -32,6 +32,8 @@ use Rector\RectorDefinition\RectorDefinition; /** * @see \Rector\PHPUnit\Tests\Rector\Class_\ArrayArgumentInTestToDataProviderRector\ArrayArgumentInTestToDataProviderRectorTest + * + * @see why → https://blog.martinhujer.cz/how-to-use-data-providers-in-phpunit/ */ final class ArrayArgumentInTestToDataProviderRector extends AbstractPHPUnitRector { diff --git a/phpstan.neon b/phpstan.neon index 85f9c63d9fa..db6e11cb734 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -10,6 +10,9 @@ parameters: reportUnmatchedIgnoredErrors: false level: max + autoload_directories: + - stubs + excludes_analyse: # complex printer - "packages/ContributorTools/src/Command/DumpNodesCommand.php" diff --git a/src/Application/FileProcessor.php b/src/Application/FileProcessor.php index 4ee046a6d1c..419f442b2dd 100644 --- a/src/Application/FileProcessor.php +++ b/src/Application/FileProcessor.php @@ -2,6 +2,7 @@ namespace Rector\Application; +use Nette\Loaders\RobotLoader; use PhpParser\Lexer; use PhpParser\Node; use Rector\Exception\ShouldNotHappenException; @@ -49,6 +50,11 @@ final class FileProcessor */ private $currentFileInfoProvider; + /** + * @var bool + */ + private $areStubsLoaded = false; + public function __construct( FormatPerservingPrinter $formatPerservingPrinter, Parser $parser, @@ -108,6 +114,8 @@ final class FileProcessor public function refactor(SmartFileInfo $smartFileInfo): void { + $this->loadStubs(); + $this->makeSureFileIsParsed($smartFileInfo); [$newStmts, $oldStmts, $oldTokens] = $this->tokensByFilePath[$smartFileInfo->getRealPath()]; @@ -149,4 +157,24 @@ final class FileProcessor self::class . '::parseFileInfoToLocalCache()' )); } + + /** + * Load stubs after composer autoload is loaded + rector "process " is loaded, + * so it is loaded only if the classes are really missing + */ + private function loadStubs(): void + { + if ($this->areStubsLoaded) { + return; + } + + $stubDirectory = __DIR__ . '/../../stubs'; + + $robotLoader = new RobotLoader(); + $robotLoader->addDirectory($stubDirectory); + $robotLoader->setTempDirectory(sys_get_temp_dir() . '/rector_stubs'); + $robotLoader->register(); + + $this->areStubsLoaded = true; + } } diff --git a/stubs/Doctrine/Annotation.php b/stubs/Doctrine/ORM/Mapping/Annotation.php similarity index 100% rename from stubs/Doctrine/Annotation.php rename to stubs/Doctrine/ORM/Mapping/Annotation.php diff --git a/stubs/Doctrine/Column.php b/stubs/Doctrine/ORM/Mapping/Column.php similarity index 90% rename from stubs/Doctrine/Column.php rename to stubs/Doctrine/ORM/Mapping/Column.php index 4f0b8088516..dbf161f0786 100644 --- a/stubs/Doctrine/Column.php +++ b/stubs/Doctrine/ORM/Mapping/Column.php @@ -2,7 +2,7 @@ namespace Doctrine\ORM\Mapping; -if (interface_exists('Doctrine\ORM\Mapping\Column')) { +if (class_exists('Doctrine\ORM\Mapping\Column')) { return; } @@ -10,7 +10,7 @@ if (interface_exists('Doctrine\ORM\Mapping\Column')) { * @Annotation * @Target({"PROPERTY","ANNOTATION"}) */ -final class Column implements Annotation +class Column implements Annotation { /** * @var string diff --git a/stubs/Doctrine/Entity.php b/stubs/Doctrine/ORM/Mapping/Entity.php similarity index 70% rename from stubs/Doctrine/Entity.php rename to stubs/Doctrine/ORM/Mapping/Entity.php index f0d00f3f3d4..63c8b40cf8e 100644 --- a/stubs/Doctrine/Entity.php +++ b/stubs/Doctrine/ORM/Mapping/Entity.php @@ -2,7 +2,7 @@ namespace Doctrine\ORM\Mapping; -if (interface_exists('Doctrine\ORM\Mapping\Entity')) { +if (class_exists('Doctrine\ORM\Mapping\Entity')) { return; } @@ -10,7 +10,7 @@ if (interface_exists('Doctrine\ORM\Mapping\Entity')) { * @Annotation * @Target("CLASS") */ -final class Entity implements Annotation +class Entity implements Annotation { /** * @var string diff --git a/stubs/Doctrine/Empty/GeneratedValue.php b/stubs/Doctrine/ORM/Mapping/GeneratedValue.php similarity index 100% rename from stubs/Doctrine/Empty/GeneratedValue.php rename to stubs/Doctrine/ORM/Mapping/GeneratedValue.php diff --git a/stubs/Doctrine/Id.php b/stubs/Doctrine/ORM/Mapping/Id.php similarity index 54% rename from stubs/Doctrine/Id.php rename to stubs/Doctrine/ORM/Mapping/Id.php index 24609c2d483..02f5ab445c4 100644 --- a/stubs/Doctrine/Id.php +++ b/stubs/Doctrine/ORM/Mapping/Id.php @@ -2,7 +2,7 @@ namespace Doctrine\ORM\Mapping; -if (interface_exists('Doctrine\ORM\Mapping\Id')) { +if (class_exists('Doctrine\ORM\Mapping\Id')) { return; } @@ -10,6 +10,6 @@ if (interface_exists('Doctrine\ORM\Mapping\Id')) { * @Annotation * @Target("PROPERTY") */ -final class Id implements Annotation +class Id implements Annotation { } diff --git a/stubs/Doctrine/Empty/InheritanceType.php b/stubs/Doctrine/ORM/Mapping/InheritanceType.php similarity index 100% rename from stubs/Doctrine/Empty/InheritanceType.php rename to stubs/Doctrine/ORM/Mapping/InheritanceType.php diff --git a/stubs/Doctrine/JoinColumn.php b/stubs/Doctrine/ORM/Mapping/JoinColumn.php similarity index 85% rename from stubs/Doctrine/JoinColumn.php rename to stubs/Doctrine/ORM/Mapping/JoinColumn.php index 17d01e0b6cb..d46d4679285 100644 --- a/stubs/Doctrine/JoinColumn.php +++ b/stubs/Doctrine/ORM/Mapping/JoinColumn.php @@ -2,7 +2,7 @@ namespace Doctrine\ORM\Mapping; -if (interface_exists('Doctrine\ORM\Mapping\JoinColumn')) { +if (class_exists('Doctrine\ORM\Mapping\JoinColumn')) { return; } @@ -10,7 +10,7 @@ if (interface_exists('Doctrine\ORM\Mapping\JoinColumn')) { * @Annotation * @Target({"PROPERTY","ANNOTATION"}) */ -final class JoinColumn implements Annotation +class JoinColumn implements Annotation { /** * @var string diff --git a/stubs/Doctrine/JoinTable.php b/stubs/Doctrine/ORM/Mapping/JoinTable.php similarity index 80% rename from stubs/Doctrine/JoinTable.php rename to stubs/Doctrine/ORM/Mapping/JoinTable.php index 4a14ee1c32c..ad405576cc7 100644 --- a/stubs/Doctrine/JoinTable.php +++ b/stubs/Doctrine/ORM/Mapping/JoinTable.php @@ -2,7 +2,7 @@ namespace Doctrine\ORM\Mapping; -if (interface_exists('Doctrine\ORM\Mapping\JoinTable')) { +if (class_exists('Doctrine\ORM\Mapping\JoinTable')) { return; } @@ -10,7 +10,7 @@ if (interface_exists('Doctrine\ORM\Mapping\JoinTable')) { * @Annotation * @Target({"PROPERTY","ANNOTATION"}) */ -final class JoinTable implements Annotation +class JoinTable implements Annotation { /** * @var string diff --git a/stubs/Doctrine/ManyToMany.php b/stubs/Doctrine/ORM/Mapping/ManyToMany.php similarity index 86% rename from stubs/Doctrine/ManyToMany.php rename to stubs/Doctrine/ORM/Mapping/ManyToMany.php index e368494f91c..5dedb4ee601 100644 --- a/stubs/Doctrine/ManyToMany.php +++ b/stubs/Doctrine/ORM/Mapping/ManyToMany.php @@ -2,7 +2,7 @@ namespace Doctrine\ORM\Mapping; -if (interface_exists('Doctrine\ORM\Mapping\ManyToMany')) { +if (class_exists('Doctrine\ORM\Mapping\ManyToMany')) { return; } @@ -10,7 +10,7 @@ if (interface_exists('Doctrine\ORM\Mapping\ManyToMany')) { * @Annotation * @Target("PROPERTY") */ -final class ManyToMany implements Annotation +class ManyToMany implements Annotation { /** * @var string diff --git a/stubs/Doctrine/ManyToOne.php b/stubs/Doctrine/ORM/Mapping/ManyToOne.php similarity index 82% rename from stubs/Doctrine/ManyToOne.php rename to stubs/Doctrine/ORM/Mapping/ManyToOne.php index 3382a3d912d..e93c10bddea 100644 --- a/stubs/Doctrine/ManyToOne.php +++ b/stubs/Doctrine/ORM/Mapping/ManyToOne.php @@ -2,7 +2,7 @@ namespace Doctrine\ORM\Mapping; -if (interface_exists('Doctrine\ORM\Mapping\ManyToOne')) { +if (class_exists('Doctrine\ORM\Mapping\ManyToOne')) { return; } @@ -10,7 +10,7 @@ if (interface_exists('Doctrine\ORM\Mapping\ManyToOne')) { * @Annotation * @Target("PROPERTY") */ -final class ManyToOne implements Annotation +class ManyToOne implements Annotation { /** * @var string diff --git a/stubs/Doctrine/OneToMany.php b/stubs/Doctrine/ORM/Mapping/OneToMany.php similarity index 85% rename from stubs/Doctrine/OneToMany.php rename to stubs/Doctrine/ORM/Mapping/OneToMany.php index 90516b5bd27..80b34b0ec43 100644 --- a/stubs/Doctrine/OneToMany.php +++ b/stubs/Doctrine/ORM/Mapping/OneToMany.php @@ -2,7 +2,7 @@ namespace Doctrine\ORM\Mapping; -if (interface_exists('Doctrine\ORM\Mapping\OneToMany')) { +if (class_exists('Doctrine\ORM\Mapping\OneToMany')) { return; } @@ -10,7 +10,7 @@ if (interface_exists('Doctrine\ORM\Mapping\OneToMany')) { * @Annotation * @Target("PROPERTY") */ -final class OneToMany implements Annotation +class OneToMany implements Annotation { /** * @var string diff --git a/stubs/Doctrine/OneToOne.php b/stubs/Doctrine/ORM/Mapping/OneToOne.php similarity index 85% rename from stubs/Doctrine/OneToOne.php rename to stubs/Doctrine/ORM/Mapping/OneToOne.php index dd52abfff4f..3a74e122e05 100644 --- a/stubs/Doctrine/OneToOne.php +++ b/stubs/Doctrine/ORM/Mapping/OneToOne.php @@ -2,7 +2,7 @@ namespace Doctrine\ORM\Mapping; -if (interface_exists('Doctrine\ORM\Mapping\OneToOne')) { +if (class_exists('Doctrine\ORM\Mapping\OneToOne')) { return; } @@ -10,7 +10,7 @@ if (interface_exists('Doctrine\ORM\Mapping\OneToOne')) { * @Annotation * @Target("PROPERTY") */ -final class OneToOne implements Annotation +class OneToOne implements Annotation { /** * @var string diff --git a/stubs/Doctrine/Empty/OrderBy.php b/stubs/Doctrine/ORM/Mapping/OrderBy.php similarity index 100% rename from stubs/Doctrine/Empty/OrderBy.php rename to stubs/Doctrine/ORM/Mapping/OrderBy.php diff --git a/stubs/Doctrine/Table.php b/stubs/Doctrine/ORM/Mapping/Table.php similarity index 83% rename from stubs/Doctrine/Table.php rename to stubs/Doctrine/ORM/Mapping/Table.php index 4a800f8f8c4..67b292b1f53 100644 --- a/stubs/Doctrine/Table.php +++ b/stubs/Doctrine/ORM/Mapping/Table.php @@ -2,7 +2,7 @@ namespace Doctrine\ORM\Mapping; -if (interface_exists('Doctrine\ORM\Mapping\Table')) { +if (class_exists('Doctrine\ORM\Mapping\Table')) { return; } @@ -10,7 +10,7 @@ if (interface_exists('Doctrine\ORM\Mapping\Table')) { * @Annotation * @Target("CLASS") */ -final class Table implements Annotation +class Table implements Annotation { /** * @var string