@@ -25,11 +25,11 @@ |
||
25 | 25 | /** @var FieldMetadata $value */ |
26 | 26 | $variableExporter = new VariableExporter(); |
27 | 27 | $indentation = str_repeat(self::INDENTATION, $indentationLevel); |
28 | - $objectReference = $indentation . self::VARIABLE; |
|
28 | + $objectReference = $indentation.self::VARIABLE; |
|
29 | 29 | |
30 | 30 | $lines = []; |
31 | 31 | $lines[] = parent::export($value, $indentationLevel); |
32 | - $lines[] = $objectReference . '->setVersioned(' . ltrim($variableExporter->export($value->isVersioned(), $indentationLevel + 1)) . ');'; |
|
32 | + $lines[] = $objectReference.'->setVersioned('.ltrim($variableExporter->export($value->isVersioned(), $indentationLevel + 1)).');'; |
|
33 | 33 | |
34 | 34 | return implode(PHP_EOL, $lines); |
35 | 35 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | use function strtoupper; |
40 | 40 | use function unserialize; |
41 | 41 | |
42 | -require_once __DIR__ . '/../../Models/Global/GlobalNamespaceModel.php'; |
|
42 | +require_once __DIR__.'/../../Models/Global/GlobalNamespaceModel.php'; |
|
43 | 43 | |
44 | 44 | class ClassMetadataTest extends OrmTestCase |
45 | 45 | { |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | */ |
183 | 183 | public function testMapAssociationInGlobalNamespace() : void |
184 | 184 | { |
185 | - require_once __DIR__ . '/../../Models/Global/GlobalNamespaceModel.php'; |
|
185 | + require_once __DIR__.'/../../Models/Global/GlobalNamespaceModel.php'; |
|
186 | 186 | |
187 | 187 | $cm = new ClassMetadata(DoctrineGlobalArticle::class, null, $this->metadataBuildingContext); |
188 | 188 | $cm->setTable(new Mapping\TableMetadata('doctrine_global_article')); |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | */ |
279 | 279 | public function testSetDiscriminatorMapInGlobalNamespace() : void |
280 | 280 | { |
281 | - require_once __DIR__ . '/../../Models/Global/GlobalNamespaceModel.php'; |
|
281 | + require_once __DIR__.'/../../Models/Global/GlobalNamespaceModel.php'; |
|
282 | 282 | |
283 | 283 | $cm = new ClassMetadata('DoctrineGlobalUser', null, $this->metadataBuildingContext); |
284 | 284 | $cm->setTable(new Mapping\TableMetadata('doctrine_global_user')); |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | */ |
295 | 295 | public function testSetSubClassesInGlobalNamespace() : void |
296 | 296 | { |
297 | - require_once __DIR__ . '/../../Models/Global/GlobalNamespaceModel.php'; |
|
297 | + require_once __DIR__.'/../../Models/Global/GlobalNamespaceModel.php'; |
|
298 | 298 | |
299 | 299 | $cm = new ClassMetadata('DoctrineGlobalUser', null, $this->metadataBuildingContext); |
300 | 300 | $cm->setTable(new Mapping\TableMetadata('doctrine_global_user')); |
@@ -775,7 +775,7 @@ discard block |
||
775 | 775 | public function testEmptyFieldNameThrowsException() : void |
776 | 776 | { |
777 | 777 | $this->expectException(MappingException::class); |
778 | - $this->expectExceptionMessage("The field or association mapping misses the 'fieldName' attribute in entity '" . CMS\CmsUser::class . "'."); |
|
778 | + $this->expectExceptionMessage("The field or association mapping misses the 'fieldName' attribute in entity '".CMS\CmsUser::class."'."); |
|
779 | 779 | |
780 | 780 | $cm = new ClassMetadata(CMS\CmsUser::class, null, $this->metadataBuildingContext); |
781 | 781 | $cm->setTable(new Mapping\TableMetadata('cms_users')); |
@@ -825,7 +825,7 @@ discard block |
||
825 | 825 | $cm->addLifecycleCallback('postLoad', 'notfound'); |
826 | 826 | |
827 | 827 | $this->expectException(MappingException::class); |
828 | - $this->expectExceptionMessage("Entity '" . CMS\CmsUser::class . "' has no public method 'notfound' to be registered as lifecycle callback."); |
|
828 | + $this->expectExceptionMessage("Entity '".CMS\CmsUser::class."' has no public method 'notfound' to be registered as lifecycle callback."); |
|
829 | 829 | |
830 | 830 | $cm->validateLifecycleCallbacks(new RuntimeReflectionService()); |
831 | 831 | } |
@@ -845,7 +845,7 @@ discard block |
||
845 | 845 | $cm->addProperty($association); |
846 | 846 | |
847 | 847 | $this->expectException(MappingException::class); |
848 | - $this->expectExceptionMessage("The target-entity 'UnknownClass' cannot be found in '" . CMS\CmsUser::class . "#address'."); |
|
848 | + $this->expectExceptionMessage("The target-entity 'UnknownClass' cannot be found in '".CMS\CmsUser::class."#address'."); |
|
849 | 849 | |
850 | 850 | $cm->validateAssociations(); |
851 | 851 | } |
@@ -1089,6 +1089,6 @@ discard block |
||
1089 | 1089 | */ |
1090 | 1090 | public function propertyToColumnName(string $propertyName, ?string $className = null) : string |
1091 | 1091 | { |
1092 | - return strtolower($this->classToTableName($className)) . '_' . $propertyName; |
|
1092 | + return strtolower($this->classToTableName($className)).'_'.$propertyName; |
|
1093 | 1093 | } |
1094 | 1094 | } |
@@ -45,7 +45,7 @@ |
||
45 | 45 | /** @var Mapping\ClassMetadata $metadata */ |
46 | 46 | $metadata = $event->getClassMetadata(); |
47 | 47 | |
48 | - if (! isset($this->entityListeners[$metadata->getClassName()])) { |
|
48 | + if ( ! isset($this->entityListeners[$metadata->getClassName()])) { |
|
49 | 49 | return; |
50 | 50 | } |
51 | 51 |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | |
144 | 144 | $classNames = array_filter( |
145 | 145 | $this->locator->getAllClassNames(null), |
146 | - function ($className) { |
|
146 | + function($className) { |
|
147 | 147 | return ! $this->isTransient($className); |
148 | 148 | } |
149 | 149 | ); |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | ]; |
276 | 276 | |
277 | 277 | foreach ($entityListenersAnnot->value as $listenerClassName) { |
278 | - if (! class_exists($listenerClassName)) { |
|
278 | + if ( ! class_exists($listenerClassName)) { |
|
279 | 279 | throw Mapping\MappingException::entityListenerClassNotFound( |
280 | 280 | $listenerClassName, |
281 | 281 | $classMetadata->getClassName() |
@@ -341,15 +341,15 @@ discard block |
||
341 | 341 | |
342 | 342 | $discriminatorColumn->setColumnName($discriminatorColumnAnnot->name); |
343 | 343 | |
344 | - if (! empty($discriminatorColumnAnnot->columnDefinition)) { |
|
344 | + if ( ! empty($discriminatorColumnAnnot->columnDefinition)) { |
|
345 | 345 | $discriminatorColumn->setColumnDefinition($discriminatorColumnAnnot->columnDefinition); |
346 | 346 | } |
347 | 347 | |
348 | - if (! empty($discriminatorColumnAnnot->type)) { |
|
348 | + if ( ! empty($discriminatorColumnAnnot->type)) { |
|
349 | 349 | $discriminatorColumn->setType(Type::getType($discriminatorColumnAnnot->type)); |
350 | 350 | } |
351 | 351 | |
352 | - if (! empty($discriminatorColumnAnnot->length)) { |
|
352 | + if ( ! empty($discriminatorColumnAnnot->length)) { |
|
353 | 353 | $discriminatorColumn->setLength($discriminatorColumnAnnot->length); |
354 | 354 | } |
355 | 355 | } |
@@ -405,11 +405,11 @@ discard block |
||
405 | 405 | { |
406 | 406 | $table = new Mapping\TableMetadata(); |
407 | 407 | |
408 | - if (! empty($tableAnnot->name)) { |
|
408 | + if ( ! empty($tableAnnot->name)) { |
|
409 | 409 | $table->setName($tableAnnot->name); |
410 | 410 | } |
411 | 411 | |
412 | - if (! empty($tableAnnot->schema)) { |
|
412 | + if ( ! empty($tableAnnot->schema)) { |
|
413 | 413 | $table->setSchema($tableAnnot->schema); |
414 | 414 | } |
415 | 415 | |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | ) { |
454 | 454 | $usage = constant(sprintf('%s::%s', Mapping\CacheUsage::class, $cacheAnnot->usage)); |
455 | 455 | $baseRegion = strtolower(str_replace('\\', '_', $metadata->getRootClassName())); |
456 | - $defaultRegion = $baseRegion . ($fieldName ? '__' . $fieldName : ''); |
|
456 | + $defaultRegion = $baseRegion.($fieldName ? '__'.$fieldName : ''); |
|
457 | 457 | |
458 | 458 | return new Mapping\CacheMetadata($usage, $cacheAnnot->region ?: $defaultRegion); |
459 | 459 | } |
@@ -562,11 +562,11 @@ discard block |
||
562 | 562 | $fieldMetadata->setPrimaryKey(true); |
563 | 563 | } |
564 | 564 | |
565 | - if (! empty($columnAnnot->columnDefinition)) { |
|
565 | + if ( ! empty($columnAnnot->columnDefinition)) { |
|
566 | 566 | $fieldMetadata->setColumnDefinition($columnAnnot->columnDefinition); |
567 | 567 | } |
568 | 568 | |
569 | - if (! empty($columnAnnot->length)) { |
|
569 | + if ( ! empty($columnAnnot->length)) { |
|
570 | 570 | $fieldMetadata->setLength($columnAnnot->length); |
571 | 571 | } |
572 | 572 | |
@@ -587,7 +587,7 @@ discard block |
||
587 | 587 | break; |
588 | 588 | |
589 | 589 | default: |
590 | - if (! isset($customOptions['default'])) { |
|
590 | + if ( ! isset($customOptions['default'])) { |
|
591 | 591 | throw Mapping\MappingException::unsupportedOptimisticLockingType($fieldMetadata->getType()); |
592 | 592 | } |
593 | 593 | } |
@@ -625,11 +625,11 @@ discard block |
||
625 | 625 | $assocMetadata->setOrphanRemoval($oneToOneAnnot->orphanRemoval); |
626 | 626 | $assocMetadata->setFetchMode($this->getFetchMode($className, $oneToOneAnnot->fetch)); |
627 | 627 | |
628 | - if (! empty($oneToOneAnnot->mappedBy)) { |
|
628 | + if ( ! empty($oneToOneAnnot->mappedBy)) { |
|
629 | 629 | $assocMetadata->setMappedBy($oneToOneAnnot->mappedBy); |
630 | 630 | } |
631 | 631 | |
632 | - if (! empty($oneToOneAnnot->inversedBy)) { |
|
632 | + if ( ! empty($oneToOneAnnot->inversedBy)) { |
|
633 | 633 | $assocMetadata->setInversedBy($oneToOneAnnot->inversedBy); |
634 | 634 | } |
635 | 635 | |
@@ -705,7 +705,7 @@ discard block |
||
705 | 705 | $assocMetadata->setCascade($this->getCascade($className, $fieldName, $manyToOneAnnot->cascade)); |
706 | 706 | $assocMetadata->setFetchMode($this->getFetchMode($className, $manyToOneAnnot->fetch)); |
707 | 707 | |
708 | - if (! empty($manyToOneAnnot->inversedBy)) { |
|
708 | + if ( ! empty($manyToOneAnnot->inversedBy)) { |
|
709 | 709 | $assocMetadata->setInversedBy($manyToOneAnnot->inversedBy); |
710 | 710 | } |
711 | 711 | |
@@ -782,11 +782,11 @@ discard block |
||
782 | 782 | $assocMetadata->setOrphanRemoval($oneToManyAnnot->orphanRemoval); |
783 | 783 | $assocMetadata->setFetchMode($this->getFetchMode($className, $oneToManyAnnot->fetch)); |
784 | 784 | |
785 | - if (! empty($oneToManyAnnot->mappedBy)) { |
|
785 | + if ( ! empty($oneToManyAnnot->mappedBy)) { |
|
786 | 786 | $assocMetadata->setMappedBy($oneToManyAnnot->mappedBy); |
787 | 787 | } |
788 | 788 | |
789 | - if (! empty($oneToManyAnnot->indexBy)) { |
|
789 | + if ( ! empty($oneToManyAnnot->indexBy)) { |
|
790 | 790 | $assocMetadata->setIndexedBy($oneToManyAnnot->indexBy); |
791 | 791 | } |
792 | 792 | |
@@ -840,15 +840,15 @@ discard block |
||
840 | 840 | $assocMetadata->setOrphanRemoval($manyToManyAnnot->orphanRemoval); |
841 | 841 | $assocMetadata->setFetchMode($this->getFetchMode($className, $manyToManyAnnot->fetch)); |
842 | 842 | |
843 | - if (! empty($manyToManyAnnot->mappedBy)) { |
|
843 | + if ( ! empty($manyToManyAnnot->mappedBy)) { |
|
844 | 844 | $assocMetadata->setMappedBy($manyToManyAnnot->mappedBy); |
845 | 845 | } |
846 | 846 | |
847 | - if (! empty($manyToManyAnnot->inversedBy)) { |
|
847 | + if ( ! empty($manyToManyAnnot->inversedBy)) { |
|
848 | 848 | $assocMetadata->setInversedBy($manyToManyAnnot->inversedBy); |
849 | 849 | } |
850 | 850 | |
851 | - if (! empty($manyToManyAnnot->indexBy)) { |
|
851 | + if ( ! empty($manyToManyAnnot->indexBy)) { |
|
852 | 852 | $assocMetadata->setIndexedBy($manyToManyAnnot->indexBy); |
853 | 853 | } |
854 | 854 | |
@@ -899,11 +899,11 @@ discard block |
||
899 | 899 | ) { |
900 | 900 | $joinTable = new Mapping\JoinTableMetadata(); |
901 | 901 | |
902 | - if (! empty($joinTableAnnot->name)) { |
|
902 | + if ( ! empty($joinTableAnnot->name)) { |
|
903 | 903 | $joinTable->setName($joinTableAnnot->name); |
904 | 904 | } |
905 | 905 | |
906 | - if (! empty($joinTableAnnot->schema)) { |
|
906 | + if ( ! empty($joinTableAnnot->schema)) { |
|
907 | 907 | $joinTable->setSchema($joinTableAnnot->schema); |
908 | 908 | } |
909 | 909 | |
@@ -954,11 +954,11 @@ discard block |
||
954 | 954 | $joinColumn->setNullable($joinColumnAnnot->nullable); |
955 | 955 | $joinColumn->setUnique($joinColumnAnnot->unique); |
956 | 956 | |
957 | - if (! empty($joinColumnAnnot->fieldName)) { |
|
957 | + if ( ! empty($joinColumnAnnot->fieldName)) { |
|
958 | 958 | $joinColumn->setAliasedName($joinColumnAnnot->fieldName); |
959 | 959 | } |
960 | 960 | |
961 | - if (! empty($joinColumnAnnot->columnDefinition)) { |
|
961 | + if ( ! empty($joinColumnAnnot->columnDefinition)) { |
|
962 | 962 | $joinColumn->setColumnDefinition($joinColumnAnnot->columnDefinition); |
963 | 963 | } |
964 | 964 | |
@@ -1014,7 +1014,7 @@ discard block |
||
1014 | 1014 | { |
1015 | 1015 | $fetchModeConstant = sprintf('%s::%s', Mapping\FetchMode::class, $fetchMode); |
1016 | 1016 | |
1017 | - if (! defined($fetchModeConstant)) { |
|
1017 | + if ( ! defined($fetchModeConstant)) { |
|
1018 | 1018 | throw Mapping\MappingException::invalidFetchMode($className, $fetchMode); |
1019 | 1019 | } |
1020 | 1020 | |
@@ -1056,7 +1056,7 @@ discard block |
||
1056 | 1056 | $classAnnotations = $this->reader->getClassAnnotations($reflectionClass); |
1057 | 1057 | |
1058 | 1058 | foreach ($classAnnotations as $key => $annot) { |
1059 | - if (! is_numeric($key)) { |
|
1059 | + if ( ! is_numeric($key)) { |
|
1060 | 1060 | continue; |
1061 | 1061 | } |
1062 | 1062 | |
@@ -1074,7 +1074,7 @@ discard block |
||
1074 | 1074 | $propertyAnnotations = $this->reader->getPropertyAnnotations($reflectionProperty); |
1075 | 1075 | |
1076 | 1076 | foreach ($propertyAnnotations as $key => $annot) { |
1077 | - if (! is_numeric($key)) { |
|
1077 | + if ( ! is_numeric($key)) { |
|
1078 | 1078 | continue; |
1079 | 1079 | } |
1080 | 1080 | |
@@ -1092,7 +1092,7 @@ discard block |
||
1092 | 1092 | $methodAnnotations = $this->reader->getMethodAnnotations($reflectionMethod); |
1093 | 1093 | |
1094 | 1094 | foreach ($methodAnnotations as $key => $annot) { |
1095 | - if (! is_numeric($key)) { |
|
1095 | + if ( ! is_numeric($key)) { |
|
1096 | 1096 | continue; |
1097 | 1097 | } |
1098 | 1098 |
@@ -54,11 +54,11 @@ |
||
54 | 54 | return $tableMetadata; |
55 | 55 | } |
56 | 56 | |
57 | - if (! empty($this->tableAnnotation->name)) { |
|
57 | + if ( ! empty($this->tableAnnotation->name)) { |
|
58 | 58 | $tableMetadata->setName($this->tableAnnotation->name); |
59 | 59 | } |
60 | 60 | |
61 | - if (! empty($this->tableAnnotation->schema)) { |
|
61 | + if ( ! empty($this->tableAnnotation->schema)) { |
|
62 | 62 | $tableMetadata->setSchema($this->tableAnnotation->schema); |
63 | 63 | } |
64 | 64 |
@@ -61,7 +61,7 @@ |
||
61 | 61 | |
62 | 62 | $componentName = $this->componentMetadata->getRootClassName(); |
63 | 63 | $baseRegion = strtolower(str_replace('\\', '_', $componentName)); |
64 | - $defaultRegion = $baseRegion . ($this->fieldName ? '__' . $this->fieldName : ''); |
|
64 | + $defaultRegion = $baseRegion.($this->fieldName ? '__'.$this->fieldName : ''); |
|
65 | 65 | |
66 | 66 | $usage = constant(sprintf('%s::%s', Mapping\CacheUsage::class, strtoupper($this->cacheAnnotation->usage))); |
67 | 67 | $region = $this->cacheAnnotation->region ?: $defaultRegion; |
@@ -65,11 +65,11 @@ |
||
65 | 65 | $discriminatorColumn->setType(Type::getType($annotation->type ?? 'string')); |
66 | 66 | $discriminatorColumn->setColumnName($annotation->name); |
67 | 67 | |
68 | - if (! empty($annotation->columnDefinition)) { |
|
68 | + if ( ! empty($annotation->columnDefinition)) { |
|
69 | 69 | $discriminatorColumn->setColumnDefinition($annotation->columnDefinition); |
70 | 70 | } |
71 | 71 | |
72 | - if (! empty($annotation->length)) { |
|
72 | + if ( ! empty($annotation->length)) { |
|
73 | 73 | $discriminatorColumn->setLength($annotation->length); |
74 | 74 | } |
75 | 75 |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public function generateProxyClasses(array $classes) : int |
58 | 58 | { |
59 | - $concreteClasses = array_filter($classes, static function (ClassMetadata $metadata) : bool { |
|
59 | + $concreteClasses = array_filter($classes, static function(ClassMetadata $metadata) : bool { |
|
60 | 60 | return ! ($metadata->isMappedSuperclass || $metadata->getReflectionClass()->isAbstract()); |
61 | 61 | }); |
62 | 62 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | ->proxyFactory |
66 | 66 | ->createProxy( |
67 | 67 | $metadata->getClassName(), |
68 | - static function () { |
|
68 | + static function() { |
|
69 | 69 | // empty closure, serves its purpose, for now |
70 | 70 | }, |
71 | 71 | $this->skippedFieldsFqns($metadata) |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | ->getUnitOfWork() |
90 | 90 | ->getEntityPersister($metadata->getClassName()); |
91 | 91 | |
92 | - $proxyInstance = $this |
|
92 | + $proxyInstance = $this |
|
93 | 93 | ->proxyFactory |
94 | 94 | ->createProxy( |
95 | 95 | $metadata->getClassName(), |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | |
109 | 109 | private function makeInitializer(ClassMetadata $metadata, EntityPersister $persister) : Closure |
110 | 110 | { |
111 | - return static function ( |
|
111 | + return static function( |
|
112 | 112 | GhostObjectInterface $ghostObject, |
113 | 113 | string $method, |
114 | 114 | // we don't care |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | $identifier = $persister->getIdentifier($ghostObject); |
128 | 128 | |
129 | 129 | // @TODO how do we use `$properties` in the persister? That would be a massive optimisation |
130 | - if (! $persister->loadById($identifier, $ghostObject)) { |
|
130 | + if ( ! $persister->loadById($identifier, $ghostObject)) { |
|
131 | 131 | $initializer = $originalInitializer; |
132 | 132 | |
133 | 133 | throw EntityNotFoundException::fromClassNameAndIdentifier( |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | $transientFieldsFqns = []; |
160 | 160 | |
161 | 161 | foreach ($metadata->getPropertiesIterator() as $name => $property) { |
162 | - if (! $property instanceof TransientMetadata) { |
|
162 | + if ( ! $property instanceof TransientMetadata) { |
|
163 | 163 | continue; |
164 | 164 | } |
165 | 165 | |
@@ -197,11 +197,11 @@ discard block |
||
197 | 197 | private function propertyFqcn(ReflectionProperty $property) : string |
198 | 198 | { |
199 | 199 | if ($property->isPrivate()) { |
200 | - return "\0" . $property->getDeclaringClass()->getName() . "\0" . $property->getName(); |
|
200 | + return "\0".$property->getDeclaringClass()->getName()."\0".$property->getName(); |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | if ($property->isProtected()) { |
204 | - return "\0*\0" . $property->getName(); |
|
204 | + return "\0*\0".$property->getName(); |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | return $property->getName(); |
@@ -35,7 +35,7 @@ |
||
35 | 35 | $normalizedAssociatedId = []; |
36 | 36 | |
37 | 37 | foreach ($targetClass->getPropertiesIterator() as $name => $property) { |
38 | - if (! array_key_exists($name, $flatIdentifier)) { |
|
38 | + if ( ! array_key_exists($name, $flatIdentifier)) { |
|
39 | 39 | continue; |
40 | 40 | } |
41 | 41 |