mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-05 02:40:50 +00:00
Updated Rector to commit 70fa502a59dfb8f81011a46a456e1ccb4051be76
70fa502a59
[CodeQuality] Skip private static call from static:: on LocallyCalledStaticMethodToNonStaticRector (#5620)
This commit is contained in:
parent
b0b2790db0
commit
53742c371b
|
@ -121,7 +121,7 @@ CODE_SAMPLE
|
|||
if (!$node instanceof StaticCall) {
|
||||
return null;
|
||||
}
|
||||
if (!$this->isName($node->class, 'self')) {
|
||||
if (!$this->isNames($node->class, ['self', 'static'])) {
|
||||
return null;
|
||||
}
|
||||
if (!$this->isName($node->name, $classMethodName)) {
|
||||
|
@ -151,7 +151,7 @@ CODE_SAMPLE
|
|||
if (!$node instanceof StaticCall) {
|
||||
return null;
|
||||
}
|
||||
if (!$this->isName($node->class, 'self')) {
|
||||
if (!$this->isNames($node->class, ['self', 'static'])) {
|
||||
return null;
|
||||
}
|
||||
if (!$this->isName($node->name, $currentClassMethodName)) {
|
||||
|
|
|
@ -19,12 +19,12 @@ final class VersionResolver
|
|||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '4a3137cf6e5d0e0e71ee93e6f9b82ae9726603e6';
|
||||
public const PACKAGE_VERSION = '70fa502a59dfb8f81011a46a456e1ccb4051be76';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2024-02-14 20:36:40';
|
||||
public const RELEASE_DATE = '2024-02-15 16:06:17';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
|
41
vendor/composer/autoload_classmap.php
vendored
41
vendor/composer/autoload_classmap.php
vendored
|
@ -1294,34 +1294,33 @@ return array(
|
|||
'Rector\\DependencyInjection\\RectorContainerFactory' => $baseDir . '/src/DependencyInjection/RectorContainerFactory.php',
|
||||
'Rector\\Differ\\DefaultDiffer' => $baseDir . '/src/Differ/DefaultDiffer.php',
|
||||
'Rector\\Doctrine\\Bundle210\\Rector\\Class_\\EventSubscriberInterfaceToAttributeRector' => $vendorDir . '/rector/rector-doctrine/rules/Bundle210/Rector/Class_/EventSubscriberInterfaceToAttributeRector.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AnnotationTransformer\\ClassAnnotationTransformer\\EmbeddableClassAnnotationTransformer' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/AnnotationTransformer/ClassAnnotationTransformer/EmbeddableClassAnnotationTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AnnotationTransformer\\ClassAnnotationTransformer\\EntityClassAnnotationTransformer' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/AnnotationTransformer/ClassAnnotationTransformer/EntityClassAnnotationTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AnnotationTransformer\\ClassAnnotationTransformer\\InheritanceClassAnnotationTransformer' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/AnnotationTransformer/ClassAnnotationTransformer/InheritanceClassAnnotationTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AnnotationTransformer\\ClassAnnotationTransformer\\SoftDeletableClassAnnotationTransformer' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/AnnotationTransformer/ClassAnnotationTransformer/SoftDeletableClassAnnotationTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AnnotationTransformer\\ClassAnnotationTransformer\\TableClassAnnotationTransformer' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/AnnotationTransformer/ClassAnnotationTransformer/TableClassAnnotationTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AnnotationTransformer\\PropertyAnnotationTransformer\\ColumnAnnotationTransformer' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/AnnotationTransformer/PropertyAnnotationTransformer/ColumnAnnotationTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AnnotationTransformer\\PropertyAnnotationTransformer\\EmbeddedPropertyAnnotationTransformer' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/AnnotationTransformer/PropertyAnnotationTransformer/EmbeddedPropertyAnnotationTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AnnotationTransformer\\PropertyAnnotationTransformer\\GedmoTimestampableAnnotationTransformer' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/AnnotationTransformer/PropertyAnnotationTransformer/GedmoTimestampableAnnotationTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AnnotationTransformer\\PropertyAnnotationTransformer\\IdAnnotationTransformer' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/AnnotationTransformer/PropertyAnnotationTransformer/IdAnnotationTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AnnotationTransformer\\PropertyAnnotationTransformer\\IdColumnAnnotationTransformer' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/AnnotationTransformer/PropertyAnnotationTransformer/IdColumnAnnotationTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AnnotationTransformer\\PropertyAnnotationTransformer\\IdGeneratorAnnotationTransformer' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/AnnotationTransformer/PropertyAnnotationTransformer/IdGeneratorAnnotationTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AnnotationTransformer\\PropertyAnnotationTransformer\\JoinColumnsTransformer' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/AnnotationTransformer/PropertyAnnotationTransformer/JoinColumnsTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AnnotationTransformer\\PropertyAnnotationTransformer\\ManyToOneAnnotationTransformer' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/AnnotationTransformer/PropertyAnnotationTransformer/ManyToOneAnnotationTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AnnotationTransformer\\PropertyAnnotationTransformer\\OneToManyAnnotationTransformer' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/AnnotationTransformer/PropertyAnnotationTransformer/OneToManyAnnotationTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AnnotationTransformer\\PropertyAnnotationTransformer\\OrderByAnnotationTransformer' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/AnnotationTransformer/PropertyAnnotationTransformer/OrderByAnnotationTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AnnotationTransformer\\YamlToAnnotationTransformer' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/AnnotationTransformer/YamlToAnnotationTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\Contract\\ClassAnnotationTransformerInterface' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/Contract/ClassAnnotationTransformerInterface.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\Contract\\PropertyAnnotationTransformerInterface' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/Contract/PropertyAnnotationTransformerInterface.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\DocTagNodeFactory' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/DocTagNodeFactory.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AttributeTransformer\\ClassAttributeTransformer\\EmbeddableClassAttributeTransformer' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/ClassAttributeTransformer/EmbeddableClassAttributeTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AttributeTransformer\\ClassAttributeTransformer\\EntityClassAttributeTransformer' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/ClassAttributeTransformer/EntityClassAttributeTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AttributeTransformer\\ClassAttributeTransformer\\InheritanceClassAttributeTransformer' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/ClassAttributeTransformer/InheritanceClassAttributeTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AttributeTransformer\\ClassAttributeTransformer\\SoftDeletableClassAttributeTransformer' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/ClassAttributeTransformer/SoftDeletableClassAttributeTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AttributeTransformer\\ClassAttributeTransformer\\TableClassAttributeTransformer' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/ClassAttributeTransformer/TableClassAttributeTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AttributeTransformer\\PropertyAttributeTransformer\\ColumnAttributeTransformer' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/ColumnAttributeTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AttributeTransformer\\PropertyAttributeTransformer\\EmbeddedPropertyAttributeTransformer' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/EmbeddedPropertyAttributeTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AttributeTransformer\\PropertyAttributeTransformer\\GedmoTimestampableAttributeTransformer' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/GedmoTimestampableAttributeTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AttributeTransformer\\PropertyAttributeTransformer\\IdAttributeTransformer' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/IdAttributeTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AttributeTransformer\\PropertyAttributeTransformer\\IdColumnAttributeTransformer' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/IdColumnAttributeTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AttributeTransformer\\PropertyAttributeTransformer\\IdGeneratorAttributeTransformer' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/IdGeneratorAttributeTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AttributeTransformer\\PropertyAttributeTransformer\\JoinColumnAttributeTransformer' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/JoinColumnAttributeTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AttributeTransformer\\PropertyAttributeTransformer\\ManyToOneAttributeTransformer' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/ManyToOneAttributeTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AttributeTransformer\\PropertyAttributeTransformer\\OneToManyAttributeTransformer' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/OneToManyAttributeTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AttributeTransformer\\PropertyAttributeTransformer\\OrderByAttributeTransformer' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/OrderByAttributeTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AttributeTransformer\\YamlToAttributeTransformer' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/YamlToAttributeTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\Contract\\ClassAttributeTransformerInterface' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/Contract/ClassAttributeTransformerInterface.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\Contract\\PropertyAttributeTransformerInterface' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/Contract/PropertyAttributeTransformerInterface.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\EntityMappingResolver' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/EntityMappingResolver.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\Enum\\EntityMappingKey' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/Enum/EntityMappingKey.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\Enum\\ToManyMappings' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/Enum/ToManyMappings.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\Helper\\NodeValueNormalizer' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/Helper/NodeValueNormalizer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\NodeFactory\\ArrayItemNodeFactory' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/NodeFactory/ArrayItemNodeFactory.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\NodeFactory\\AttributeFactory' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/NodeFactory/AttributeFactory.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\Rector\\Class_\\InitializeDefaultEntityCollectionRector' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/Rector/Class_/InitializeDefaultEntityCollectionRector.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\Rector\\Class_\\MoveCurrentDateTimeDefaultInEntityToConstructorRector' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/Rector/Class_/MoveCurrentDateTimeDefaultInEntityToConstructorRector.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\Rector\\Class_\\RemoveEmptyTableAttributeRector' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/Rector/Class_/RemoveEmptyTableAttributeRector.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\Rector\\Class_\\YamlToAnnotationsDoctrineMappingRector' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/Rector/Class_/YamlToAnnotationsDoctrineMappingRector.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\Rector\\Class_\\YamlToAttributeDoctrineMappingRector' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/Rector/Class_/YamlToAttributeDoctrineMappingRector.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\Rector\\Property\\CorrectDefaultTypesOnEntityPropertyRector' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/Rector/Property/CorrectDefaultTypesOnEntityPropertyRector.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\Rector\\Property\\ImproveDoctrineCollectionDocTypeInEntityRector' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/Rector/Property/ImproveDoctrineCollectionDocTypeInEntityRector.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\Rector\\Property\\MakeEntityDateTimePropertyDateTimeInterfaceRector' => $vendorDir . '/rector/rector-doctrine/rules/CodeQuality/Rector/Property/MakeEntityDateTimePropertyDateTimeInterfaceRector.php',
|
||||
|
|
41
vendor/composer/autoload_static.php
vendored
41
vendor/composer/autoload_static.php
vendored
|
@ -1513,34 +1513,33 @@ class ComposerStaticInit2d887a2f87c676eb32b3e04612865e54
|
|||
'Rector\\DependencyInjection\\RectorContainerFactory' => __DIR__ . '/../..' . '/src/DependencyInjection/RectorContainerFactory.php',
|
||||
'Rector\\Differ\\DefaultDiffer' => __DIR__ . '/../..' . '/src/Differ/DefaultDiffer.php',
|
||||
'Rector\\Doctrine\\Bundle210\\Rector\\Class_\\EventSubscriberInterfaceToAttributeRector' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/Bundle210/Rector/Class_/EventSubscriberInterfaceToAttributeRector.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AnnotationTransformer\\ClassAnnotationTransformer\\EmbeddableClassAnnotationTransformer' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/AnnotationTransformer/ClassAnnotationTransformer/EmbeddableClassAnnotationTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AnnotationTransformer\\ClassAnnotationTransformer\\EntityClassAnnotationTransformer' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/AnnotationTransformer/ClassAnnotationTransformer/EntityClassAnnotationTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AnnotationTransformer\\ClassAnnotationTransformer\\InheritanceClassAnnotationTransformer' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/AnnotationTransformer/ClassAnnotationTransformer/InheritanceClassAnnotationTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AnnotationTransformer\\ClassAnnotationTransformer\\SoftDeletableClassAnnotationTransformer' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/AnnotationTransformer/ClassAnnotationTransformer/SoftDeletableClassAnnotationTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AnnotationTransformer\\ClassAnnotationTransformer\\TableClassAnnotationTransformer' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/AnnotationTransformer/ClassAnnotationTransformer/TableClassAnnotationTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AnnotationTransformer\\PropertyAnnotationTransformer\\ColumnAnnotationTransformer' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/AnnotationTransformer/PropertyAnnotationTransformer/ColumnAnnotationTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AnnotationTransformer\\PropertyAnnotationTransformer\\EmbeddedPropertyAnnotationTransformer' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/AnnotationTransformer/PropertyAnnotationTransformer/EmbeddedPropertyAnnotationTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AnnotationTransformer\\PropertyAnnotationTransformer\\GedmoTimestampableAnnotationTransformer' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/AnnotationTransformer/PropertyAnnotationTransformer/GedmoTimestampableAnnotationTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AnnotationTransformer\\PropertyAnnotationTransformer\\IdAnnotationTransformer' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/AnnotationTransformer/PropertyAnnotationTransformer/IdAnnotationTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AnnotationTransformer\\PropertyAnnotationTransformer\\IdColumnAnnotationTransformer' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/AnnotationTransformer/PropertyAnnotationTransformer/IdColumnAnnotationTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AnnotationTransformer\\PropertyAnnotationTransformer\\IdGeneratorAnnotationTransformer' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/AnnotationTransformer/PropertyAnnotationTransformer/IdGeneratorAnnotationTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AnnotationTransformer\\PropertyAnnotationTransformer\\JoinColumnsTransformer' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/AnnotationTransformer/PropertyAnnotationTransformer/JoinColumnsTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AnnotationTransformer\\PropertyAnnotationTransformer\\ManyToOneAnnotationTransformer' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/AnnotationTransformer/PropertyAnnotationTransformer/ManyToOneAnnotationTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AnnotationTransformer\\PropertyAnnotationTransformer\\OneToManyAnnotationTransformer' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/AnnotationTransformer/PropertyAnnotationTransformer/OneToManyAnnotationTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AnnotationTransformer\\PropertyAnnotationTransformer\\OrderByAnnotationTransformer' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/AnnotationTransformer/PropertyAnnotationTransformer/OrderByAnnotationTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AnnotationTransformer\\YamlToAnnotationTransformer' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/AnnotationTransformer/YamlToAnnotationTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\Contract\\ClassAnnotationTransformerInterface' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/Contract/ClassAnnotationTransformerInterface.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\Contract\\PropertyAnnotationTransformerInterface' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/Contract/PropertyAnnotationTransformerInterface.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\DocTagNodeFactory' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/DocTagNodeFactory.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AttributeTransformer\\ClassAttributeTransformer\\EmbeddableClassAttributeTransformer' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/ClassAttributeTransformer/EmbeddableClassAttributeTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AttributeTransformer\\ClassAttributeTransformer\\EntityClassAttributeTransformer' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/ClassAttributeTransformer/EntityClassAttributeTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AttributeTransformer\\ClassAttributeTransformer\\InheritanceClassAttributeTransformer' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/ClassAttributeTransformer/InheritanceClassAttributeTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AttributeTransformer\\ClassAttributeTransformer\\SoftDeletableClassAttributeTransformer' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/ClassAttributeTransformer/SoftDeletableClassAttributeTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AttributeTransformer\\ClassAttributeTransformer\\TableClassAttributeTransformer' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/ClassAttributeTransformer/TableClassAttributeTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AttributeTransformer\\PropertyAttributeTransformer\\ColumnAttributeTransformer' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/ColumnAttributeTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AttributeTransformer\\PropertyAttributeTransformer\\EmbeddedPropertyAttributeTransformer' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/EmbeddedPropertyAttributeTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AttributeTransformer\\PropertyAttributeTransformer\\GedmoTimestampableAttributeTransformer' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/GedmoTimestampableAttributeTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AttributeTransformer\\PropertyAttributeTransformer\\IdAttributeTransformer' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/IdAttributeTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AttributeTransformer\\PropertyAttributeTransformer\\IdColumnAttributeTransformer' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/IdColumnAttributeTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AttributeTransformer\\PropertyAttributeTransformer\\IdGeneratorAttributeTransformer' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/IdGeneratorAttributeTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AttributeTransformer\\PropertyAttributeTransformer\\JoinColumnAttributeTransformer' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/JoinColumnAttributeTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AttributeTransformer\\PropertyAttributeTransformer\\ManyToOneAttributeTransformer' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/ManyToOneAttributeTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AttributeTransformer\\PropertyAttributeTransformer\\OneToManyAttributeTransformer' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/OneToManyAttributeTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AttributeTransformer\\PropertyAttributeTransformer\\OrderByAttributeTransformer' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/PropertyAttributeTransformer/OrderByAttributeTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\AttributeTransformer\\YamlToAttributeTransformer' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/AttributeTransformer/YamlToAttributeTransformer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\Contract\\ClassAttributeTransformerInterface' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/Contract/ClassAttributeTransformerInterface.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\Contract\\PropertyAttributeTransformerInterface' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/Contract/PropertyAttributeTransformerInterface.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\EntityMappingResolver' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/EntityMappingResolver.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\Enum\\EntityMappingKey' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/Enum/EntityMappingKey.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\Enum\\ToManyMappings' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/Enum/ToManyMappings.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\Helper\\NodeValueNormalizer' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/Helper/NodeValueNormalizer.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\NodeFactory\\ArrayItemNodeFactory' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/NodeFactory/ArrayItemNodeFactory.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\NodeFactory\\AttributeFactory' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/NodeFactory/AttributeFactory.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\Rector\\Class_\\InitializeDefaultEntityCollectionRector' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/Rector/Class_/InitializeDefaultEntityCollectionRector.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\Rector\\Class_\\MoveCurrentDateTimeDefaultInEntityToConstructorRector' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/Rector/Class_/MoveCurrentDateTimeDefaultInEntityToConstructorRector.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\Rector\\Class_\\RemoveEmptyTableAttributeRector' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/Rector/Class_/RemoveEmptyTableAttributeRector.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\Rector\\Class_\\YamlToAnnotationsDoctrineMappingRector' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/Rector/Class_/YamlToAnnotationsDoctrineMappingRector.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\Rector\\Class_\\YamlToAttributeDoctrineMappingRector' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/Rector/Class_/YamlToAttributeDoctrineMappingRector.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\Rector\\Property\\CorrectDefaultTypesOnEntityPropertyRector' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/Rector/Property/CorrectDefaultTypesOnEntityPropertyRector.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\Rector\\Property\\ImproveDoctrineCollectionDocTypeInEntityRector' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/Rector/Property/ImproveDoctrineCollectionDocTypeInEntityRector.php',
|
||||
'Rector\\Doctrine\\CodeQuality\\Rector\\Property\\MakeEntityDateTimePropertyDateTimeInterfaceRector' => __DIR__ . '/..' . '/rector/rector-doctrine/rules/CodeQuality/Rector/Property/MakeEntityDateTimePropertyDateTimeInterfaceRector.php',
|
||||
|
|
8
vendor/composer/installed.json
vendored
8
vendor/composer/installed.json
vendored
|
@ -1679,12 +1679,12 @@
|
|||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/rectorphp\/rector-doctrine.git",
|
||||
"reference": "ad55a2801458551168b37f6905998944f9a4f2a5"
|
||||
"reference": "b630ecdf985077bb5ca8f0a663bf60767d346374"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-doctrine\/zipball\/ad55a2801458551168b37f6905998944f9a4f2a5",
|
||||
"reference": "ad55a2801458551168b37f6905998944f9a4f2a5",
|
||||
"url": "https:\/\/api.github.com\/repos\/rectorphp\/rector-doctrine\/zipball\/b630ecdf985077bb5ca8f0a663bf60767d346374",
|
||||
"reference": "b630ecdf985077bb5ca8f0a663bf60767d346374",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -1709,7 +1709,7 @@
|
|||
"tomasvotruba\/unused-public": "^0.3",
|
||||
"tracy\/tracy": "^2.10"
|
||||
},
|
||||
"time": "2024-02-14T19:43:49+00:00",
|
||||
"time": "2024-02-15T00:54:54+00:00",
|
||||
"default-branch": true,
|
||||
"type": "rector-extension",
|
||||
"extra": {
|
||||
|
|
2
vendor/composer/installed.php
vendored
2
vendor/composer/installed.php
vendored
File diff suppressed because one or more lines are too long
|
@ -9,7 +9,7 @@ namespace Rector\RectorInstaller;
|
|||
*/
|
||||
final class GeneratedConfig
|
||||
{
|
||||
public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => NULL, 'version' => 'dev-main ad55a28'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => NULL, 'version' => 'dev-main 8d1aab2'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => NULL, 'version' => 'dev-main cdbe390'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => NULL, 'version' => 'dev-main 59edb62'));
|
||||
public const EXTENSIONS = array('rector/rector-doctrine' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-doctrine', 'relative_install_path' => '../../rector-doctrine', 'extra' => NULL, 'version' => 'dev-main b630ecd'), 'rector/rector-downgrade-php' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-downgrade-php', 'relative_install_path' => '../../rector-downgrade-php', 'extra' => NULL, 'version' => 'dev-main 8d1aab2'), 'rector/rector-phpunit' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-phpunit', 'relative_install_path' => '../../rector-phpunit', 'extra' => NULL, 'version' => 'dev-main cdbe390'), 'rector/rector-symfony' => array('install_path' => '/home/runner/work/rector-src/rector-src/rector-build/vendor/rector/rector-symfony', 'relative_install_path' => '../../rector-symfony', 'extra' => NULL, 'version' => 'dev-main 59edb62'));
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -4,43 +4,44 @@ declare (strict_types=1);
|
|||
namespace RectorPrefix202402;
|
||||
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\Doctrine\CodeQuality\AnnotationTransformer\ClassAnnotationTransformer\EmbeddableClassAnnotationTransformer;
|
||||
use Rector\Doctrine\CodeQuality\AnnotationTransformer\ClassAnnotationTransformer\EntityClassAnnotationTransformer;
|
||||
use Rector\Doctrine\CodeQuality\AnnotationTransformer\ClassAnnotationTransformer\InheritanceClassAnnotationTransformer;
|
||||
use Rector\Doctrine\CodeQuality\AnnotationTransformer\ClassAnnotationTransformer\SoftDeletableClassAnnotationTransformer;
|
||||
use Rector\Doctrine\CodeQuality\AnnotationTransformer\ClassAnnotationTransformer\TableClassAnnotationTransformer;
|
||||
use Rector\Doctrine\CodeQuality\AnnotationTransformer\PropertyAnnotationTransformer\ColumnAnnotationTransformer;
|
||||
use Rector\Doctrine\CodeQuality\AnnotationTransformer\PropertyAnnotationTransformer\EmbeddedPropertyAnnotationTransformer;
|
||||
use Rector\Doctrine\CodeQuality\AnnotationTransformer\PropertyAnnotationTransformer\GedmoTimestampableAnnotationTransformer;
|
||||
use Rector\Doctrine\CodeQuality\AnnotationTransformer\PropertyAnnotationTransformer\IdAnnotationTransformer;
|
||||
use Rector\Doctrine\CodeQuality\AnnotationTransformer\PropertyAnnotationTransformer\IdColumnAnnotationTransformer;
|
||||
use Rector\Doctrine\CodeQuality\AnnotationTransformer\PropertyAnnotationTransformer\IdGeneratorAnnotationTransformer;
|
||||
use Rector\Doctrine\CodeQuality\AnnotationTransformer\PropertyAnnotationTransformer\JoinColumnsTransformer;
|
||||
use Rector\Doctrine\CodeQuality\AnnotationTransformer\PropertyAnnotationTransformer\ManyToOneAnnotationTransformer;
|
||||
use Rector\Doctrine\CodeQuality\AnnotationTransformer\PropertyAnnotationTransformer\OneToManyAnnotationTransformer;
|
||||
use Rector\Doctrine\CodeQuality\AnnotationTransformer\PropertyAnnotationTransformer\OrderByAnnotationTransformer;
|
||||
use Rector\Doctrine\CodeQuality\AnnotationTransformer\YamlToAnnotationTransformer;
|
||||
use Rector\Doctrine\CodeQuality\Contract\ClassAnnotationTransformerInterface;
|
||||
use Rector\Doctrine\CodeQuality\Contract\PropertyAnnotationTransformerInterface;
|
||||
use Rector\Doctrine\CodeQuality\AttributeTransformer\ClassAttributeTransformer\EmbeddableClassAttributeTransformer;
|
||||
use Rector\Doctrine\CodeQuality\AttributeTransformer\ClassAttributeTransformer\EntityClassAttributeTransformer;
|
||||
use Rector\Doctrine\CodeQuality\AttributeTransformer\ClassAttributeTransformer\InheritanceClassAttributeTransformer;
|
||||
use Rector\Doctrine\CodeQuality\AttributeTransformer\ClassAttributeTransformer\SoftDeletableClassAttributeTransformer;
|
||||
use Rector\Doctrine\CodeQuality\AttributeTransformer\ClassAttributeTransformer\TableClassAttributeTransformer;
|
||||
use Rector\Doctrine\CodeQuality\AttributeTransformer\PropertyAttributeTransformer\ColumnAttributeTransformer;
|
||||
use Rector\Doctrine\CodeQuality\AttributeTransformer\PropertyAttributeTransformer\EmbeddedPropertyAttributeTransformer;
|
||||
use Rector\Doctrine\CodeQuality\AttributeTransformer\PropertyAttributeTransformer\GedmoTimestampableAttributeTransformer;
|
||||
use Rector\Doctrine\CodeQuality\AttributeTransformer\PropertyAttributeTransformer\IdAttributeTransformer;
|
||||
use Rector\Doctrine\CodeQuality\AttributeTransformer\PropertyAttributeTransformer\IdColumnAttributeTransformer;
|
||||
use Rector\Doctrine\CodeQuality\AttributeTransformer\PropertyAttributeTransformer\IdGeneratorAttributeTransformer;
|
||||
use Rector\Doctrine\CodeQuality\AttributeTransformer\PropertyAttributeTransformer\JoinColumnAttributeTransformer;
|
||||
use Rector\Doctrine\CodeQuality\AttributeTransformer\PropertyAttributeTransformer\ManyToOneAttributeTransformer;
|
||||
use Rector\Doctrine\CodeQuality\AttributeTransformer\PropertyAttributeTransformer\OneToManyAttributeTransformer;
|
||||
use Rector\Doctrine\CodeQuality\AttributeTransformer\PropertyAttributeTransformer\OrderByAttributeTransformer;
|
||||
use Rector\Doctrine\CodeQuality\AttributeTransformer\YamlToAttributeTransformer;
|
||||
use Rector\Doctrine\CodeQuality\Contract\ClassAttributeTransformerInterface;
|
||||
use Rector\Doctrine\CodeQuality\Contract\PropertyAttributeTransformerInterface;
|
||||
return static function (RectorConfig $rectorConfig) : void {
|
||||
$rectorConfig->autotagInterface(ClassAnnotationTransformerInterface::class);
|
||||
$rectorConfig->autotagInterface(PropertyAnnotationTransformerInterface::class);
|
||||
// for yaml to annotation transformer
|
||||
$rectorConfig->singleton(EntityClassAnnotationTransformer::class);
|
||||
$rectorConfig->singleton(SoftDeletableClassAnnotationTransformer::class);
|
||||
$rectorConfig->singleton(TableClassAnnotationTransformer::class);
|
||||
$rectorConfig->singleton(EmbeddableClassAnnotationTransformer::class);
|
||||
$rectorConfig->singleton(InheritanceClassAnnotationTransformer::class);
|
||||
$rectorConfig->singleton(ColumnAnnotationTransformer::class);
|
||||
$rectorConfig->singleton(EmbeddedPropertyAnnotationTransformer::class);
|
||||
$rectorConfig->singleton(GedmoTimestampableAnnotationTransformer::class);
|
||||
$rectorConfig->singleton(IdAnnotationTransformer::class);
|
||||
$rectorConfig->singleton(IdColumnAnnotationTransformer::class);
|
||||
$rectorConfig->singleton(IdGeneratorAnnotationTransformer::class);
|
||||
$rectorConfig->singleton(ManyToOneAnnotationTransformer::class);
|
||||
$rectorConfig->singleton(OneToManyAnnotationTransformer::class);
|
||||
$rectorConfig->singleton(JoinColumnsTransformer::class);
|
||||
$rectorConfig->singleton(OrderByAnnotationTransformer::class);
|
||||
$rectorConfig->when(YamlToAnnotationTransformer::class)->needs('$classAnnotationTransformers')->giveTagged(ClassAnnotationTransformerInterface::class);
|
||||
$rectorConfig->when(YamlToAnnotationTransformer::class)->needs('$propertyAnnotationTransformers')->giveTagged(PropertyAnnotationTransformerInterface::class);
|
||||
$rectorConfig->autotagInterface(ClassAttributeTransformerInterface::class);
|
||||
$rectorConfig->autotagInterface(PropertyAttributeTransformerInterface::class);
|
||||
// for yaml to class attribute transformer
|
||||
$rectorConfig->singleton(EntityClassAttributeTransformer::class);
|
||||
$rectorConfig->singleton(SoftDeletableClassAttributeTransformer::class);
|
||||
$rectorConfig->singleton(TableClassAttributeTransformer::class);
|
||||
$rectorConfig->singleton(EmbeddableClassAttributeTransformer::class);
|
||||
$rectorConfig->singleton(InheritanceClassAttributeTransformer::class);
|
||||
// for yaml to property attribute transformer
|
||||
$rectorConfig->singleton(ColumnAttributeTransformer::class);
|
||||
$rectorConfig->singleton(EmbeddedPropertyAttributeTransformer::class);
|
||||
$rectorConfig->singleton(GedmoTimestampableAttributeTransformer::class);
|
||||
$rectorConfig->singleton(IdAttributeTransformer::class);
|
||||
$rectorConfig->singleton(IdColumnAttributeTransformer::class);
|
||||
$rectorConfig->singleton(IdGeneratorAttributeTransformer::class);
|
||||
$rectorConfig->singleton(ManyToOneAttributeTransformer::class);
|
||||
$rectorConfig->singleton(OneToManyAttributeTransformer::class);
|
||||
$rectorConfig->singleton(JoinColumnAttributeTransformer::class);
|
||||
$rectorConfig->singleton(OrderByAttributeTransformer::class);
|
||||
$rectorConfig->when(YamlToAttributeTransformer::class)->needs('$classAttributeTransformers')->giveTagged(ClassAttributeTransformerInterface::class);
|
||||
$rectorConfig->when(YamlToAttributeTransformer::class)->needs('$propertyAttributeTransformers')->giveTagged(PropertyAttributeTransformerInterface::class);
|
||||
};
|
||||
|
|
|
@ -286,7 +286,7 @@ Remove empty Table attribute on entities because it's useless
|
|||
|
||||
## ReplaceFetchAllMethodCallRector
|
||||
|
||||
Change `Doctrine\DBAL\Connection` `->fetchAll()` to `->fetchAllAssociative()` and other replacements
|
||||
Change `Doctrine\DBAL\Connection` and `Doctrine\DBAL\Driver\ResultStatement` `->fetchAll()` to `->fetchAllAssociative()` and other replacements
|
||||
|
||||
- class: [`Rector\Doctrine\Dbal211\Rector\MethodCall\ReplaceFetchAllMethodCallRector`](../rules/Dbal211/Rector/MethodCall/ReplaceFetchAllMethodCallRector.php)
|
||||
|
||||
|
@ -417,32 +417,26 @@ Complete `@var` annotations or types based on @ORM\*toOne annotations or attribu
|
|||
|
||||
<br>
|
||||
|
||||
## YamlToAnnotationsDoctrineMappingRector
|
||||
## YamlToAttributeDoctrineMappingRector
|
||||
|
||||
Converts YAML Doctrine Entity mapping to particular annotation mapping
|
||||
|
||||
:wrench: **configure it!**
|
||||
|
||||
- class: [`Rector\Doctrine\CodeQuality\Rector\Class_\YamlToAnnotationsDoctrineMappingRector`](../rules/CodeQuality/Rector/Class_/YamlToAnnotationsDoctrineMappingRector.php)
|
||||
- class: [`Rector\Doctrine\CodeQuality\Rector\Class_\YamlToAttributeDoctrineMappingRector`](../rules/CodeQuality/Rector/Class_/YamlToAttributeDoctrineMappingRector.php)
|
||||
|
||||
```diff
|
||||
+use Doctrine\ORM\Mapping as ORM;
|
||||
+
|
||||
+/**
|
||||
+ * @ORM\Entity
|
||||
+ */
|
||||
+#[ORM\Entity]
|
||||
class SomeEntity
|
||||
{
|
||||
+ /**
|
||||
+ * @ORM\Id
|
||||
+ * @ORM\GeneratedValue
|
||||
+ * @ORM\Column(type="integer")
|
||||
+ */
|
||||
+ #[ORM\Id]
|
||||
+ #[ORM\GeneratedValue]
|
||||
+ #[ORM\Column(type: 'integer')]
|
||||
private $id;
|
||||
|
||||
+ /**
|
||||
+ * @ORM\Column(type="string")
|
||||
+ */
|
||||
+ #[ORM\Column(type: 'string')]
|
||||
private $name;
|
||||
}
|
||||
```
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Doctrine\CodeQuality\AnnotationTransformer\ClassAnnotationTransformer;
|
||||
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
|
||||
use Rector\Doctrine\CodeQuality\Contract\ClassAnnotationTransformerInterface;
|
||||
use Rector\Doctrine\CodeQuality\DocTagNodeFactory;
|
||||
use Rector\Doctrine\CodeQuality\ValueObject\EntityMapping;
|
||||
final class EmbeddableClassAnnotationTransformer implements ClassAnnotationTransformerInterface
|
||||
{
|
||||
public function transform(EntityMapping $entityMapping, PhpDocInfo $classPhpDocInfo) : void
|
||||
{
|
||||
$classMapping = $entityMapping->getClassMapping();
|
||||
$type = $classMapping['type'] ?? null;
|
||||
if ($type !== 'embeddable') {
|
||||
return;
|
||||
}
|
||||
$spacelessPhpDocTagNode = DocTagNodeFactory::createSpacelessPhpDocTagNode([], $this->getClassName());
|
||||
$classPhpDocInfo->addPhpDocTagNode($spacelessPhpDocTagNode);
|
||||
}
|
||||
public function getClassName() : string
|
||||
{
|
||||
return 'Doctrine\\ORM\\Mapping\\Embeddable';
|
||||
}
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Doctrine\CodeQuality\AnnotationTransformer\ClassAnnotationTransformer;
|
||||
|
||||
use Rector\BetterPhpDocParser\PhpDoc\ArrayItemNode;
|
||||
use Rector\BetterPhpDocParser\PhpDoc\StringNode;
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
|
||||
use Rector\Doctrine\CodeQuality\Contract\ClassAnnotationTransformerInterface;
|
||||
use Rector\Doctrine\CodeQuality\DocTagNodeFactory;
|
||||
use Rector\Doctrine\CodeQuality\ValueObject\EntityMapping;
|
||||
final class EntityClassAnnotationTransformer implements ClassAnnotationTransformerInterface
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private const REPOSITORY_CLASS_KEY = 'repositoryClass';
|
||||
public function transform(EntityMapping $entityMapping, PhpDocInfo $classPhpDocInfo) : void
|
||||
{
|
||||
$classMapping = $entityMapping->getClassMapping();
|
||||
$type = $classMapping['type'] ?? null;
|
||||
if ($type !== 'entity') {
|
||||
return;
|
||||
}
|
||||
$arrayItemNodes = [];
|
||||
$repositoryClass = $classMapping[self::REPOSITORY_CLASS_KEY] ?? null;
|
||||
if ($repositoryClass) {
|
||||
$arrayItemNodes[] = new ArrayItemNode(new StringNode($repositoryClass), self::REPOSITORY_CLASS_KEY);
|
||||
}
|
||||
$spacelessPhpDocTagNode = DocTagNodeFactory::createSpacelessPhpDocTagNode($arrayItemNodes, $this->getClassName());
|
||||
$classPhpDocInfo->addPhpDocTagNode($spacelessPhpDocTagNode);
|
||||
}
|
||||
public function getClassName() : string
|
||||
{
|
||||
return 'Doctrine\\ORM\\Mapping\\Entity';
|
||||
}
|
||||
}
|
|
@ -1,65 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Doctrine\CodeQuality\AnnotationTransformer\ClassAnnotationTransformer;
|
||||
|
||||
use Rector\BetterPhpDocParser\PhpDoc\StringNode;
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
|
||||
use Rector\BetterPhpDocParser\ValueObject\PhpDoc\DoctrineAnnotation\CurlyListNode;
|
||||
use Rector\Doctrine\CodeQuality\Contract\ClassAnnotationTransformerInterface;
|
||||
use Rector\Doctrine\CodeQuality\DocTagNodeFactory;
|
||||
use Rector\Doctrine\CodeQuality\Enum\EntityMappingKey;
|
||||
use Rector\Doctrine\CodeQuality\NodeFactory\ArrayItemNodeFactory;
|
||||
use Rector\Doctrine\CodeQuality\ValueObject\EntityMapping;
|
||||
final class InheritanceClassAnnotationTransformer implements ClassAnnotationTransformerInterface
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Doctrine\CodeQuality\NodeFactory\ArrayItemNodeFactory
|
||||
*/
|
||||
private $arrayItemNodeFactory;
|
||||
public function __construct(ArrayItemNodeFactory $arrayItemNodeFactory)
|
||||
{
|
||||
$this->arrayItemNodeFactory = $arrayItemNodeFactory;
|
||||
}
|
||||
public function transform(EntityMapping $entityMapping, PhpDocInfo $classPhpDocInfo) : void
|
||||
{
|
||||
$classMapping = $entityMapping->getClassMapping();
|
||||
$inheritanceType = $classMapping['inheritanceType'] ?? null;
|
||||
if ($inheritanceType === null) {
|
||||
return;
|
||||
}
|
||||
$inheritanceStringNode = new StringNode($inheritanceType);
|
||||
$spacelessPhpDocTagNode = DocTagNodeFactory::createSpacelessPhpDocTagNode([$inheritanceStringNode], 'Doctrine\\ORM\\Mapping\\InheritanceType');
|
||||
$classPhpDocInfo->addPhpDocTagNode($spacelessPhpDocTagNode);
|
||||
if (isset($classMapping['discriminatorColumn'])) {
|
||||
$this->addDisriminatorColumn($classMapping['discriminatorColumn'], $classPhpDocInfo);
|
||||
}
|
||||
if (isset($classMapping['discriminatorMap'])) {
|
||||
$this->addDiscriminatorMap($classMapping['discriminatorMap'], $classPhpDocInfo);
|
||||
}
|
||||
}
|
||||
public function getClassName() : string
|
||||
{
|
||||
return 'Doctrine\\ORM\\Mapping\\DiscriminatorMap';
|
||||
}
|
||||
/**
|
||||
* @param array<string, mixed> $discriminatorColumn
|
||||
*/
|
||||
private function addDisriminatorColumn(array $discriminatorColumn, PhpDocInfo $classPhpDocInfo) : void
|
||||
{
|
||||
$arrayItemNodes = $this->arrayItemNodeFactory->create($discriminatorColumn, [EntityMappingKey::NAME, EntityMappingKey::TYPE]);
|
||||
$spacelessPhpDocTagNode = DocTagNodeFactory::createSpacelessPhpDocTagNode($arrayItemNodes, 'Doctrine\\ORM\\Mapping\\DiscriminatorColumn');
|
||||
$classPhpDocInfo->addPhpDocTagNode($spacelessPhpDocTagNode);
|
||||
}
|
||||
/**
|
||||
* @param array<string, mixed> $discriminatorMap
|
||||
*/
|
||||
private function addDiscriminatorMap(array $discriminatorMap, PhpDocInfo $classPhpDocInfo) : void
|
||||
{
|
||||
$arrayItemNodes = $this->arrayItemNodeFactory->createWithQuotes($discriminatorMap);
|
||||
$curlyListNode = new CurlyListNode($arrayItemNodes);
|
||||
$spacelessPhpDocTagNode = DocTagNodeFactory::createSpacelessPhpDocTagNode([$curlyListNode], $this->getClassName());
|
||||
$classPhpDocInfo->addPhpDocTagNode($spacelessPhpDocTagNode);
|
||||
}
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Doctrine\CodeQuality\AnnotationTransformer\ClassAnnotationTransformer;
|
||||
|
||||
use Rector\BetterPhpDocParser\PhpDoc\ArrayItemNode;
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
|
||||
use Rector\Doctrine\CodeQuality\Contract\ClassAnnotationTransformerInterface;
|
||||
use Rector\Doctrine\CodeQuality\DocTagNodeFactory;
|
||||
use Rector\Doctrine\CodeQuality\Helper\NodeValueNormalizer;
|
||||
use Rector\Doctrine\CodeQuality\Utils\CaseStringHelper;
|
||||
use Rector\Doctrine\CodeQuality\ValueObject\EntityMapping;
|
||||
final class SoftDeletableClassAnnotationTransformer implements ClassAnnotationTransformerInterface
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private const SOFT_DELETEABLE = 'soft_deleteable';
|
||||
public function transform(EntityMapping $entityMapping, PhpDocInfo $classPhpDocInfo) : void
|
||||
{
|
||||
$classMapping = $entityMapping->getClassMapping();
|
||||
$softDeletableMapping = $classMapping['gedmo'][self::SOFT_DELETEABLE] ?? null;
|
||||
if (!\is_array($softDeletableMapping)) {
|
||||
return;
|
||||
}
|
||||
$arrayItemNodes = $this->createArrayItemNodes($softDeletableMapping);
|
||||
$spacelessPhpDocTagNode = DocTagNodeFactory::createSpacelessPhpDocTagNode($arrayItemNodes, $this->getClassName());
|
||||
$classPhpDocInfo->addPhpDocTagNode($spacelessPhpDocTagNode);
|
||||
}
|
||||
public function getClassName() : string
|
||||
{
|
||||
return 'Gedmo\\Mapping\\Annotation\\SoftDeleteable';
|
||||
}
|
||||
/**
|
||||
* @param array<string, mixed> $softDeletableMapping
|
||||
* @return ArrayItemNode[]
|
||||
*/
|
||||
private function createArrayItemNodes(array $softDeletableMapping) : array
|
||||
{
|
||||
$arrayItemNodes = [];
|
||||
foreach ($softDeletableMapping as $fieldKey => $fieldValueNode) {
|
||||
$fieldKey = CaseStringHelper::camelCase($fieldKey);
|
||||
$fieldValueNode = NodeValueNormalizer::normalize($fieldValueNode);
|
||||
$arrayItemNodes[] = new ArrayItemNode($fieldValueNode, $fieldKey);
|
||||
}
|
||||
return $arrayItemNodes;
|
||||
}
|
||||
}
|
|
@ -1,56 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Doctrine\CodeQuality\AnnotationTransformer\ClassAnnotationTransformer;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
|
||||
use Rector\BetterPhpDocParser\PhpDoc\ArrayItemNode;
|
||||
use Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode;
|
||||
use Rector\BetterPhpDocParser\PhpDoc\StringNode;
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
|
||||
use Rector\BetterPhpDocParser\ValueObject\PhpDoc\DoctrineAnnotation\CurlyListNode;
|
||||
use Rector\Doctrine\CodeQuality\Contract\ClassAnnotationTransformerInterface;
|
||||
use Rector\Doctrine\CodeQuality\DocTagNodeFactory;
|
||||
use Rector\Doctrine\CodeQuality\ValueObject\EntityMapping;
|
||||
final class TableClassAnnotationTransformer implements ClassAnnotationTransformerInterface
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private const TABLE_KEY = 'table';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private const UNIQUE_CONSTRAINTS_CLASS = 'Doctrine\\ORM\\Mapping\\UniqueConstraint';
|
||||
public function transform(EntityMapping $entityMapping, PhpDocInfo $classPhpDocInfo) : void
|
||||
{
|
||||
$classMapping = $entityMapping->getClassMapping();
|
||||
$table = $classMapping[self::TABLE_KEY] ?? null;
|
||||
if (isset($classMapping['type']) && $classMapping['type'] !== 'entity') {
|
||||
return;
|
||||
}
|
||||
$arrayItemNodes = [];
|
||||
if (\is_string($table)) {
|
||||
$arrayItemNodes[] = new ArrayItemNode(new StringNode($table), 'name');
|
||||
}
|
||||
$uniqueConstraints = $classMapping['uniqueConstraints'] ?? null;
|
||||
if ($uniqueConstraints) {
|
||||
$uniqueConstraintDoctrineAnnotationTagValueNodes = [];
|
||||
foreach ($uniqueConstraints as $name => $uniqueConstraint) {
|
||||
$columnArrayItems = [];
|
||||
foreach ($uniqueConstraint['columns'] as $column) {
|
||||
$columnArrayItems[] = new ArrayItemNode(new StringNode($column));
|
||||
}
|
||||
$columnCurlList = new CurlyListNode($columnArrayItems);
|
||||
$uniqueConstraintDoctrineAnnotationTagValueNodes[] = new ArrayItemNode(new DoctrineAnnotationTagValueNode(new IdentifierTypeNode('@\\' . self::UNIQUE_CONSTRAINTS_CLASS), null, [new ArrayItemNode(new StringNode($name), 'name'), new ArrayItemNode($columnCurlList, 'columns')]));
|
||||
}
|
||||
$arrayItemNodes[] = new ArrayItemNode(new CurlyListNode($uniqueConstraintDoctrineAnnotationTagValueNodes), 'uniqueConstraints');
|
||||
}
|
||||
$spacelessPhpDocTagNode = DocTagNodeFactory::createSpacelessPhpDocTagNode($arrayItemNodes, $this->getClassName());
|
||||
$classPhpDocInfo->addPhpDocTagNode($spacelessPhpDocTagNode);
|
||||
}
|
||||
public function getClassName() : string
|
||||
{
|
||||
return 'Doctrine\\ORM\\Mapping\\Table';
|
||||
}
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Doctrine\CodeQuality\AnnotationTransformer\PropertyAnnotationTransformer;
|
||||
|
||||
use PhpParser\Node\Stmt\Property;
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
|
||||
use Rector\Doctrine\CodeQuality\Contract\PropertyAnnotationTransformerInterface;
|
||||
use Rector\Doctrine\CodeQuality\DocTagNodeFactory;
|
||||
use Rector\Doctrine\CodeQuality\Enum\EntityMappingKey;
|
||||
use Rector\Doctrine\CodeQuality\NodeFactory\ArrayItemNodeFactory;
|
||||
use Rector\Doctrine\CodeQuality\ValueObject\EntityMapping;
|
||||
use Rector\Doctrine\Enum\MappingClass;
|
||||
final class ColumnAnnotationTransformer implements PropertyAnnotationTransformerInterface
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Doctrine\CodeQuality\NodeFactory\ArrayItemNodeFactory
|
||||
*/
|
||||
private $arrayItemNodeFactory;
|
||||
public function __construct(ArrayItemNodeFactory $arrayItemNodeFactory)
|
||||
{
|
||||
$this->arrayItemNodeFactory = $arrayItemNodeFactory;
|
||||
}
|
||||
public function transform(EntityMapping $entityMapping, PhpDocInfo $propertyPhpDocInfo, Property $property) : void
|
||||
{
|
||||
$propertyMapping = $entityMapping->matchFieldPropertyMapping($property);
|
||||
if ($propertyMapping === null) {
|
||||
return;
|
||||
}
|
||||
// rename to "name"
|
||||
if (isset($propertyMapping[EntityMappingKey::COLUMN])) {
|
||||
$propertyMapping[EntityMappingKey::NAME] = $propertyMapping[EntityMappingKey::COLUMN];
|
||||
unset($propertyMapping[EntityMappingKey::COLUMN]);
|
||||
}
|
||||
$arrayItemNodes = $this->arrayItemNodeFactory->create($propertyMapping, [EntityMappingKey::TYPE, EntityMappingKey::NAME]);
|
||||
$spacelessPhpDocTagNode = DocTagNodeFactory::createSpacelessPhpDocTagNode($arrayItemNodes, $this->getClassName());
|
||||
$propertyPhpDocInfo->addPhpDocTagNode($spacelessPhpDocTagNode);
|
||||
}
|
||||
public function getClassName() : string
|
||||
{
|
||||
return MappingClass::COLUMN;
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Doctrine\CodeQuality\AnnotationTransformer\PropertyAnnotationTransformer;
|
||||
|
||||
use PhpParser\Node\Stmt\Property;
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
|
||||
use Rector\Doctrine\CodeQuality\Contract\PropertyAnnotationTransformerInterface;
|
||||
use Rector\Doctrine\CodeQuality\DocTagNodeFactory;
|
||||
use Rector\Doctrine\CodeQuality\NodeFactory\ArrayItemNodeFactory;
|
||||
use Rector\Doctrine\CodeQuality\ValueObject\EntityMapping;
|
||||
final class EmbeddedPropertyAnnotationTransformer implements PropertyAnnotationTransformerInterface
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Doctrine\CodeQuality\NodeFactory\ArrayItemNodeFactory
|
||||
*/
|
||||
private $arrayItemNodeFactory;
|
||||
public function __construct(ArrayItemNodeFactory $arrayItemNodeFactory)
|
||||
{
|
||||
$this->arrayItemNodeFactory = $arrayItemNodeFactory;
|
||||
}
|
||||
public function transform(EntityMapping $entityMapping, PhpDocInfo $propertyPhpDocInfo, Property $property) : void
|
||||
{
|
||||
$propertyMapping = $entityMapping->matchEmbeddedPropertyMapping($property);
|
||||
if ($propertyMapping === null) {
|
||||
return;
|
||||
}
|
||||
unset($propertyMapping['nullable']);
|
||||
$arrayItemNodes = $this->arrayItemNodeFactory->create($propertyMapping, ['class', 'columnPrefix']);
|
||||
$spacelessPhpDocTagNode = DocTagNodeFactory::createSpacelessPhpDocTagNode($arrayItemNodes, $this->getClassName());
|
||||
$propertyPhpDocInfo->addPhpDocTagNode($spacelessPhpDocTagNode);
|
||||
}
|
||||
public function getClassName() : string
|
||||
{
|
||||
return 'Doctrine\\ORM\\Mapping\\Embedded';
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Doctrine\CodeQuality\AnnotationTransformer\PropertyAnnotationTransformer;
|
||||
|
||||
use PhpParser\Node\Stmt\Property;
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
|
||||
use Rector\Doctrine\CodeQuality\Contract\PropertyAnnotationTransformerInterface;
|
||||
use Rector\Doctrine\CodeQuality\DocTagNodeFactory;
|
||||
use Rector\Doctrine\CodeQuality\NodeFactory\ArrayItemNodeFactory;
|
||||
use Rector\Doctrine\CodeQuality\ValueObject\EntityMapping;
|
||||
final class GedmoTimestampableAnnotationTransformer implements PropertyAnnotationTransformerInterface
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Doctrine\CodeQuality\NodeFactory\ArrayItemNodeFactory
|
||||
*/
|
||||
private $arrayItemNodeFactory;
|
||||
public function __construct(ArrayItemNodeFactory $arrayItemNodeFactory)
|
||||
{
|
||||
$this->arrayItemNodeFactory = $arrayItemNodeFactory;
|
||||
}
|
||||
public function transform(EntityMapping $entityMapping, PhpDocInfo $propertyPhpDocInfo, Property $property) : void
|
||||
{
|
||||
$fieldPropertyMapping = $entityMapping->matchFieldPropertyMapping($property);
|
||||
$timestampableMapping = $fieldPropertyMapping['gedmo']['timestampable'] ?? null;
|
||||
if (!\is_array($timestampableMapping)) {
|
||||
return;
|
||||
}
|
||||
$arrayItemNodes = $this->arrayItemNodeFactory->create($timestampableMapping, ['on', 'field']);
|
||||
$spacelessPhpDocTagNode = DocTagNodeFactory::createSpacelessPhpDocTagNode($arrayItemNodes, $this->getClassName());
|
||||
$propertyPhpDocInfo->addPhpDocTagNode($spacelessPhpDocTagNode);
|
||||
}
|
||||
public function getClassName() : string
|
||||
{
|
||||
return 'Gedmo\\Mapping\\Annotation\\Timestampable';
|
||||
}
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Doctrine\CodeQuality\AnnotationTransformer\PropertyAnnotationTransformer;
|
||||
|
||||
use PhpParser\Node\Stmt\Property;
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
|
||||
use Rector\Doctrine\CodeQuality\Contract\PropertyAnnotationTransformerInterface;
|
||||
use Rector\Doctrine\CodeQuality\DocTagNodeFactory;
|
||||
use Rector\Doctrine\CodeQuality\ValueObject\EntityMapping;
|
||||
final class IdAnnotationTransformer implements PropertyAnnotationTransformerInterface
|
||||
{
|
||||
public function transform(EntityMapping $entityMapping, PhpDocInfo $propertyPhpDocInfo, Property $property) : void
|
||||
{
|
||||
$idMapping = $entityMapping->matchIdPropertyMapping($property);
|
||||
if (!\is_array($idMapping)) {
|
||||
return;
|
||||
}
|
||||
$spacelessPhpDocTagNode = DocTagNodeFactory::createSpacelessPhpDocTagNode([], $this->getClassName());
|
||||
$propertyPhpDocInfo->addPhpDocTagNode($spacelessPhpDocTagNode);
|
||||
}
|
||||
public function getClassName() : string
|
||||
{
|
||||
return 'Doctrine\\ORM\\Mapping\\Id';
|
||||
}
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Doctrine\CodeQuality\AnnotationTransformer\PropertyAnnotationTransformer;
|
||||
|
||||
use PhpParser\Node\Stmt\Property;
|
||||
use Rector\BetterPhpDocParser\PhpDoc\ArrayItemNode;
|
||||
use Rector\BetterPhpDocParser\PhpDoc\StringNode;
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
|
||||
use Rector\Doctrine\CodeQuality\Contract\PropertyAnnotationTransformerInterface;
|
||||
use Rector\Doctrine\CodeQuality\DocTagNodeFactory;
|
||||
use Rector\Doctrine\CodeQuality\ValueObject\EntityMapping;
|
||||
use Rector\Doctrine\Enum\MappingClass;
|
||||
final class IdColumnAnnotationTransformer implements PropertyAnnotationTransformerInterface
|
||||
{
|
||||
public function transform(EntityMapping $entityMapping, PhpDocInfo $propertyPhpDocInfo, Property $property) : void
|
||||
{
|
||||
$idMapping = $entityMapping->matchIdPropertyMapping($property);
|
||||
if (!\is_array($idMapping)) {
|
||||
return;
|
||||
}
|
||||
$arrayItemNodes = [];
|
||||
$type = $idMapping['type'] ?? null;
|
||||
if ($type) {
|
||||
$arrayItemNodes[] = new ArrayItemNode(new StringNode($type), 'type');
|
||||
}
|
||||
$spacelessPhpDocTagNode = DocTagNodeFactory::createSpacelessPhpDocTagNode($arrayItemNodes, $this->getClassName());
|
||||
$propertyPhpDocInfo->addPhpDocTagNode($spacelessPhpDocTagNode);
|
||||
}
|
||||
public function getClassName() : string
|
||||
{
|
||||
return MappingClass::COLUMN;
|
||||
}
|
||||
}
|
|
@ -1,62 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Doctrine\CodeQuality\AnnotationTransformer\PropertyAnnotationTransformer;
|
||||
|
||||
use PhpParser\Node\Stmt\Property;
|
||||
use Rector\BetterPhpDocParser\PhpDoc\ArrayItemNode;
|
||||
use Rector\BetterPhpDocParser\PhpDoc\SpacelessPhpDocTagNode;
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
|
||||
use Rector\BetterPhpDocParser\ValueObject\PhpDoc\DoctrineAnnotation\CurlyListNode;
|
||||
use Rector\Doctrine\CodeQuality\Contract\PropertyAnnotationTransformerInterface;
|
||||
use Rector\Doctrine\CodeQuality\DocTagNodeFactory;
|
||||
use Rector\Doctrine\CodeQuality\NodeFactory\ArrayItemNodeFactory;
|
||||
use Rector\Doctrine\CodeQuality\ValueObject\EntityMapping;
|
||||
final class JoinColumnsTransformer implements PropertyAnnotationTransformerInterface
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Doctrine\CodeQuality\NodeFactory\ArrayItemNodeFactory
|
||||
*/
|
||||
private $arrayItemNodeFactory;
|
||||
public function __construct(ArrayItemNodeFactory $arrayItemNodeFactory)
|
||||
{
|
||||
$this->arrayItemNodeFactory = $arrayItemNodeFactory;
|
||||
}
|
||||
public function transform(EntityMapping $entityMapping, PhpDocInfo $propertyPhpDocInfo, Property $property) : void
|
||||
{
|
||||
$manyToOnePropertyMapping = $entityMapping->matchManyToOnePropertyMapping($property);
|
||||
if (!\is_array($manyToOnePropertyMapping)) {
|
||||
return;
|
||||
}
|
||||
$joinColumns = $manyToOnePropertyMapping['joinColumns'] ?? null;
|
||||
if (!\is_array($joinColumns)) {
|
||||
return;
|
||||
}
|
||||
$joinColumnArrayItemNodes = [];
|
||||
foreach ($joinColumns as $columnName => $joinColumn) {
|
||||
$joinColumnSpacelessPhpDocTagNode = $this->createJoinColumnSpacelessTagValueNode($columnName, $joinColumn);
|
||||
$joinColumnArrayItemNodes[] = new ArrayItemNode($joinColumnSpacelessPhpDocTagNode);
|
||||
}
|
||||
if (\count($joinColumnArrayItemNodes) === 1) {
|
||||
$spacelessPhpDocTagNode = $joinColumnArrayItemNodes[0]->value;
|
||||
} else {
|
||||
$spacelessPhpDocTagNode = DocTagNodeFactory::createSpacelessPhpDocTagNode([new CurlyListNode($joinColumnArrayItemNodes)], $this->getClassName());
|
||||
}
|
||||
$propertyPhpDocInfo->addPhpDocTagNode($spacelessPhpDocTagNode);
|
||||
}
|
||||
public function getClassName() : string
|
||||
{
|
||||
return 'Doctrine\\ORM\\Mapping\\JoinColumns';
|
||||
}
|
||||
/**
|
||||
* @param int|string $columnName
|
||||
* @param mixed $joinColumn
|
||||
*/
|
||||
private function createJoinColumnSpacelessTagValueNode($columnName, $joinColumn) : SpacelessPhpDocTagNode
|
||||
{
|
||||
$joinColumn = \array_merge(['name' => $columnName], $joinColumn);
|
||||
$arrayItemNodes = $this->arrayItemNodeFactory->create($joinColumn, ['name', 'referencedColumnName']);
|
||||
return DocTagNodeFactory::createSpacelessPhpDocTagNode($arrayItemNodes, 'Doctrine\\ORM\\Mapping\\JoinColumn');
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Doctrine\CodeQuality\AnnotationTransformer\PropertyAnnotationTransformer;
|
||||
|
||||
use PhpParser\Node\Stmt\Property;
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
|
||||
use Rector\Doctrine\CodeQuality\Contract\PropertyAnnotationTransformerInterface;
|
||||
use Rector\Doctrine\CodeQuality\DocTagNodeFactory;
|
||||
use Rector\Doctrine\CodeQuality\Enum\EntityMappingKey;
|
||||
use Rector\Doctrine\CodeQuality\NodeFactory\ArrayItemNodeFactory;
|
||||
use Rector\Doctrine\CodeQuality\ValueObject\EntityMapping;
|
||||
final class ManyToOneAnnotationTransformer implements PropertyAnnotationTransformerInterface
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Doctrine\CodeQuality\NodeFactory\ArrayItemNodeFactory
|
||||
*/
|
||||
private $arrayItemNodeFactory;
|
||||
public function __construct(ArrayItemNodeFactory $arrayItemNodeFactory)
|
||||
{
|
||||
$this->arrayItemNodeFactory = $arrayItemNodeFactory;
|
||||
}
|
||||
public function transform(EntityMapping $entityMapping, PhpDocInfo $propertyPhpDocInfo, Property $property) : void
|
||||
{
|
||||
$manyToOneMapping = $entityMapping->matchManyToOnePropertyMapping($property);
|
||||
if (!\is_array($manyToOneMapping)) {
|
||||
return;
|
||||
}
|
||||
$arrayItemNodes = $this->arrayItemNodeFactory->create($manyToOneMapping, [EntityMappingKey::TARGET_ENTITY, EntityMappingKey::INVERSED_BY]);
|
||||
$spacelessPhpDocTagNode = DocTagNodeFactory::createSpacelessPhpDocTagNode($arrayItemNodes, $this->getClassName());
|
||||
$propertyPhpDocInfo->addPhpDocTagNode($spacelessPhpDocTagNode);
|
||||
}
|
||||
public function getClassName() : string
|
||||
{
|
||||
return 'Doctrine\\ORM\\Mapping\\ManyToOne';
|
||||
}
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Doctrine\CodeQuality\AnnotationTransformer\PropertyAnnotationTransformer;
|
||||
|
||||
use PhpParser\Node\Stmt\Property;
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
|
||||
use Rector\Doctrine\CodeQuality\Contract\PropertyAnnotationTransformerInterface;
|
||||
use Rector\Doctrine\CodeQuality\DocTagNodeFactory;
|
||||
use Rector\Doctrine\CodeQuality\Enum\EntityMappingKey;
|
||||
use Rector\Doctrine\CodeQuality\NodeFactory\ArrayItemNodeFactory;
|
||||
use Rector\Doctrine\CodeQuality\ValueObject\EntityMapping;
|
||||
final class OneToManyAnnotationTransformer implements PropertyAnnotationTransformerInterface
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Doctrine\CodeQuality\NodeFactory\ArrayItemNodeFactory
|
||||
*/
|
||||
private $arrayItemNodeFactory;
|
||||
public function __construct(ArrayItemNodeFactory $arrayItemNodeFactory)
|
||||
{
|
||||
$this->arrayItemNodeFactory = $arrayItemNodeFactory;
|
||||
}
|
||||
public function transform(EntityMapping $entityMapping, PhpDocInfo $propertyPhpDocInfo, Property $property) : void
|
||||
{
|
||||
$oneToManyMapping = $entityMapping->matchOneToManyPropertyMapping($property);
|
||||
if (!\is_array($oneToManyMapping)) {
|
||||
return;
|
||||
}
|
||||
// handled by OrderBy mapping rule as standalone entity class
|
||||
unset($oneToManyMapping[EntityMappingKey::ORDER_BY]);
|
||||
$arrayItemNodes = $this->arrayItemNodeFactory->create($oneToManyMapping, ['targetEntity', 'mappedBy']);
|
||||
$spacelessPhpDocTagNode = DocTagNodeFactory::createSpacelessPhpDocTagNode($arrayItemNodes, $this->getClassName());
|
||||
$propertyPhpDocInfo->addPhpDocTagNode($spacelessPhpDocTagNode);
|
||||
}
|
||||
public function getClassName() : string
|
||||
{
|
||||
return 'Doctrine\\ORM\\Mapping\\OneToMany';
|
||||
}
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Doctrine\CodeQuality\AnnotationTransformer\PropertyAnnotationTransformer;
|
||||
|
||||
use PhpParser\Node\Stmt\Property;
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
|
||||
use Rector\BetterPhpDocParser\ValueObject\PhpDoc\DoctrineAnnotation\CurlyListNode;
|
||||
use Rector\Doctrine\CodeQuality\Contract\PropertyAnnotationTransformerInterface;
|
||||
use Rector\Doctrine\CodeQuality\DocTagNodeFactory;
|
||||
use Rector\Doctrine\CodeQuality\Enum\EntityMappingKey;
|
||||
use Rector\Doctrine\CodeQuality\NodeFactory\ArrayItemNodeFactory;
|
||||
use Rector\Doctrine\CodeQuality\ValueObject\EntityMapping;
|
||||
final class OrderByAnnotationTransformer implements PropertyAnnotationTransformerInterface
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Doctrine\CodeQuality\NodeFactory\ArrayItemNodeFactory
|
||||
*/
|
||||
private $arrayItemNodeFactory;
|
||||
public function __construct(ArrayItemNodeFactory $arrayItemNodeFactory)
|
||||
{
|
||||
$this->arrayItemNodeFactory = $arrayItemNodeFactory;
|
||||
}
|
||||
public function transform(EntityMapping $entityMapping, PhpDocInfo $propertyPhpDocInfo, Property $property) : void
|
||||
{
|
||||
$oneToManyMapping = $entityMapping->matchOneToManyPropertyMapping($property);
|
||||
if (!\is_array($oneToManyMapping)) {
|
||||
return;
|
||||
}
|
||||
// we handle OrderBy here only
|
||||
if (!isset($oneToManyMapping[EntityMappingKey::ORDER_BY])) {
|
||||
return;
|
||||
}
|
||||
$orderBy = $oneToManyMapping[EntityMappingKey::ORDER_BY];
|
||||
$arrayItemNodes = $this->arrayItemNodeFactory->createWithQuotes($orderBy);
|
||||
$spacelessPhpDocTagNode = DocTagNodeFactory::createSpacelessPhpDocTagNode([new CurlyListNode($arrayItemNodes)], $this->getClassName());
|
||||
$propertyPhpDocInfo->addPhpDocTagNode($spacelessPhpDocTagNode);
|
||||
}
|
||||
public function getClassName() : string
|
||||
{
|
||||
return 'Doctrine\\ORM\\Mapping\\OrderBy';
|
||||
}
|
||||
}
|
|
@ -1,76 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Doctrine\CodeQuality\AnnotationTransformer;
|
||||
|
||||
use PhpParser\Node\Stmt\Class_;
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory;
|
||||
use Rector\Comments\NodeDocBlock\DocBlockUpdater;
|
||||
use Rector\Doctrine\CodeQuality\Contract\ClassAnnotationTransformerInterface;
|
||||
use Rector\Doctrine\CodeQuality\Contract\PropertyAnnotationTransformerInterface;
|
||||
use Rector\Doctrine\CodeQuality\ValueObject\EntityMapping;
|
||||
final class YamlToAnnotationTransformer
|
||||
{
|
||||
/**
|
||||
* @var ClassAnnotationTransformerInterface[]
|
||||
* @readonly
|
||||
*/
|
||||
private $classAnnotationTransformers;
|
||||
/**
|
||||
* @var PropertyAnnotationTransformerInterface[]
|
||||
* @readonly
|
||||
*/
|
||||
private $propertyAnnotationTransformers;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfoFactory
|
||||
*/
|
||||
private $phpDocInfoFactory;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Comments\NodeDocBlock\DocBlockUpdater
|
||||
*/
|
||||
private $docBlockUpdater;
|
||||
/**
|
||||
* @param ClassAnnotationTransformerInterface[] $classAnnotationTransformers
|
||||
* @param PropertyAnnotationTransformerInterface[] $propertyAnnotationTransformers
|
||||
*/
|
||||
public function __construct(iterable $classAnnotationTransformers, iterable $propertyAnnotationTransformers, PhpDocInfoFactory $phpDocInfoFactory, DocBlockUpdater $docBlockUpdater)
|
||||
{
|
||||
$this->classAnnotationTransformers = $classAnnotationTransformers;
|
||||
$this->propertyAnnotationTransformers = $propertyAnnotationTransformers;
|
||||
$this->phpDocInfoFactory = $phpDocInfoFactory;
|
||||
$this->docBlockUpdater = $docBlockUpdater;
|
||||
}
|
||||
public function transform(Class_ $class, EntityMapping $entityMapping) : void
|
||||
{
|
||||
$this->transformClass($class, $entityMapping);
|
||||
$this->transformProperties($class, $entityMapping);
|
||||
}
|
||||
private function transformClass(Class_ $class, EntityMapping $entityMapping) : void
|
||||
{
|
||||
$classPhpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($class);
|
||||
foreach ($this->classAnnotationTransformers as $classAnnotationTransformer) {
|
||||
// already added
|
||||
if ($classPhpDocInfo->hasByAnnotationClass($classAnnotationTransformer->getClassName())) {
|
||||
continue;
|
||||
}
|
||||
$classAnnotationTransformer->transform($entityMapping, $classPhpDocInfo);
|
||||
}
|
||||
$this->docBlockUpdater->updateRefactoredNodeWithPhpDocInfo($class);
|
||||
}
|
||||
private function transformProperties(Class_ $class, EntityMapping $entityMapping) : void
|
||||
{
|
||||
foreach ($class->getProperties() as $property) {
|
||||
$propertyPhpDocInfo = $this->phpDocInfoFactory->createFromNodeOrEmpty($property);
|
||||
foreach ($this->propertyAnnotationTransformers as $propertyAnnotationTransformer) {
|
||||
// already added
|
||||
if ($propertyPhpDocInfo->hasByAnnotationClass($propertyAnnotationTransformer->getClassName())) {
|
||||
continue;
|
||||
}
|
||||
$propertyAnnotationTransformer->transform($entityMapping, $propertyPhpDocInfo, $property);
|
||||
}
|
||||
$this->docBlockUpdater->updateRefactoredNodeWithPhpDocInfo($property);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Doctrine\CodeQuality\AttributeTransformer\ClassAttributeTransformer;
|
||||
|
||||
use PhpParser\Node\Stmt\Class_;
|
||||
use Rector\Doctrine\CodeQuality\Contract\ClassAttributeTransformerInterface;
|
||||
use Rector\Doctrine\CodeQuality\NodeFactory\AttributeFactory;
|
||||
use Rector\Doctrine\CodeQuality\ValueObject\EntityMapping;
|
||||
use Rector\Doctrine\Enum\MappingClass;
|
||||
final class EmbeddableClassAttributeTransformer implements ClassAttributeTransformerInterface
|
||||
{
|
||||
public function transform(EntityMapping $entityMapping, Class_ $class) : void
|
||||
{
|
||||
$classMapping = $entityMapping->getClassMapping();
|
||||
$type = $classMapping['type'] ?? null;
|
||||
if ($type !== 'embeddable') {
|
||||
return;
|
||||
}
|
||||
$class->attrGroups[] = AttributeFactory::createGroup($this->getClassName());
|
||||
}
|
||||
public function getClassName() : string
|
||||
{
|
||||
return MappingClass::EMBEDDABLE;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Doctrine\CodeQuality\AttributeTransformer\ClassAttributeTransformer;
|
||||
|
||||
use PhpParser\Node\Expr\ClassConstFetch;
|
||||
use PhpParser\Node\Name\FullyQualified;
|
||||
use PhpParser\Node\Stmt\Class_;
|
||||
use Rector\Doctrine\CodeQuality\Contract\ClassAttributeTransformerInterface;
|
||||
use Rector\Doctrine\CodeQuality\NodeFactory\AttributeFactory;
|
||||
use Rector\Doctrine\CodeQuality\ValueObject\EntityMapping;
|
||||
use Rector\Doctrine\Enum\MappingClass;
|
||||
final class EntityClassAttributeTransformer implements ClassAttributeTransformerInterface
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private const REPOSITORY_CLASS_KEY = 'repositoryClass';
|
||||
public function transform(EntityMapping $entityMapping, Class_ $class) : void
|
||||
{
|
||||
$classMapping = $entityMapping->getClassMapping();
|
||||
$type = $classMapping['type'] ?? null;
|
||||
if ($type !== 'entity') {
|
||||
return;
|
||||
}
|
||||
$args = [];
|
||||
$repositoryClass = $classMapping[self::REPOSITORY_CLASS_KEY] ?? null;
|
||||
if ($repositoryClass) {
|
||||
$repositoryClassConstFetch = new ClassConstFetch(new FullyQualified($repositoryClass), 'class');
|
||||
$args[] = AttributeFactory::createNamedArg($repositoryClassConstFetch, self::REPOSITORY_CLASS_KEY);
|
||||
}
|
||||
$class->attrGroups[] = AttributeFactory::createGroup($this->getClassName(), $args);
|
||||
}
|
||||
public function getClassName() : string
|
||||
{
|
||||
return MappingClass::ENTITY;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Doctrine\CodeQuality\AttributeTransformer\ClassAttributeTransformer;
|
||||
|
||||
use PhpParser\Node\Expr\Array_;
|
||||
use PhpParser\Node\Expr\ArrayItem;
|
||||
use PhpParser\Node\Expr\ClassConstFetch;
|
||||
use PhpParser\Node\Identifier;
|
||||
use PhpParser\Node\Name\FullyQualified;
|
||||
use PhpParser\Node\Scalar\String_;
|
||||
use PhpParser\Node\Stmt\Class_;
|
||||
use Rector\Doctrine\CodeQuality\Contract\ClassAttributeTransformerInterface;
|
||||
use Rector\Doctrine\CodeQuality\NodeFactory\AttributeFactory;
|
||||
use Rector\Doctrine\CodeQuality\ValueObject\EntityMapping;
|
||||
use Rector\Doctrine\Enum\MappingClass;
|
||||
use Rector\PhpParser\Node\NodeFactory;
|
||||
final class InheritanceClassAttributeTransformer implements ClassAttributeTransformerInterface
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\PhpParser\Node\NodeFactory
|
||||
*/
|
||||
private $nodeFactory;
|
||||
public function __construct(NodeFactory $nodeFactory)
|
||||
{
|
||||
$this->nodeFactory = $nodeFactory;
|
||||
}
|
||||
public function transform(EntityMapping $entityMapping, Class_ $class) : void
|
||||
{
|
||||
$classMapping = $entityMapping->getClassMapping();
|
||||
$inheritanceType = $classMapping['inheritanceType'] ?? null;
|
||||
if ($inheritanceType === null) {
|
||||
return;
|
||||
}
|
||||
$class->attrGroups[] = AttributeFactory::createGroup(MappingClass::INHERITANCE_TYPE, [$inheritanceType]);
|
||||
if (isset($classMapping['discriminatorColumn'])) {
|
||||
$class->attrGroups[] = AttributeFactory::createGroup(MappingClass::DISCRIMINATOR_COLUMN, $classMapping['discriminatorColumn']);
|
||||
}
|
||||
if (isset($classMapping['discriminatorMap'])) {
|
||||
$this->addDiscriminatorMap($classMapping['discriminatorMap'], $class);
|
||||
}
|
||||
}
|
||||
public function getClassName() : string
|
||||
{
|
||||
return MappingClass::DISCRIMINATOR_MAP;
|
||||
}
|
||||
/**
|
||||
* @param array<string, mixed> $discriminatorMap
|
||||
*/
|
||||
private function addDiscriminatorMap(array $discriminatorMap, Class_ $class) : void
|
||||
{
|
||||
$args = $this->nodeFactory->createArgs([$discriminatorMap]);
|
||||
foreach ($args as $arg) {
|
||||
if ($arg->value instanceof Array_) {
|
||||
$array = $arg->value;
|
||||
foreach ($array->items as $arrayItem) {
|
||||
if (!$arrayItem instanceof ArrayItem) {
|
||||
continue;
|
||||
}
|
||||
if (!$arrayItem->value instanceof String_) {
|
||||
continue;
|
||||
}
|
||||
$string = $arrayItem->value;
|
||||
$arrayItem->value = new ClassConstFetch(new FullyQualified($string->value), new Identifier('class'));
|
||||
}
|
||||
}
|
||||
}
|
||||
// @todo all value should be class const
|
||||
$class->attrGroups[] = AttributeFactory::createGroup(MappingClass::DISCRIMINATOR_MAP, $args);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Doctrine\CodeQuality\AttributeTransformer\ClassAttributeTransformer;
|
||||
|
||||
use PhpParser\Node\Identifier;
|
||||
use PhpParser\Node\Stmt\Class_;
|
||||
use Rector\Doctrine\CodeQuality\Contract\ClassAttributeTransformerInterface;
|
||||
use Rector\Doctrine\CodeQuality\NodeFactory\AttributeFactory;
|
||||
use Rector\Doctrine\CodeQuality\Utils\CaseStringHelper;
|
||||
use Rector\Doctrine\CodeQuality\ValueObject\EntityMapping;
|
||||
use Rector\Doctrine\Enum\MappingClass;
|
||||
use Rector\PhpParser\Node\NodeFactory;
|
||||
final class SoftDeletableClassAttributeTransformer implements ClassAttributeTransformerInterface
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\PhpParser\Node\NodeFactory
|
||||
*/
|
||||
private $nodeFactory;
|
||||
public function __construct(NodeFactory $nodeFactory)
|
||||
{
|
||||
$this->nodeFactory = $nodeFactory;
|
||||
}
|
||||
public function transform(EntityMapping $entityMapping, Class_ $class) : void
|
||||
{
|
||||
$classMapping = $entityMapping->getClassMapping();
|
||||
$softDeletableMapping = $classMapping['gedmo']['soft_deleteable'] ?? null;
|
||||
if (!\is_array($softDeletableMapping)) {
|
||||
return;
|
||||
}
|
||||
$args = $this->nodeFactory->createArgs($softDeletableMapping);
|
||||
foreach ($args as $arg) {
|
||||
if (!$arg->name instanceof Identifier) {
|
||||
continue;
|
||||
}
|
||||
$arg->name = new Identifier(CaseStringHelper::camelCase($arg->name->toString()));
|
||||
}
|
||||
$class->attrGroups[] = AttributeFactory::createGroup($this->getClassName(), $args);
|
||||
}
|
||||
public function getClassName() : string
|
||||
{
|
||||
return MappingClass::GEDMO_SOFT_DELETEABLE;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Doctrine\CodeQuality\AttributeTransformer\ClassAttributeTransformer;
|
||||
|
||||
use PhpParser\Node\Scalar\String_;
|
||||
use PhpParser\Node\Stmt\Class_;
|
||||
use Rector\Doctrine\CodeQuality\Contract\ClassAttributeTransformerInterface;
|
||||
use Rector\Doctrine\CodeQuality\NodeFactory\AttributeFactory;
|
||||
use Rector\Doctrine\CodeQuality\ValueObject\EntityMapping;
|
||||
use Rector\Doctrine\Enum\MappingClass;
|
||||
use Rector\PhpParser\Node\NodeFactory;
|
||||
final class TableClassAttributeTransformer implements ClassAttributeTransformerInterface
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\PhpParser\Node\NodeFactory
|
||||
*/
|
||||
private $nodeFactory;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private const TABLE_KEY = 'table';
|
||||
public function __construct(NodeFactory $nodeFactory)
|
||||
{
|
||||
$this->nodeFactory = $nodeFactory;
|
||||
}
|
||||
public function transform(EntityMapping $entityMapping, Class_ $class) : void
|
||||
{
|
||||
$classMapping = $entityMapping->getClassMapping();
|
||||
$table = $classMapping[self::TABLE_KEY] ?? null;
|
||||
if (isset($classMapping['type']) && $classMapping['type'] !== 'entity') {
|
||||
return;
|
||||
}
|
||||
$args = [];
|
||||
if (\is_string($table)) {
|
||||
$args[] = AttributeFactory::createNamedArg(new String_($table), 'name');
|
||||
}
|
||||
$class->attrGroups[] = AttributeFactory::createGroup($this->getClassName(), $args);
|
||||
$uniqueConstraints = $classMapping['uniqueConstraints'] ?? [];
|
||||
foreach ($uniqueConstraints as $name => $uniqueConstraint) {
|
||||
$uniqueConstraint = \array_merge(['name' => $name], $uniqueConstraint);
|
||||
$args = $this->nodeFactory->createArgs($uniqueConstraint);
|
||||
$class->attrGroups[] = AttributeFactory::createGroup(MappingClass::UNIQUE_CONSTRAINT, $args);
|
||||
}
|
||||
}
|
||||
public function getClassName() : string
|
||||
{
|
||||
return MappingClass::TABLE;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Doctrine\CodeQuality\AttributeTransformer\PropertyAttributeTransformer;
|
||||
|
||||
use PhpParser\Node\Stmt\Property;
|
||||
use Rector\Doctrine\CodeQuality\Contract\PropertyAttributeTransformerInterface;
|
||||
use Rector\Doctrine\CodeQuality\Enum\EntityMappingKey;
|
||||
use Rector\Doctrine\CodeQuality\NodeFactory\AttributeFactory;
|
||||
use Rector\Doctrine\CodeQuality\ValueObject\EntityMapping;
|
||||
use Rector\Doctrine\Enum\MappingClass;
|
||||
use Rector\PhpParser\Node\NodeFactory;
|
||||
final class ColumnAttributeTransformer implements PropertyAttributeTransformerInterface
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\PhpParser\Node\NodeFactory
|
||||
*/
|
||||
private $nodeFactory;
|
||||
public function __construct(NodeFactory $nodeFactory)
|
||||
{
|
||||
$this->nodeFactory = $nodeFactory;
|
||||
}
|
||||
public function transform(EntityMapping $entityMapping, Property $property) : void
|
||||
{
|
||||
$propertyMapping = $entityMapping->matchFieldPropertyMapping($property);
|
||||
if ($propertyMapping === null) {
|
||||
return;
|
||||
}
|
||||
// handled in another mapper
|
||||
unset($propertyMapping['gedmo']);
|
||||
$args = [];
|
||||
// rename to "name"
|
||||
if (isset($propertyMapping[EntityMappingKey::COLUMN])) {
|
||||
$column = $propertyMapping[EntityMappingKey::COLUMN];
|
||||
$args[] = AttributeFactory::createNamedArg($column, EntityMappingKey::NAME);
|
||||
unset($propertyMapping[EntityMappingKey::COLUMN]);
|
||||
}
|
||||
$args = \array_merge($args, $this->nodeFactory->createArgs($propertyMapping));
|
||||
$property->attrGroups[] = AttributeFactory::createGroup($this->getClassName(), $args);
|
||||
}
|
||||
public function getClassName() : string
|
||||
{
|
||||
return MappingClass::COLUMN;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Doctrine\CodeQuality\AttributeTransformer\PropertyAttributeTransformer;
|
||||
|
||||
use PhpParser\Node\Stmt\Property;
|
||||
use Rector\Doctrine\CodeQuality\Contract\PropertyAttributeTransformerInterface;
|
||||
use Rector\Doctrine\CodeQuality\Helper\NodeValueNormalizer;
|
||||
use Rector\Doctrine\CodeQuality\NodeFactory\AttributeFactory;
|
||||
use Rector\Doctrine\CodeQuality\ValueObject\EntityMapping;
|
||||
use Rector\Doctrine\Enum\MappingClass;
|
||||
use Rector\PhpParser\Node\NodeFactory;
|
||||
final class EmbeddedPropertyAttributeTransformer implements PropertyAttributeTransformerInterface
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\PhpParser\Node\NodeFactory
|
||||
*/
|
||||
private $nodeFactory;
|
||||
public function __construct(NodeFactory $nodeFactory)
|
||||
{
|
||||
$this->nodeFactory = $nodeFactory;
|
||||
}
|
||||
public function transform(EntityMapping $entityMapping, Property $property) : void
|
||||
{
|
||||
$propertyMapping = $entityMapping->matchEmbeddedPropertyMapping($property);
|
||||
if ($propertyMapping === null) {
|
||||
return;
|
||||
}
|
||||
// handled in another attribute
|
||||
unset($propertyMapping['nullable']);
|
||||
$args = $this->nodeFactory->createArgs($propertyMapping);
|
||||
$property->attrGroups[] = AttributeFactory::createGroup($this->getClassName(), $args);
|
||||
NodeValueNormalizer::ensureKeyIsClassConstFetch($args, 'class');
|
||||
}
|
||||
public function getClassName() : string
|
||||
{
|
||||
return MappingClass::EMBEDDED;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Doctrine\CodeQuality\AttributeTransformer\PropertyAttributeTransformer;
|
||||
|
||||
use PhpParser\Node\Stmt\Property;
|
||||
use Rector\Doctrine\CodeQuality\Contract\PropertyAttributeTransformerInterface;
|
||||
use Rector\Doctrine\CodeQuality\NodeFactory\AttributeFactory;
|
||||
use Rector\Doctrine\CodeQuality\ValueObject\EntityMapping;
|
||||
use Rector\Doctrine\Enum\MappingClass;
|
||||
use Rector\PhpParser\Node\NodeFactory;
|
||||
final class GedmoTimestampableAttributeTransformer implements PropertyAttributeTransformerInterface
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\PhpParser\Node\NodeFactory
|
||||
*/
|
||||
private $nodeFactory;
|
||||
public function __construct(NodeFactory $nodeFactory)
|
||||
{
|
||||
$this->nodeFactory = $nodeFactory;
|
||||
}
|
||||
public function transform(EntityMapping $entityMapping, Property $property) : void
|
||||
{
|
||||
$fieldPropertyMapping = $entityMapping->matchFieldPropertyMapping($property);
|
||||
$timestampableMapping = $fieldPropertyMapping['gedmo']['timestampable'] ?? null;
|
||||
if (!\is_array($timestampableMapping)) {
|
||||
return;
|
||||
}
|
||||
$args = $this->nodeFactory->createArgs($timestampableMapping);
|
||||
$property->attrGroups[] = AttributeFactory::createGroup($this->getClassName(), $args);
|
||||
}
|
||||
public function getClassName() : string
|
||||
{
|
||||
return MappingClass::GEDMO_TIMESTAMPABLE;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Doctrine\CodeQuality\AttributeTransformer\PropertyAttributeTransformer;
|
||||
|
||||
use PhpParser\Node\Stmt\Property;
|
||||
use Rector\Doctrine\CodeQuality\Contract\PropertyAttributeTransformerInterface;
|
||||
use Rector\Doctrine\CodeQuality\NodeFactory\AttributeFactory;
|
||||
use Rector\Doctrine\CodeQuality\ValueObject\EntityMapping;
|
||||
use Rector\Doctrine\Enum\MappingClass;
|
||||
final class IdAttributeTransformer implements PropertyAttributeTransformerInterface
|
||||
{
|
||||
public function transform(EntityMapping $entityMapping, Property $property) : void
|
||||
{
|
||||
$idMapping = $entityMapping->matchIdPropertyMapping($property);
|
||||
if (!\is_array($idMapping)) {
|
||||
return;
|
||||
}
|
||||
$property->attrGroups[] = AttributeFactory::createGroup($this->getClassName());
|
||||
}
|
||||
public function getClassName() : string
|
||||
{
|
||||
return MappingClass::ID;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Doctrine\CodeQuality\AttributeTransformer\PropertyAttributeTransformer;
|
||||
|
||||
use PhpParser\Node\Stmt\Property;
|
||||
use Rector\Doctrine\CodeQuality\Contract\PropertyAttributeTransformerInterface;
|
||||
use Rector\Doctrine\CodeQuality\NodeFactory\AttributeFactory;
|
||||
use Rector\Doctrine\CodeQuality\ValueObject\EntityMapping;
|
||||
use Rector\Doctrine\Enum\MappingClass;
|
||||
final class IdColumnAttributeTransformer implements PropertyAttributeTransformerInterface
|
||||
{
|
||||
public function transform(EntityMapping $entityMapping, Property $property) : void
|
||||
{
|
||||
$idMapping = $entityMapping->matchIdPropertyMapping($property);
|
||||
if (!\is_array($idMapping)) {
|
||||
return;
|
||||
}
|
||||
$args = [];
|
||||
$type = $idMapping['type'] ?? null;
|
||||
if ($type) {
|
||||
$args[] = AttributeFactory::createNamedArg($type, 'type');
|
||||
}
|
||||
$property->attrGroups[] = AttributeFactory::createGroup($this->getClassName(), $args);
|
||||
}
|
||||
public function getClassName() : string
|
||||
{
|
||||
return MappingClass::COLUMN;
|
||||
}
|
||||
}
|
|
@ -1,32 +1,33 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Doctrine\CodeQuality\AnnotationTransformer\PropertyAnnotationTransformer;
|
||||
namespace Rector\Doctrine\CodeQuality\AttributeTransformer\PropertyAttributeTransformer;
|
||||
|
||||
use PhpParser\Node\Stmt\Property;
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
|
||||
use Rector\Doctrine\CodeQuality\Contract\PropertyAnnotationTransformerInterface;
|
||||
use Rector\Doctrine\CodeQuality\DocTagNodeFactory;
|
||||
use Rector\Doctrine\CodeQuality\Contract\PropertyAttributeTransformerInterface;
|
||||
use Rector\Doctrine\CodeQuality\Enum\EntityMappingKey;
|
||||
use Rector\Doctrine\CodeQuality\NodeFactory\ArrayItemNodeFactory;
|
||||
use Rector\Doctrine\CodeQuality\NodeFactory\AttributeFactory;
|
||||
use Rector\Doctrine\CodeQuality\ValueObject\EntityMapping;
|
||||
final class IdGeneratorAnnotationTransformer implements PropertyAnnotationTransformerInterface
|
||||
use Rector\Doctrine\Enum\MappingClass;
|
||||
use Rector\PhpParser\Node\NodeFactory;
|
||||
final class IdGeneratorAttributeTransformer implements PropertyAttributeTransformerInterface
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Doctrine\CodeQuality\NodeFactory\ArrayItemNodeFactory
|
||||
* @var \Rector\PhpParser\Node\NodeFactory
|
||||
*/
|
||||
private $arrayItemNodeFactory;
|
||||
private $nodeFactory;
|
||||
/**
|
||||
* @see https://www.doctrine-project.org/projects/doctrine-orm/en/3.0/reference/basic-mapping.html#identifier-generation-strategies
|
||||
* @var string[]
|
||||
*/
|
||||
private const AVAILABLE_STRATEGIES = ['auto', 'sequence', 'identity', 'none', 'custom'];
|
||||
public function __construct(ArrayItemNodeFactory $arrayItemNodeFactory)
|
||||
public function __construct(NodeFactory $nodeFactory)
|
||||
{
|
||||
$this->arrayItemNodeFactory = $arrayItemNodeFactory;
|
||||
// private ArrayItemNodeFactory $arrayItemNodeFactory
|
||||
$this->nodeFactory = $nodeFactory;
|
||||
}
|
||||
public function transform(EntityMapping $entityMapping, PhpDocInfo $propertyPhpDocInfo, Property $property) : void
|
||||
public function transform(EntityMapping $entityMapping, Property $property) : void
|
||||
{
|
||||
$idMapping = $entityMapping->matchIdPropertyMapping($property);
|
||||
if (!\is_array($idMapping)) {
|
||||
|
@ -38,13 +39,12 @@ final class IdGeneratorAnnotationTransformer implements PropertyAnnotationTransf
|
|||
}
|
||||
// make sure strategy is uppercase as constant value
|
||||
$generator = $this->normalizeStrategy($generator);
|
||||
$arrayItemNodes = $this->arrayItemNodeFactory->create($generator, [EntityMappingKey::STRATEGY]);
|
||||
$spacelessPhpDocTagNode = DocTagNodeFactory::createSpacelessPhpDocTagNode($arrayItemNodes, $this->getClassName());
|
||||
$propertyPhpDocInfo->addPhpDocTagNode($spacelessPhpDocTagNode);
|
||||
$args = $this->nodeFactory->createArgs($generator);
|
||||
$property->attrGroups[] = AttributeFactory::createGroup($this->getClassName(), $args);
|
||||
}
|
||||
public function getClassName() : string
|
||||
{
|
||||
return 'Doctrine\\ORM\\Mapping\\GeneratedValue';
|
||||
return MappingClass::GENERATED_VALUE;
|
||||
}
|
||||
/**
|
||||
* @param array<string, mixed> $generator
|
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Doctrine\CodeQuality\AttributeTransformer\PropertyAttributeTransformer;
|
||||
|
||||
use PhpParser\Node\AttributeGroup;
|
||||
use PhpParser\Node\Stmt\Property;
|
||||
use Rector\Doctrine\CodeQuality\Contract\PropertyAttributeTransformerInterface;
|
||||
use Rector\Doctrine\CodeQuality\NodeFactory\AttributeFactory;
|
||||
use Rector\Doctrine\CodeQuality\ValueObject\EntityMapping;
|
||||
use Rector\Doctrine\Enum\MappingClass;
|
||||
use Rector\PhpParser\Node\NodeFactory;
|
||||
final class JoinColumnAttributeTransformer implements PropertyAttributeTransformerInterface
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\PhpParser\Node\NodeFactory
|
||||
*/
|
||||
private $nodeFactory;
|
||||
public function __construct(NodeFactory $nodeFactory)
|
||||
{
|
||||
$this->nodeFactory = $nodeFactory;
|
||||
}
|
||||
public function transform(EntityMapping $entityMapping, Property $property) : void
|
||||
{
|
||||
$manyToOnePropertyMapping = $entityMapping->matchManyToOnePropertyMapping($property);
|
||||
if (!\is_array($manyToOnePropertyMapping)) {
|
||||
return;
|
||||
}
|
||||
$joinColumns = $manyToOnePropertyMapping['joinColumns'] ?? null;
|
||||
if (!\is_array($joinColumns)) {
|
||||
return;
|
||||
}
|
||||
foreach ($joinColumns as $columnName => $joinColumn) {
|
||||
$property->attrGroups[] = $this->createJoinColumnAttrGroup($columnName, $joinColumn);
|
||||
}
|
||||
}
|
||||
public function getClassName() : string
|
||||
{
|
||||
return MappingClass::JOIN_COLUMN;
|
||||
}
|
||||
/**
|
||||
* @param int|string $columnName
|
||||
* @param mixed $joinColumn
|
||||
*/
|
||||
private function createJoinColumnAttrGroup($columnName, $joinColumn) : AttributeGroup
|
||||
{
|
||||
$joinColumn = \array_merge(['name' => $columnName], $joinColumn);
|
||||
$args = $this->nodeFactory->createArgs($joinColumn);
|
||||
return AttributeFactory::createGroup($this->getClassName(), $args);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Doctrine\CodeQuality\AttributeTransformer\PropertyAttributeTransformer;
|
||||
|
||||
use PhpParser\Node\Stmt\Property;
|
||||
use Rector\Doctrine\CodeQuality\Contract\PropertyAttributeTransformerInterface;
|
||||
use Rector\Doctrine\CodeQuality\Enum\EntityMappingKey;
|
||||
use Rector\Doctrine\CodeQuality\Helper\NodeValueNormalizer;
|
||||
use Rector\Doctrine\CodeQuality\NodeFactory\AttributeFactory;
|
||||
use Rector\Doctrine\CodeQuality\ValueObject\EntityMapping;
|
||||
use Rector\Doctrine\Enum\MappingClass;
|
||||
use Rector\PhpParser\Node\NodeFactory;
|
||||
final class ManyToOneAttributeTransformer implements PropertyAttributeTransformerInterface
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\PhpParser\Node\NodeFactory
|
||||
*/
|
||||
private $nodeFactory;
|
||||
public function __construct(NodeFactory $nodeFactory)
|
||||
{
|
||||
$this->nodeFactory = $nodeFactory;
|
||||
}
|
||||
public function transform(EntityMapping $entityMapping, Property $property) : void
|
||||
{
|
||||
$manyToOneMapping = $entityMapping->matchManyToOnePropertyMapping($property);
|
||||
if (!\is_array($manyToOneMapping)) {
|
||||
return;
|
||||
}
|
||||
// handled by another mapper
|
||||
unset($manyToOneMapping['joinColumns']);
|
||||
$args = $this->nodeFactory->createArgs($manyToOneMapping);
|
||||
$property->attrGroups[] = AttributeFactory::createGroup($this->getClassName(), $args);
|
||||
NodeValueNormalizer::ensureKeyIsClassConstFetch($args, EntityMappingKey::TARGET_ENTITY);
|
||||
}
|
||||
public function getClassName() : string
|
||||
{
|
||||
return MappingClass::MANY_TO_ONE;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Doctrine\CodeQuality\AttributeTransformer\PropertyAttributeTransformer;
|
||||
|
||||
use PhpParser\Node\Stmt\Property;
|
||||
use Rector\Doctrine\CodeQuality\Contract\PropertyAttributeTransformerInterface;
|
||||
use Rector\Doctrine\CodeQuality\Enum\EntityMappingKey;
|
||||
use Rector\Doctrine\CodeQuality\Helper\NodeValueNormalizer;
|
||||
use Rector\Doctrine\CodeQuality\NodeFactory\AttributeFactory;
|
||||
use Rector\Doctrine\CodeQuality\ValueObject\EntityMapping;
|
||||
use Rector\Doctrine\Enum\MappingClass;
|
||||
use Rector\PhpParser\Node\NodeFactory;
|
||||
final class OneToManyAttributeTransformer implements PropertyAttributeTransformerInterface
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\PhpParser\Node\NodeFactory
|
||||
*/
|
||||
private $nodeFactory;
|
||||
public function __construct(NodeFactory $nodeFactory)
|
||||
{
|
||||
$this->nodeFactory = $nodeFactory;
|
||||
}
|
||||
public function transform(EntityMapping $entityMapping, Property $property) : void
|
||||
{
|
||||
$oneToManyMapping = $entityMapping->matchOneToManyPropertyMapping($property);
|
||||
if (!\is_array($oneToManyMapping)) {
|
||||
return;
|
||||
}
|
||||
// handled by OrderBy mapping rule as standalone entity class
|
||||
unset($oneToManyMapping[EntityMappingKey::ORDER_BY]);
|
||||
$args = $this->nodeFactory->createArgs($oneToManyMapping);
|
||||
NodeValueNormalizer::ensureKeyIsClassConstFetch($args, 'targetEntity');
|
||||
$property->attrGroups[] = AttributeFactory::createGroup($this->getClassName(), $args);
|
||||
}
|
||||
public function getClassName() : string
|
||||
{
|
||||
return MappingClass::ONE_TO_MANY;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Doctrine\CodeQuality\AttributeTransformer\PropertyAttributeTransformer;
|
||||
|
||||
use PhpParser\Node\Stmt\Property;
|
||||
use Rector\Doctrine\CodeQuality\Contract\PropertyAttributeTransformerInterface;
|
||||
use Rector\Doctrine\CodeQuality\Enum\EntityMappingKey;
|
||||
use Rector\Doctrine\CodeQuality\NodeFactory\AttributeFactory;
|
||||
use Rector\Doctrine\CodeQuality\ValueObject\EntityMapping;
|
||||
use Rector\Doctrine\Enum\MappingClass;
|
||||
use Rector\PhpParser\Node\NodeFactory;
|
||||
final class OrderByAttributeTransformer implements PropertyAttributeTransformerInterface
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\PhpParser\Node\NodeFactory
|
||||
*/
|
||||
private $nodeFactory;
|
||||
public function __construct(NodeFactory $nodeFactory)
|
||||
{
|
||||
$this->nodeFactory = $nodeFactory;
|
||||
}
|
||||
public function transform(EntityMapping $entityMapping, Property $property) : void
|
||||
{
|
||||
$oneToManyMapping = $entityMapping->matchOneToManyPropertyMapping($property);
|
||||
if (!\is_array($oneToManyMapping)) {
|
||||
return;
|
||||
}
|
||||
// we handle OrderBy here only
|
||||
if (!isset($oneToManyMapping[EntityMappingKey::ORDER_BY])) {
|
||||
return;
|
||||
}
|
||||
$orderBy = $oneToManyMapping[EntityMappingKey::ORDER_BY];
|
||||
$args = $this->nodeFactory->createArgs([$orderBy]);
|
||||
$property->attrGroups[] = AttributeFactory::createGroup($this->getClassName(), $args);
|
||||
}
|
||||
public function getClassName() : string
|
||||
{
|
||||
return MappingClass::ORDER_BY;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Doctrine\CodeQuality\AttributeTransformer;
|
||||
|
||||
use PhpParser\Node\Stmt\Class_;
|
||||
use PhpParser\Node\Stmt\Property;
|
||||
use Rector\Doctrine\CodeQuality\Contract\ClassAttributeTransformerInterface;
|
||||
use Rector\Doctrine\CodeQuality\Contract\PropertyAttributeTransformerInterface;
|
||||
use Rector\Doctrine\CodeQuality\ValueObject\EntityMapping;
|
||||
final class YamlToAttributeTransformer
|
||||
{
|
||||
/**
|
||||
* @var ClassAttributeTransformerInterface[]
|
||||
* @readonly
|
||||
*/
|
||||
private $classAttributeTransformers;
|
||||
/**
|
||||
* @var PropertyAttributeTransformerInterface[]
|
||||
* @readonly
|
||||
*/
|
||||
private $propertyAttributeTransformers;
|
||||
/**
|
||||
* @param ClassAttributeTransformerInterface[] $classAttributeTransformers
|
||||
* @param PropertyAttributeTransformerInterface[] $propertyAttributeTransformers
|
||||
*/
|
||||
public function __construct(iterable $classAttributeTransformers, iterable $propertyAttributeTransformers)
|
||||
{
|
||||
$this->classAttributeTransformers = $classAttributeTransformers;
|
||||
$this->propertyAttributeTransformers = $propertyAttributeTransformers;
|
||||
}
|
||||
public function transform(Class_ $class, EntityMapping $entityMapping) : void
|
||||
{
|
||||
$this->transformClass($class, $entityMapping);
|
||||
$this->transformProperties($class, $entityMapping);
|
||||
}
|
||||
private function transformClass(Class_ $class, EntityMapping $entityMapping) : void
|
||||
{
|
||||
foreach ($this->classAttributeTransformers as $classAttributeTransformer) {
|
||||
if ($this->hasAttribute($class, $classAttributeTransformer->getClassName())) {
|
||||
continue;
|
||||
}
|
||||
$classAttributeTransformer->transform($entityMapping, $class);
|
||||
}
|
||||
}
|
||||
private function transformProperties(Class_ $class, EntityMapping $entityMapping) : void
|
||||
{
|
||||
foreach ($class->getProperties() as $property) {
|
||||
foreach ($this->propertyAttributeTransformers as $propertyAttributeTransformer) {
|
||||
if ($this->hasAttribute($property, $propertyAttributeTransformer->getClassName())) {
|
||||
continue;
|
||||
}
|
||||
$propertyAttributeTransformer->transform($entityMapping, $property);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param \PhpParser\Node\Stmt\Class_|\PhpParser\Node\Stmt\Property $stmt
|
||||
*/
|
||||
private function hasAttribute($stmt, string $attributeClassName) : bool
|
||||
{
|
||||
foreach ($stmt->attrGroups as $attrGroup) {
|
||||
foreach ($attrGroup->attrs as $attr) {
|
||||
if ($attr->name->toString() === $attributeClassName) {
|
||||
return \true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return \false;
|
||||
}
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Doctrine\CodeQuality\Contract;
|
||||
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
|
||||
use Rector\Doctrine\CodeQuality\ValueObject\EntityMapping;
|
||||
interface ClassAnnotationTransformerInterface
|
||||
{
|
||||
public function getClassName() : string;
|
||||
public function transform(EntityMapping $entityMapping, PhpDocInfo $classPhpDocInfo) : void;
|
||||
}
|
16
vendor/rector/rector-doctrine/rules/CodeQuality/Contract/ClassAttributeTransformerInterface.php
vendored
Normal file
16
vendor/rector/rector-doctrine/rules/CodeQuality/Contract/ClassAttributeTransformerInterface.php
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Doctrine\CodeQuality\Contract;
|
||||
|
||||
use PhpParser\Node\Stmt\Class_;
|
||||
use Rector\Doctrine\CodeQuality\ValueObject\EntityMapping;
|
||||
use Rector\Doctrine\Enum\MappingClass;
|
||||
interface ClassAttributeTransformerInterface
|
||||
{
|
||||
/**
|
||||
* @return MappingClass::*
|
||||
*/
|
||||
public function getClassName() : string;
|
||||
public function transform(EntityMapping $entityMapping, Class_ $class) : void;
|
||||
}
|
|
@ -4,10 +4,9 @@ declare (strict_types=1);
|
|||
namespace Rector\Doctrine\CodeQuality\Contract;
|
||||
|
||||
use PhpParser\Node\Stmt\Property;
|
||||
use Rector\BetterPhpDocParser\PhpDocInfo\PhpDocInfo;
|
||||
use Rector\Doctrine\CodeQuality\ValueObject\EntityMapping;
|
||||
interface PropertyAnnotationTransformerInterface
|
||||
interface PropertyAttributeTransformerInterface
|
||||
{
|
||||
public function getClassName() : string;
|
||||
public function transform(EntityMapping $entityMapping, PhpDocInfo $propertyPhpDocInfo, Property $property) : void;
|
||||
public function transform(EntityMapping $entityMapping, Property $property) : void;
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Doctrine\CodeQuality;
|
||||
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagValueNode;
|
||||
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
|
||||
use Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode;
|
||||
use Rector\BetterPhpDocParser\PhpDoc\SpacelessPhpDocTagNode;
|
||||
final class DocTagNodeFactory
|
||||
{
|
||||
/**
|
||||
* @param PhpDocTagValueNode[] $arrayItemNodes
|
||||
*/
|
||||
public static function createSpacelessPhpDocTagNode(array $arrayItemNodes, string $className) : SpacelessPhpDocTagNode
|
||||
{
|
||||
$columDoctrineAnnotationTagValueNode = new DoctrineAnnotationTagValueNode(new IdentifierTypeNode('@\\' . $className), null, $arrayItemNodes);
|
||||
return new SpacelessPhpDocTagNode('@\\' . $className, $columDoctrineAnnotationTagValueNode);
|
||||
}
|
||||
}
|
|
@ -3,6 +3,9 @@
|
|||
declare (strict_types=1);
|
||||
namespace Rector\Doctrine\CodeQuality\Enum;
|
||||
|
||||
/**
|
||||
* @api
|
||||
*/
|
||||
final class EntityMappingKey
|
||||
{
|
||||
/**
|
||||
|
@ -33,14 +36,6 @@ final class EntityMappingKey
|
|||
* @var string
|
||||
*/
|
||||
public const NAME = 'name';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const TYPE = 'type';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const INVERSED_BY = 'inversedBy';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
|
|
|
@ -3,21 +3,35 @@
|
|||
declare (strict_types=1);
|
||||
namespace Rector\Doctrine\CodeQuality\Helper;
|
||||
|
||||
use Rector\BetterPhpDocParser\PhpDoc\StringNode;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr\ClassConstFetch;
|
||||
use PhpParser\Node\Identifier;
|
||||
use PhpParser\Node\Name\FullyQualified;
|
||||
use PhpParser\Node\Scalar\String_;
|
||||
final class NodeValueNormalizer
|
||||
{
|
||||
/**
|
||||
* @param mixed $value
|
||||
* @return mixed
|
||||
* @param Arg[] $args
|
||||
*/
|
||||
public static function normalize($value)
|
||||
public static function ensureKeyIsClassConstFetch(array $args, string $argumentName) : void
|
||||
{
|
||||
if (\is_bool($value)) {
|
||||
return $value ? 'true' : 'false';
|
||||
foreach ($args as $arg) {
|
||||
if (!$arg->name instanceof Identifier) {
|
||||
continue;
|
||||
}
|
||||
if ($arg->name->toString() !== $argumentName) {
|
||||
continue;
|
||||
}
|
||||
// already done
|
||||
if ($arg->value instanceof ClassConstFetch) {
|
||||
continue;
|
||||
}
|
||||
$value = $arg->value;
|
||||
// we need string reference
|
||||
if (!$value instanceof String_) {
|
||||
continue;
|
||||
}
|
||||
$arg->value = new ClassConstFetch(new FullyQualified($value->value), new Identifier('class'));
|
||||
}
|
||||
if (\is_numeric($value)) {
|
||||
return $value;
|
||||
}
|
||||
return new StringNode($value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,73 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Doctrine\CodeQuality\NodeFactory;
|
||||
|
||||
use Rector\BetterPhpDocParser\PhpDoc\ArrayItemNode;
|
||||
use Rector\BetterPhpDocParser\PhpDoc\StringNode;
|
||||
use Rector\BetterPhpDocParser\ValueObject\PhpDoc\DoctrineAnnotation\CurlyListNode;
|
||||
use Rector\Doctrine\CodeQuality\Enum\EntityMappingKey;
|
||||
use Rector\Doctrine\CodeQuality\Helper\NodeValueNormalizer;
|
||||
use RectorPrefix202402\Webmozart\Assert\Assert;
|
||||
final class ArrayItemNodeFactory
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private const QUOTE_ALL = '*';
|
||||
/**
|
||||
* These are handled in their own transformers
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
private const EXTENSION_KEYS = ['gedmo', 'joinColumns'];
|
||||
/**
|
||||
* @param array<string, mixed> $propertyMapping
|
||||
* @return ArrayItemNode[]
|
||||
*/
|
||||
public function createWithQuotes(array $propertyMapping) : array
|
||||
{
|
||||
return $this->create($propertyMapping, [self::QUOTE_ALL]);
|
||||
}
|
||||
/**
|
||||
* @param array<string, mixed> $propertyMapping
|
||||
* @param string[] $quotedFields
|
||||
*
|
||||
* @return ArrayItemNode[]
|
||||
*/
|
||||
public function create(array $propertyMapping, array $quotedFields = []) : array
|
||||
{
|
||||
Assert::allString($quotedFields);
|
||||
$arrayItemNodes = [];
|
||||
foreach ($propertyMapping as $fieldKey => $fieldValue) {
|
||||
if (\in_array($fieldKey, self::EXTENSION_KEYS, \true)) {
|
||||
continue;
|
||||
}
|
||||
if (\is_array($fieldValue)) {
|
||||
$fieldValueArrayItemNodes = [];
|
||||
foreach ($fieldValue as $fieldSingleKey => $fieldSingleValue) {
|
||||
$fieldSingleNode = NodeValueNormalizer::normalize($fieldSingleValue);
|
||||
$fieldArrayItemNode = new ArrayItemNode($fieldSingleNode, \is_string($fieldSingleKey) ? new StringNode($fieldSingleKey) : null);
|
||||
$fieldValueArrayItemNodes[] = $fieldArrayItemNode;
|
||||
}
|
||||
$arrayItemNodes[] = new ArrayItemNode(new CurlyListNode($fieldValueArrayItemNodes), $fieldKey);
|
||||
continue;
|
||||
}
|
||||
if ($quotedFields === [self::QUOTE_ALL]) {
|
||||
$arrayItemNodes[] = new ArrayItemNode(new StringNode($fieldValue), new StringNode($fieldKey));
|
||||
continue;
|
||||
}
|
||||
if (\in_array($fieldKey, [EntityMappingKey::NULLABLE, EntityMappingKey::COLUMN_PREFIX], \true) && \is_bool($fieldValue)) {
|
||||
$arrayItemNodes[] = new ArrayItemNode($fieldValue ? 'true' : 'false', $fieldKey);
|
||||
continue;
|
||||
}
|
||||
if (\in_array($fieldKey, $quotedFields, \true)) {
|
||||
$arrayItemNodes[] = new ArrayItemNode(new StringNode($fieldValue), $fieldKey);
|
||||
continue;
|
||||
}
|
||||
$fieldValue = NodeValueNormalizer::normalize($fieldValue);
|
||||
$arrayItemNodes[] = new ArrayItemNode($fieldValue, $fieldKey);
|
||||
}
|
||||
return $arrayItemNodes;
|
||||
}
|
||||
}
|
36
vendor/rector/rector-doctrine/rules/CodeQuality/NodeFactory/AttributeFactory.php
vendored
Normal file
36
vendor/rector/rector-doctrine/rules/CodeQuality/NodeFactory/AttributeFactory.php
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Doctrine\CodeQuality\NodeFactory;
|
||||
|
||||
use PhpParser\BuilderFactory;
|
||||
use PhpParser\BuilderHelpers;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Attribute;
|
||||
use PhpParser\Node\AttributeGroup;
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Identifier;
|
||||
use PhpParser\Node\Name\FullyQualified;
|
||||
final class AttributeFactory
|
||||
{
|
||||
/**
|
||||
* @param mixed $expr
|
||||
*/
|
||||
public static function createNamedArg($expr, string $name) : Arg
|
||||
{
|
||||
if (!$expr instanceof Expr) {
|
||||
$expr = BuilderHelpers::normalizeValue($expr);
|
||||
}
|
||||
return new Arg($expr, \false, \false, [], new Identifier($name));
|
||||
}
|
||||
/**
|
||||
* @param array<mixed|Arg> $values
|
||||
*/
|
||||
public static function createGroup(string $className, array $values = []) : AttributeGroup
|
||||
{
|
||||
$builderFactory = new BuilderFactory();
|
||||
$args = $builderFactory->args($values);
|
||||
$attribute = new Attribute(new FullyQualified($className), $args);
|
||||
return new AttributeGroup([$attribute]);
|
||||
}
|
||||
}
|
|
@ -7,19 +7,21 @@ use PhpParser\Node;
|
|||
use PhpParser\Node\Stmt\Class_;
|
||||
use Rector\Contract\DependencyInjection\RelatedConfigInterface;
|
||||
use Rector\Contract\Rector\ConfigurableRectorInterface;
|
||||
use Rector\Doctrine\CodeQuality\AnnotationTransformer\YamlToAnnotationTransformer;
|
||||
use Rector\Doctrine\CodeQuality\AttributeTransformer\YamlToAttributeTransformer;
|
||||
use Rector\Doctrine\CodeQuality\EntityMappingResolver;
|
||||
use Rector\Doctrine\CodeQuality\ValueObject\EntityMapping;
|
||||
use Rector\Doctrine\Set\DoctrineSetList;
|
||||
use Rector\Exception\ShouldNotHappenException;
|
||||
use Rector\Rector\AbstractRector;
|
||||
use Rector\ValueObject\PhpVersion;
|
||||
use Rector\VersionBonding\Contract\MinPhpVersionInterface;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\ConfiguredCodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
use RectorPrefix202402\Webmozart\Assert\Assert;
|
||||
/**
|
||||
* @see \Rector\Doctrine\Tests\CodeQuality\Rector\Class_\YamlToAnnotationsDoctrineMappingRector\YamlToAnnotationsDoctrineMappingRectorTest
|
||||
* @see \Rector\Doctrine\Tests\CodeQuality\Rector\Class_\YamlToAttributeDoctrineMappingRector\YamlToAttributeDoctrineMappingRectorTest
|
||||
*/
|
||||
final class YamlToAnnotationsDoctrineMappingRector extends AbstractRector implements ConfigurableRectorInterface, RelatedConfigInterface
|
||||
final class YamlToAttributeDoctrineMappingRector extends AbstractRector implements ConfigurableRectorInterface, RelatedConfigInterface, MinPhpVersionInterface
|
||||
{
|
||||
/**
|
||||
* @readonly
|
||||
|
@ -28,17 +30,17 @@ final class YamlToAnnotationsDoctrineMappingRector extends AbstractRector implem
|
|||
private $entityMappingResolver;
|
||||
/**
|
||||
* @readonly
|
||||
* @var \Rector\Doctrine\CodeQuality\AnnotationTransformer\YamlToAnnotationTransformer
|
||||
* @var \Rector\Doctrine\CodeQuality\AttributeTransformer\YamlToAttributeTransformer
|
||||
*/
|
||||
private $yamlToAnnotationTransformer;
|
||||
private $yamlToAttributeTransformer;
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
private $yamlMappingDirectories = [];
|
||||
public function __construct(EntityMappingResolver $entityMappingResolver, YamlToAnnotationTransformer $yamlToAnnotationTransformer)
|
||||
public function __construct(EntityMappingResolver $entityMappingResolver, YamlToAttributeTransformer $yamlToAttributeTransformer)
|
||||
{
|
||||
$this->entityMappingResolver = $entityMappingResolver;
|
||||
$this->yamlToAnnotationTransformer = $yamlToAnnotationTransformer;
|
||||
$this->yamlToAttributeTransformer = $yamlToAttributeTransformer;
|
||||
}
|
||||
public function getRuleDefinition() : RuleDefinition
|
||||
{
|
||||
|
@ -53,21 +55,15 @@ CODE_SAMPLE
|
|||
, <<<'CODE_SAMPLE'
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* @ORM\Entity
|
||||
*/
|
||||
#[ORM\Entity]
|
||||
class SomeEntity
|
||||
{
|
||||
/**
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column(type: 'integer')]
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string")
|
||||
*/
|
||||
#[ORM\Column(type: 'string')]
|
||||
private $name;
|
||||
}
|
||||
|
||||
|
@ -90,7 +86,7 @@ CODE_SAMPLE
|
|||
if (!$entityMapping instanceof EntityMapping) {
|
||||
return null;
|
||||
}
|
||||
$this->yamlToAnnotationTransformer->transform($node, $entityMapping);
|
||||
$this->yamlToAttributeTransformer->transform($node, $entityMapping);
|
||||
return $node;
|
||||
}
|
||||
/**
|
||||
|
@ -106,6 +102,11 @@ CODE_SAMPLE
|
|||
{
|
||||
return DoctrineSetList::YAML_TO_ANNOTATIONS;
|
||||
}
|
||||
public function provideMinPhpVersion() : int
|
||||
{
|
||||
// required by Doctrine nested attributes
|
||||
return PhpVersion::PHP_81;
|
||||
}
|
||||
private function findEntityMapping(Class_ $class) : ?EntityMapping
|
||||
{
|
||||
$className = $this->getName($class);
|
|
@ -9,4 +9,68 @@ final class MappingClass
|
|||
* @var string
|
||||
*/
|
||||
public const COLUMN = 'Doctrine\\ORM\\Mapping\\Column';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const TABLE = 'Doctrine\\ORM\\Mapping\\Table';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const ENTITY = 'Doctrine\\ORM\\Mapping\\Entity';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const EMBEDDABLE = 'Doctrine\\ORM\\Mapping\\Embeddable';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const DISCRIMINATOR_MAP = 'Doctrine\\ORM\\Mapping\\DiscriminatorMap';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const INHERITANCE_TYPE = 'Doctrine\\ORM\\Mapping\\InheritanceType';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const DISCRIMINATOR_COLUMN = 'Doctrine\\ORM\\Mapping\\DiscriminatorColumn';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const EMBEDDED = 'Doctrine\\ORM\\Mapping\\Embedded';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const GEDMO_SOFT_DELETEABLE = 'Gedmo\\Mapping\\Annotation\\SoftDeleteable';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const GEDMO_TIMESTAMPABLE = 'Gedmo\\Mapping\\Annotation\\Timestampable';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const ID = 'Doctrine\\ORM\\Mapping\\Id';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const GENERATED_VALUE = 'Doctrine\\ORM\\Mapping\\GeneratedValue';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const MANY_TO_ONE = 'Doctrine\\ORM\\Mapping\\ManyToOne';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const JOIN_COLUMN = 'Doctrine\\ORM\\Mapping\\JoinColumn';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const ORDER_BY = 'Doctrine\\ORM\\Mapping\\OrderBy';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const ONE_TO_MANY = 'Doctrine\\ORM\\Mapping\\OneToMany';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public const UNIQUE_CONSTRAINT = 'Doctrine\\ORM\\Mapping\\UniqueConstraint';
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ final class AttributeFinder
|
|||
return $this->findAttributeByClassesArgByName($node, [$attributeClass], $argName);
|
||||
}
|
||||
/**
|
||||
* @param class-string[] $attributeClasses
|
||||
* @param string[] $attributeClasses
|
||||
* @param \PhpParser\Node\Stmt\ClassMethod|\PhpParser\Node\Stmt\Property|\PhpParser\Node\Stmt\ClassLike|\PhpParser\Node\Param $node
|
||||
*/
|
||||
public function findAttributeByClassesArgByName($node, array $attributeClasses, string $argName) : ?Expr
|
||||
|
|
Loading…
Reference in New Issue
Block a user