@@ -10,8 +10,8 @@ discard block |
||
10 | 10 | $metadata->setInheritanceType(ClassMetadataInfo::INHERITANCE_TYPE_NONE); |
11 | 11 | $metadata->setPrimaryTable( |
12 | 12 | [ |
13 | - 'name' => 'cms_users', |
|
14 | - 'options' => ['engine' => 'MyISAM', 'foo' => ['bar' => 'baz']], |
|
13 | + 'name' => 'cms_users', |
|
14 | + 'options' => ['engine' => 'MyISAM', 'foo' => ['bar' => 'baz']], |
|
15 | 15 | ] |
16 | 16 | ); |
17 | 17 | $metadata->setChangeTrackingPolicy(ClassMetadataInfo::CHANGETRACKING_DEFERRED_IMPLICIT); |
@@ -20,35 +20,35 @@ discard block |
||
20 | 20 | $metadata->addLifecycleCallback('doStuffOnPostPersist', Events::postPersist); |
21 | 21 | $metadata->mapField( |
22 | 22 | [ |
23 | - 'id' => true, |
|
24 | - 'fieldName' => 'id', |
|
25 | - 'type' => 'integer', |
|
26 | - 'columnName' => 'id', |
|
23 | + 'id' => true, |
|
24 | + 'fieldName' => 'id', |
|
25 | + 'type' => 'integer', |
|
26 | + 'columnName' => 'id', |
|
27 | 27 | ] |
28 | 28 | ); |
29 | 29 | $metadata->mapField( |
30 | 30 | [ |
31 | - 'fieldName' => 'name', |
|
32 | - 'type' => 'string', |
|
33 | - 'length' => 50, |
|
34 | - 'unique' => true, |
|
35 | - 'nullable' => true, |
|
36 | - 'columnName' => 'name', |
|
31 | + 'fieldName' => 'name', |
|
32 | + 'type' => 'string', |
|
33 | + 'length' => 50, |
|
34 | + 'unique' => true, |
|
35 | + 'nullable' => true, |
|
36 | + 'columnName' => 'name', |
|
37 | 37 | ] |
38 | 38 | ); |
39 | 39 | $metadata->mapField( |
40 | 40 | [ |
41 | - 'fieldName' => 'email', |
|
42 | - 'type' => 'string', |
|
43 | - 'columnName' => 'user_email', |
|
44 | - 'columnDefinition' => 'CHAR(32) NOT NULL', |
|
41 | + 'fieldName' => 'email', |
|
42 | + 'type' => 'string', |
|
43 | + 'columnName' => 'user_email', |
|
44 | + 'columnDefinition' => 'CHAR(32) NOT NULL', |
|
45 | 45 | ] |
46 | 46 | ); |
47 | 47 | $metadata->mapField( |
48 | 48 | [ |
49 | - 'fieldName' => 'age', |
|
50 | - 'type' => 'integer', |
|
51 | - 'options' => ["unsigned"=>true], |
|
49 | + 'fieldName' => 'age', |
|
50 | + 'type' => 'integer', |
|
51 | + 'options' => ["unsigned"=>true], |
|
52 | 52 | ] |
53 | 53 | ); |
54 | 54 | $metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_AUTO); |
@@ -60,25 +60,25 @@ discard block |
||
60 | 60 | ); |
61 | 61 | $metadata->mapOneToOne( |
62 | 62 | [ |
63 | - 'fieldName' => 'address', |
|
64 | - 'targetEntity' => Export\Address::class, |
|
65 | - 'inversedBy' => 'user', |
|
66 | - 'cascade' => |
|
67 | - [ |
|
68 | - 0 => 'persist', |
|
69 | - ], |
|
70 | - 'mappedBy' => NULL, |
|
71 | - 'joinColumns' => |
|
72 | - [ |
|
73 | - 0 => |
|
74 | - [ |
|
63 | + 'fieldName' => 'address', |
|
64 | + 'targetEntity' => Export\Address::class, |
|
65 | + 'inversedBy' => 'user', |
|
66 | + 'cascade' => |
|
67 | + [ |
|
68 | + 0 => 'persist', |
|
69 | + ], |
|
70 | + 'mappedBy' => NULL, |
|
71 | + 'joinColumns' => |
|
72 | + [ |
|
73 | + 0 => |
|
74 | + [ |
|
75 | 75 | 'name' => 'address_id', |
76 | 76 | 'referencedColumnName' => 'id', |
77 | 77 | 'onDelete' => 'CASCADE', |
78 | - ], |
|
79 | - ], |
|
80 | - 'orphanRemoval' => true, |
|
81 | - 'fetch' => ClassMetadataInfo::FETCH_EAGER, |
|
78 | + ], |
|
79 | + ], |
|
80 | + 'orphanRemoval' => true, |
|
81 | + 'fetch' => ClassMetadataInfo::FETCH_EAGER, |
|
82 | 82 | ] |
83 | 83 | ); |
84 | 84 | $metadata->mapOneToOne( |
@@ -97,41 +97,41 @@ discard block |
||
97 | 97 | ); |
98 | 98 | $metadata->mapOneToMany( |
99 | 99 | [ |
100 | - 'fieldName' => 'phonenumbers', |
|
101 | - 'targetEntity' => Export\Phonenumber::class, |
|
102 | - 'cascade' => |
|
103 | - [ |
|
104 | - 1 => 'persist', |
|
105 | - 2 => 'merge', |
|
106 | - ], |
|
107 | - 'mappedBy' => 'user', |
|
108 | - 'orphanRemoval' => true, |
|
109 | - 'fetch' => ClassMetadataInfo::FETCH_LAZY, |
|
110 | - 'orderBy' => |
|
111 | - [ |
|
112 | - 'number' => 'ASC', |
|
113 | - ], |
|
100 | + 'fieldName' => 'phonenumbers', |
|
101 | + 'targetEntity' => Export\Phonenumber::class, |
|
102 | + 'cascade' => |
|
103 | + [ |
|
104 | + 1 => 'persist', |
|
105 | + 2 => 'merge', |
|
106 | + ], |
|
107 | + 'mappedBy' => 'user', |
|
108 | + 'orphanRemoval' => true, |
|
109 | + 'fetch' => ClassMetadataInfo::FETCH_LAZY, |
|
110 | + 'orderBy' => |
|
111 | + [ |
|
112 | + 'number' => 'ASC', |
|
113 | + ], |
|
114 | 114 | ] |
115 | 115 | ); |
116 | 116 | $metadata->mapManyToMany( |
117 | 117 | [ |
118 | - 'fieldName' => 'groups', |
|
119 | - 'targetEntity' => Export\Group::class, |
|
120 | - 'fetch' => ClassMetadataInfo::FETCH_EXTRA_LAZY, |
|
121 | - 'cascade' => |
|
122 | - [ |
|
123 | - 0 => 'remove', |
|
124 | - 1 => 'persist', |
|
125 | - 2 => 'refresh', |
|
126 | - 3 => 'merge', |
|
127 | - 4 => 'detach', |
|
128 | - ], |
|
129 | - 'mappedBy' => NULL, |
|
130 | - 'joinTable' => |
|
131 | - [ |
|
132 | - 'name' => 'cms_users_groups', |
|
133 | - 'joinColumns' => |
|
134 | - [ |
|
118 | + 'fieldName' => 'groups', |
|
119 | + 'targetEntity' => Export\Group::class, |
|
120 | + 'fetch' => ClassMetadataInfo::FETCH_EXTRA_LAZY, |
|
121 | + 'cascade' => |
|
122 | + [ |
|
123 | + 0 => 'remove', |
|
124 | + 1 => 'persist', |
|
125 | + 2 => 'refresh', |
|
126 | + 3 => 'merge', |
|
127 | + 4 => 'detach', |
|
128 | + ], |
|
129 | + 'mappedBy' => NULL, |
|
130 | + 'joinTable' => |
|
131 | + [ |
|
132 | + 'name' => 'cms_users_groups', |
|
133 | + 'joinColumns' => |
|
134 | + [ |
|
135 | 135 | 0 => |
136 | 136 | [ |
137 | 137 | 'name' => 'user_id', |
@@ -139,18 +139,18 @@ discard block |
||
139 | 139 | 'unique' => false, |
140 | 140 | 'nullable' => false, |
141 | 141 | ], |
142 | - ], |
|
143 | - 'inverseJoinColumns' => |
|
144 | - [ |
|
142 | + ], |
|
143 | + 'inverseJoinColumns' => |
|
144 | + [ |
|
145 | 145 | 0 => |
146 | 146 | [ |
147 | 147 | 'name' => 'group_id', |
148 | 148 | 'referencedColumnName' => 'id', |
149 | 149 | 'columnDefinition' => 'INT NULL', |
150 | 150 | ], |
151 | - ], |
|
152 | - ], |
|
153 | - 'orderBy' => NULL, |
|
151 | + ], |
|
152 | + ], |
|
153 | + 'orderBy' => NULL, |
|
154 | 154 | ] |
155 | 155 | ); |
156 | 156 | $metadata->addEntityListener(Events::prePersist, UserListener::class, 'customPrePersist'); |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | public function exportClassMetadata(ClassMetadataInfo $metadata): string |
43 | 43 | { |
44 | 44 | $xml = new SimpleXmlElement("<?xml version=\"1.0\" encoding=\"utf-8\"?><doctrine-mapping ". |
45 | - "xmlns=\"http://doctrine-project.org/schemas/orm/doctrine-mapping\" " . |
|
45 | + "xmlns=\"http://doctrine-project.org/schemas/orm/doctrine-mapping\" ". |
|
46 | 46 | "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" ". |
47 | 47 | "xsi:schemaLocation=\"http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd\" />"); |
48 | 48 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | |
99 | 99 | $trackingPolicy = $this->_getChangeTrackingPolicyString($metadata->changeTrackingPolicy); |
100 | 100 | |
101 | - if ( $trackingPolicy != 'DEFERRED_IMPLICIT') { |
|
101 | + if ($trackingPolicy != 'DEFERRED_IMPLICIT') { |
|
102 | 102 | $root->addChild('change-tracking-policy', $trackingPolicy); |
103 | 103 | } |
104 | 104 | |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | } |
298 | 298 | |
299 | 299 | if (count($cascade) === 5) { |
300 | - $cascade = ['cascade-all']; |
|
300 | + $cascade = ['cascade-all']; |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | if ($cascade) { |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | } |
380 | 380 | } |
381 | 381 | |
382 | - if (isset($metadata->lifecycleCallbacks) && count($metadata->lifecycleCallbacks)>0) { |
|
382 | + if (isset($metadata->lifecycleCallbacks) && count($metadata->lifecycleCallbacks) > 0) { |
|
383 | 383 | $lifecycleCallbacksXml = $root->addChild('lifecycle-callbacks'); |
384 | 384 | |
385 | 385 | foreach ($metadata->lifecycleCallbacks as $name => $methods) { |
@@ -430,7 +430,7 @@ discard block |
||
430 | 430 | { |
431 | 431 | $sequenceDefinition = $metadata->sequenceGeneratorDefinition; |
432 | 432 | |
433 | - if (! ($metadata->generatorType === ClassMetadataInfo::GENERATOR_TYPE_SEQUENCE && $sequenceDefinition)) { |
|
433 | + if ( ! ($metadata->generatorType === ClassMetadataInfo::GENERATOR_TYPE_SEQUENCE && $sequenceDefinition)) { |
|
434 | 434 | return; |
435 | 435 | } |
436 | 436 |
@@ -253,7 +253,7 @@ |
||
253 | 253 | private function processEntityListenerConfig(array $array, array $entityListenerConfig, string $event): array |
254 | 254 | { |
255 | 255 | foreach ($entityListenerConfig as $entityListener) { |
256 | - if (!isset($array['entityListeners'][$entityListener['class']])) { |
|
256 | + if ( ! isset($array['entityListeners'][$entityListener['class']])) { |
|
257 | 257 | $array['entityListeners'][$entityListener['class']] = []; |
258 | 258 | } |
259 | 259 | $array['entityListeners'][$entityListener['class']][$event] = [$entityListener['method']]; |
@@ -51,27 +51,27 @@ discard block |
||
51 | 51 | } |
52 | 52 | |
53 | 53 | if ($metadata->inheritanceType) { |
54 | - $lines[] = '$metadata->setInheritanceType(ClassMetadataInfo::INHERITANCE_TYPE_' . $this->_getInheritanceTypeString($metadata->inheritanceType) . ');'; |
|
54 | + $lines[] = '$metadata->setInheritanceType(ClassMetadataInfo::INHERITANCE_TYPE_'.$this->_getInheritanceTypeString($metadata->inheritanceType).');'; |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | if ($metadata->customRepositoryClassName) { |
58 | - $lines[] = "\$metadata->customRepositoryClassName = '" . $metadata->customRepositoryClassName . "';"; |
|
58 | + $lines[] = "\$metadata->customRepositoryClassName = '".$metadata->customRepositoryClassName."';"; |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | if ($metadata->table) { |
62 | - $lines[] = '$metadata->setPrimaryTable(' . $this->_varExport($metadata->table) . ');'; |
|
62 | + $lines[] = '$metadata->setPrimaryTable('.$this->_varExport($metadata->table).');'; |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | if ($metadata->discriminatorColumn) { |
66 | - $lines[] = '$metadata->setDiscriminatorColumn(' . $this->_varExport($metadata->discriminatorColumn) . ');'; |
|
66 | + $lines[] = '$metadata->setDiscriminatorColumn('.$this->_varExport($metadata->discriminatorColumn).');'; |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | if ($metadata->discriminatorMap) { |
70 | - $lines[] = '$metadata->setDiscriminatorMap(' . $this->_varExport($metadata->discriminatorMap) . ');'; |
|
70 | + $lines[] = '$metadata->setDiscriminatorMap('.$this->_varExport($metadata->discriminatorMap).');'; |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | if ($metadata->changeTrackingPolicy) { |
74 | - $lines[] = '$metadata->setChangeTrackingPolicy(ClassMetadataInfo::CHANGETRACKING_' . $this->_getChangeTrackingPolicyString($metadata->changeTrackingPolicy) . ');'; |
|
74 | + $lines[] = '$metadata->setChangeTrackingPolicy(ClassMetadataInfo::CHANGETRACKING_'.$this->_getChangeTrackingPolicyString($metadata->changeTrackingPolicy).');'; |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | if ($metadata->lifecycleCallbacks) { |
@@ -85,11 +85,11 @@ discard block |
||
85 | 85 | $lines = array_merge($lines, $this->processEntityListeners($metadata)); |
86 | 86 | |
87 | 87 | foreach ($metadata->fieldMappings as $fieldMapping) { |
88 | - $lines[] = '$metadata->mapField(' . $this->_varExport($fieldMapping) . ');'; |
|
88 | + $lines[] = '$metadata->mapField('.$this->_varExport($fieldMapping).');'; |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | if ( ! $metadata->isIdentifierComposite && $generatorType = $this->_getIdGeneratorTypeString($metadata->generatorType)) { |
92 | - $lines[] = '$metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_' . $generatorType . ');'; |
|
92 | + $lines[] = '$metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_'.$generatorType.');'; |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | foreach ($metadata->associationMappings as $associationMapping) { |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | $associationMappingArray = array_merge($associationMappingArray, $manyToManyMappingArray); |
156 | 156 | } |
157 | 157 | |
158 | - $lines[] = '$metadata->' . $method . '(' . $this->_varExport($associationMappingArray) . ');'; |
|
158 | + $lines[] = '$metadata->'.$method.'('.$this->_varExport($associationMappingArray).');'; |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | return implode("\n", $lines); |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | protected function _varExport($var): string |
170 | 170 | { |
171 | 171 | $export = var_export($var, true); |
172 | - $export = str_replace("\n", PHP_EOL . str_repeat(' ', 8), $export); |
|
172 | + $export = str_replace("\n", PHP_EOL.str_repeat(' ', 8), $export); |
|
173 | 173 | $export = str_replace(' ', ' ', $export); |
174 | 174 | $export = str_replace('array (', 'array(', $export); |
175 | 175 | $export = str_replace('array( ', 'array(', $export); |
@@ -65,7 +65,7 @@ |
||
65 | 65 | */ |
66 | 66 | protected function _generateOutputPath(ClassMetadataInfo $metadata): string |
67 | 67 | { |
68 | - return $this->_outputDir . '/' . str_replace('\\', '/', $metadata->name) . $this->_extension; |
|
68 | + return $this->_outputDir.'/'.str_replace('\\', '/', $metadata->name).$this->_extension; |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | */ |
366 | 366 | public function writeEntityClass(ClassMetadataInfo $metadata, $outputDirectory): void |
367 | 367 | { |
368 | - $path = $outputDirectory . '/' . str_replace('\\', DIRECTORY_SEPARATOR, $metadata->name) . $this->extension; |
|
368 | + $path = $outputDirectory.'/'.str_replace('\\', DIRECTORY_SEPARATOR, $metadata->name).$this->extension; |
|
369 | 369 | $dir = dirname($path); |
370 | 370 | |
371 | 371 | if ( ! is_dir($dir)) { |
@@ -381,8 +381,8 @@ discard block |
||
381 | 381 | } |
382 | 382 | |
383 | 383 | if ($this->backupExisting && file_exists($path)) { |
384 | - $backupPath = dirname($path) . DIRECTORY_SEPARATOR . basename($path) . "~"; |
|
385 | - if (!copy($path, $backupPath)) { |
|
384 | + $backupPath = dirname($path).DIRECTORY_SEPARATOR.basename($path)."~"; |
|
385 | + if ( ! copy($path, $backupPath)) { |
|
386 | 386 | throw new \RuntimeException("Attempt to backup overwritten entity file but copy operation failed."); |
387 | 387 | } |
388 | 388 | } |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | $body = str_replace('<spaces>', $this->spaces, $body); |
444 | 444 | $last = strrpos($currentCode, '}'); |
445 | 445 | |
446 | - return substr($currentCode, 0, $last) . $body . ($body ? "\n" : '') . "}\n"; |
|
446 | + return substr($currentCode, 0, $last).$body.($body ? "\n" : '')."}\n"; |
|
447 | 447 | } |
448 | 448 | |
449 | 449 | /** |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | public function setFieldVisibility($visibility): void |
508 | 508 | { |
509 | 509 | if ($visibility !== static::FIELD_VISIBLE_PRIVATE && $visibility !== static::FIELD_VISIBLE_PROTECTED) { |
510 | - throw new \InvalidArgumentException('Invalid provided visibility (only private and protected are allowed): ' . $visibility); |
|
510 | + throw new \InvalidArgumentException('Invalid provided visibility (only private and protected are allowed): '.$visibility); |
|
511 | 511 | } |
512 | 512 | |
513 | 513 | $this->fieldVisibility = $visibility; |
@@ -602,18 +602,18 @@ discard block |
||
602 | 602 | * |
603 | 603 | * @return string |
604 | 604 | */ |
605 | - protected function generateEntityNamespace(ClassMetadataInfo $metadata): ?string |
|
605 | + protected function generateEntityNamespace(ClassMetadataInfo $metadata): ? string |
|
606 | 606 | { |
607 | - if (!$this->hasNamespace($metadata)) { |
|
607 | + if ( ! $this->hasNamespace($metadata)) { |
|
608 | 608 | return null; |
609 | 609 | } |
610 | 610 | |
611 | - return 'namespace ' . $this->getNamespace($metadata) .';'; |
|
611 | + return 'namespace '.$this->getNamespace($metadata).';'; |
|
612 | 612 | } |
613 | 613 | |
614 | - protected function generateEntityUse(): ?string |
|
614 | + protected function generateEntityUse(): ? string |
|
615 | 615 | { |
616 | - if (!$this->generateAnnotations) { |
|
616 | + if ( ! $this->generateAnnotations) { |
|
617 | 617 | return null; |
618 | 618 | } |
619 | 619 | |
@@ -627,8 +627,8 @@ discard block |
||
627 | 627 | */ |
628 | 628 | protected function generateEntityClassName(ClassMetadataInfo $metadata): string |
629 | 629 | { |
630 | - return 'class ' . $this->getClassName($metadata) . |
|
631 | - ($this->extendsClass() ? ' extends ' . $this->getClassToExtendName() : null); |
|
630 | + return 'class '.$this->getClassName($metadata). |
|
631 | + ($this->extendsClass() ? ' extends '.$this->getClassToExtendName() : null); |
|
632 | 632 | } |
633 | 633 | |
634 | 634 | /** |
@@ -730,13 +730,13 @@ discard block |
||
730 | 730 | $fieldMappings = array_merge($requiredFields, $optionalFields); |
731 | 731 | |
732 | 732 | foreach ($metadata->embeddedClasses as $fieldName => $embeddedClass) { |
733 | - $paramType = '\\' . ltrim($embeddedClass['class'], '\\'); |
|
734 | - $paramVariable = '$' . $fieldName; |
|
733 | + $paramType = '\\'.ltrim($embeddedClass['class'], '\\'); |
|
734 | + $paramVariable = '$'.$fieldName; |
|
735 | 735 | |
736 | 736 | $paramTypes[] = $paramType; |
737 | 737 | $paramVariables[] = $paramVariable; |
738 | - $params[] = $paramType . ' ' . $paramVariable; |
|
739 | - $fields[] = '$this->' . $fieldName . ' = ' . $paramVariable . ';'; |
|
738 | + $params[] = $paramType.' '.$paramVariable; |
|
739 | + $fields[] = '$this->'.$fieldName.' = '.$paramVariable.';'; |
|
740 | 740 | } |
741 | 741 | |
742 | 742 | foreach ($fieldMappings as $fieldMapping) { |
@@ -744,27 +744,27 @@ discard block |
||
744 | 744 | continue; |
745 | 745 | } |
746 | 746 | |
747 | - $paramTypes[] = $this->getType($fieldMapping['type']) . (!empty($fieldMapping['nullable']) ? '|null' : ''); |
|
748 | - $param = '$' . $fieldMapping['fieldName']; |
|
747 | + $paramTypes[] = $this->getType($fieldMapping['type']).( ! empty($fieldMapping['nullable']) ? '|null' : ''); |
|
748 | + $param = '$'.$fieldMapping['fieldName']; |
|
749 | 749 | $paramVariables[] = $param; |
750 | 750 | |
751 | 751 | if ($fieldMapping['type'] === 'datetime') { |
752 | - $param = $this->getType($fieldMapping['type']) . ' ' . $param; |
|
752 | + $param = $this->getType($fieldMapping['type']).' '.$param; |
|
753 | 753 | } |
754 | 754 | |
755 | - if (!empty($fieldMapping['nullable'])) { |
|
755 | + if ( ! empty($fieldMapping['nullable'])) { |
|
756 | 756 | $param .= ' = null'; |
757 | 757 | } |
758 | 758 | |
759 | 759 | $params[] = $param; |
760 | 760 | |
761 | - $fields[] = '$this->' . $fieldMapping['fieldName'] . ' = $' . $fieldMapping['fieldName'] . ';'; |
|
761 | + $fields[] = '$this->'.$fieldMapping['fieldName'].' = $'.$fieldMapping['fieldName'].';'; |
|
762 | 762 | } |
763 | 763 | |
764 | 764 | $maxParamTypeLength = max(array_map('strlen', $paramTypes)); |
765 | 765 | $paramTags = array_map( |
766 | - function ($type, $variable) use ($maxParamTypeLength) { |
|
767 | - return '@param ' . $type . str_repeat(' ', $maxParamTypeLength - strlen($type) + 1) . $variable; |
|
766 | + function($type, $variable) use ($maxParamTypeLength) { |
|
767 | + return '@param '.$type.str_repeat(' ', $maxParamTypeLength - strlen($type) + 1).$variable; |
|
768 | 768 | }, |
769 | 769 | $paramTypes, |
770 | 770 | $paramVariables |
@@ -772,8 +772,8 @@ discard block |
||
772 | 772 | |
773 | 773 | // Generate multi line constructor if the signature exceeds 120 characters. |
774 | 774 | if (array_sum(array_map('strlen', $params)) + count($params) * 2 + 29 > 120) { |
775 | - $delimiter = "\n" . $this->spaces; |
|
776 | - $params = $delimiter . implode(',' . $delimiter, $params) . "\n"; |
|
775 | + $delimiter = "\n".$this->spaces; |
|
776 | + $params = $delimiter.implode(','.$delimiter, $params)."\n"; |
|
777 | 777 | } else { |
778 | 778 | $params = implode(', ', $params); |
779 | 779 | } |
@@ -781,7 +781,7 @@ discard block |
||
781 | 781 | $replacements = [ |
782 | 782 | '<paramTags>' => implode("\n * ", $paramTags), |
783 | 783 | '<params>' => $params, |
784 | - '<fields>' => implode("\n" . $this->spaces, $fields), |
|
784 | + '<fields>' => implode("\n".$this->spaces, $fields), |
|
785 | 785 | ]; |
786 | 786 | |
787 | 787 | $constructor = str_replace( |
@@ -826,7 +826,7 @@ discard block |
||
826 | 826 | |
827 | 827 | if ($inClass) { |
828 | 828 | $inClass = false; |
829 | - $lastSeenClass = $lastSeenNamespace . ($lastSeenNamespace ? '\\' : '') . $token[1]; |
|
829 | + $lastSeenClass = $lastSeenNamespace.($lastSeenNamespace ? '\\' : '').$token[1]; |
|
830 | 830 | $this->staticReflection[$lastSeenClass]['properties'] = []; |
831 | 831 | $this->staticReflection[$lastSeenClass]['methods'] = []; |
832 | 832 | } |
@@ -834,16 +834,16 @@ discard block |
||
834 | 834 | if (T_NAMESPACE === $token[0]) { |
835 | 835 | $lastSeenNamespace = ''; |
836 | 836 | $inNamespace = true; |
837 | - } elseif (T_CLASS === $token[0] && T_DOUBLE_COLON !== $tokens[$i-1][0]) { |
|
837 | + } elseif (T_CLASS === $token[0] && T_DOUBLE_COLON !== $tokens[$i - 1][0]) { |
|
838 | 838 | $inClass = true; |
839 | 839 | } elseif (T_FUNCTION === $token[0]) { |
840 | - if (T_STRING === $tokens[$i+2][0]) { |
|
841 | - $this->staticReflection[$lastSeenClass]['methods'][] = strtolower($tokens[$i+2][1]); |
|
842 | - } elseif ($tokens[$i+2] == '&' && T_STRING === $tokens[$i+3][0]) { |
|
843 | - $this->staticReflection[$lastSeenClass]['methods'][] = strtolower($tokens[$i+3][1]); |
|
840 | + if (T_STRING === $tokens[$i + 2][0]) { |
|
841 | + $this->staticReflection[$lastSeenClass]['methods'][] = strtolower($tokens[$i + 2][1]); |
|
842 | + } elseif ($tokens[$i + 2] == '&' && T_STRING === $tokens[$i + 3][0]) { |
|
843 | + $this->staticReflection[$lastSeenClass]['methods'][] = strtolower($tokens[$i + 3][1]); |
|
844 | 844 | } |
845 | - } elseif (in_array($token[0], [T_VAR, T_PUBLIC, T_PRIVATE, T_PROTECTED], true) && T_FUNCTION !== $tokens[$i+2][0]) { |
|
846 | - $this->staticReflection[$lastSeenClass]['properties'][] = substr($tokens[$i+2][1], 1); |
|
845 | + } elseif (in_array($token[0], [T_VAR, T_PUBLIC, T_PRIVATE, T_PROTECTED], true) && T_FUNCTION !== $tokens[$i + 2][0]) { |
|
846 | + $this->staticReflection[$lastSeenClass]['properties'][] = substr($tokens[$i + 2][1], 1); |
|
847 | 847 | } |
848 | 848 | } |
849 | 849 | } |
@@ -856,7 +856,7 @@ discard block |
||
856 | 856 | */ |
857 | 857 | protected function hasProperty($property, ClassMetadataInfo $metadata): bool |
858 | 858 | { |
859 | - if ($this->extendsClass() || (!$this->isNew && class_exists($metadata->name))) { |
|
859 | + if ($this->extendsClass() || ( ! $this->isNew && class_exists($metadata->name))) { |
|
860 | 860 | // don't generate property if its already on the base class. |
861 | 861 | $reflClass = new \ReflectionClass($this->getClassToExtend() ?: $metadata->name); |
862 | 862 | if ($reflClass->hasProperty($property)) { |
@@ -885,7 +885,7 @@ discard block |
||
885 | 885 | */ |
886 | 886 | protected function hasMethod($method, ClassMetadataInfo $metadata): bool |
887 | 887 | { |
888 | - if ($this->extendsClass() || (!$this->isNew && class_exists($metadata->name))) { |
|
888 | + if ($this->extendsClass() || ( ! $this->isNew && class_exists($metadata->name))) { |
|
889 | 889 | // don't generate method if its already on the base class. |
890 | 890 | $reflClass = new \ReflectionClass($this->getClassToExtend() ?: $metadata->name); |
891 | 891 | |
@@ -914,7 +914,7 @@ discard block |
||
914 | 914 | */ |
915 | 915 | protected function getTraits(ClassMetadataInfo $metadata): array |
916 | 916 | { |
917 | - if (! ($metadata->reflClass !== null || class_exists($metadata->name))) { |
|
917 | + if ( ! ($metadata->reflClass !== null || class_exists($metadata->name))) { |
|
918 | 918 | return []; |
919 | 919 | } |
920 | 920 | |
@@ -954,7 +954,7 @@ discard block |
||
954 | 954 | /** |
955 | 955 | * @return string |
956 | 956 | */ |
957 | - protected function getClassToExtend(): ?string |
|
957 | + protected function getClassToExtend(): ? string |
|
958 | 958 | { |
959 | 959 | return $this->classToExtend; |
960 | 960 | } |
@@ -966,7 +966,7 @@ discard block |
||
966 | 966 | { |
967 | 967 | $refl = new \ReflectionClass($this->getClassToExtend()); |
968 | 968 | |
969 | - return '\\' . $refl->getName(); |
|
969 | + return '\\'.$refl->getName(); |
|
970 | 970 | } |
971 | 971 | |
972 | 972 | /** |
@@ -999,7 +999,7 @@ discard block |
||
999 | 999 | { |
1000 | 1000 | $lines = []; |
1001 | 1001 | $lines[] = '/**'; |
1002 | - $lines[] = ' * ' . $this->getClassName($metadata); |
|
1002 | + $lines[] = ' * '.$this->getClassName($metadata); |
|
1003 | 1003 | |
1004 | 1004 | if ($this->generateAnnotations) { |
1005 | 1005 | $lines[] = ' *'; |
@@ -1015,12 +1015,12 @@ discard block |
||
1015 | 1015 | |
1016 | 1016 | foreach ($methods as $method) { |
1017 | 1017 | if ($code = $this->$method($metadata)) { |
1018 | - $lines[] = ' * ' . $code; |
|
1018 | + $lines[] = ' * '.$code; |
|
1019 | 1019 | } |
1020 | 1020 | } |
1021 | 1021 | |
1022 | 1022 | if (isset($metadata->lifecycleCallbacks) && $metadata->lifecycleCallbacks) { |
1023 | - $lines[] = ' * @' . $this->annotationsPrefix . 'HasLifecycleCallbacks'; |
|
1023 | + $lines[] = ' * @'.$this->annotationsPrefix.'HasLifecycleCallbacks'; |
|
1024 | 1024 | } |
1025 | 1025 | } |
1026 | 1026 | |
@@ -1036,17 +1036,17 @@ discard block |
||
1036 | 1036 | */ |
1037 | 1037 | protected function generateEntityAnnotation(ClassMetadataInfo $metadata): string |
1038 | 1038 | { |
1039 | - $prefix = '@' . $this->annotationsPrefix; |
|
1039 | + $prefix = '@'.$this->annotationsPrefix; |
|
1040 | 1040 | |
1041 | 1041 | if ($metadata->isEmbeddedClass) { |
1042 | - return $prefix . 'Embeddable'; |
|
1042 | + return $prefix.'Embeddable'; |
|
1043 | 1043 | } |
1044 | 1044 | |
1045 | 1045 | $customRepository = $metadata->customRepositoryClassName |
1046 | - ? '(repositoryClass="' . $metadata->customRepositoryClassName . '")' |
|
1046 | + ? '(repositoryClass="'.$metadata->customRepositoryClassName.'")' |
|
1047 | 1047 | : ''; |
1048 | 1048 | |
1049 | - return $prefix . ($metadata->isMappedSuperclass ? 'MappedSuperclass' : 'Entity') . $customRepository; |
|
1049 | + return $prefix.($metadata->isMappedSuperclass ? 'MappedSuperclass' : 'Entity').$customRepository; |
|
1050 | 1050 | } |
1051 | 1051 | |
1052 | 1052 | /** |
@@ -1063,28 +1063,28 @@ discard block |
||
1063 | 1063 | $table = []; |
1064 | 1064 | |
1065 | 1065 | if (isset($metadata->table['schema'])) { |
1066 | - $table[] = 'schema="' . $metadata->table['schema'] . '"'; |
|
1066 | + $table[] = 'schema="'.$metadata->table['schema'].'"'; |
|
1067 | 1067 | } |
1068 | 1068 | |
1069 | 1069 | if (isset($metadata->table['name'])) { |
1070 | - $table[] = 'name="' . $metadata->table['name'] . '"'; |
|
1070 | + $table[] = 'name="'.$metadata->table['name'].'"'; |
|
1071 | 1071 | } |
1072 | 1072 | |
1073 | 1073 | if (isset($metadata->table['options']) && $metadata->table['options']) { |
1074 | - $table[] = 'options={' . $this->exportTableOptions((array) $metadata->table['options']) . '}'; |
|
1074 | + $table[] = 'options={'.$this->exportTableOptions((array) $metadata->table['options']).'}'; |
|
1075 | 1075 | } |
1076 | 1076 | |
1077 | 1077 | if (isset($metadata->table['uniqueConstraints']) && $metadata->table['uniqueConstraints']) { |
1078 | 1078 | $constraints = $this->generateTableConstraints('UniqueConstraint', $metadata->table['uniqueConstraints']); |
1079 | - $table[] = 'uniqueConstraints={' . $constraints . '}'; |
|
1079 | + $table[] = 'uniqueConstraints={'.$constraints.'}'; |
|
1080 | 1080 | } |
1081 | 1081 | |
1082 | 1082 | if (isset($metadata->table['indexes']) && $metadata->table['indexes']) { |
1083 | 1083 | $constraints = $this->generateTableConstraints('Index', $metadata->table['indexes']); |
1084 | - $table[] = 'indexes={' . $constraints . '}'; |
|
1084 | + $table[] = 'indexes={'.$constraints.'}'; |
|
1085 | 1085 | } |
1086 | 1086 | |
1087 | - return '@' . $this->annotationsPrefix . 'Table(' . implode(', ', $table) . ')'; |
|
1087 | + return '@'.$this->annotationsPrefix.'Table('.implode(', ', $table).')'; |
|
1088 | 1088 | } |
1089 | 1089 | |
1090 | 1090 | /** |
@@ -1099,9 +1099,9 @@ discard block |
||
1099 | 1099 | foreach ($constraints as $name => $constraint) { |
1100 | 1100 | $columns = []; |
1101 | 1101 | foreach ($constraint['columns'] as $column) { |
1102 | - $columns[] = '"' . $column . '"'; |
|
1102 | + $columns[] = '"'.$column.'"'; |
|
1103 | 1103 | } |
1104 | - $annotations[] = '@' . $this->annotationsPrefix . $constraintName . '(name="' . $name . '", columns={' . implode(', ', $columns) . '})'; |
|
1104 | + $annotations[] = '@'.$this->annotationsPrefix.$constraintName.'(name="'.$name.'", columns={'.implode(', ', $columns).'})'; |
|
1105 | 1105 | } |
1106 | 1106 | |
1107 | 1107 | return implode(', ', $annotations); |
@@ -1112,10 +1112,10 @@ discard block |
||
1112 | 1112 | * |
1113 | 1113 | * @return string |
1114 | 1114 | */ |
1115 | - protected function generateInheritanceAnnotation(ClassMetadataInfo $metadata): ?string |
|
1115 | + protected function generateInheritanceAnnotation(ClassMetadataInfo $metadata): ? string |
|
1116 | 1116 | { |
1117 | 1117 | if ($metadata->inheritanceType != ClassMetadataInfo::INHERITANCE_TYPE_NONE) { |
1118 | - return '@' . $this->annotationsPrefix . 'InheritanceType("'.$this->getInheritanceTypeString($metadata->inheritanceType).'")'; |
|
1118 | + return '@'.$this->annotationsPrefix.'InheritanceType("'.$this->getInheritanceTypeString($metadata->inheritanceType).'")'; |
|
1119 | 1119 | } |
1120 | 1120 | |
1121 | 1121 | return null; |
@@ -1126,15 +1126,15 @@ discard block |
||
1126 | 1126 | * |
1127 | 1127 | * @return string |
1128 | 1128 | */ |
1129 | - protected function generateDiscriminatorColumnAnnotation(ClassMetadataInfo $metadata): ?string |
|
1129 | + protected function generateDiscriminatorColumnAnnotation(ClassMetadataInfo $metadata): ? string |
|
1130 | 1130 | { |
1131 | 1131 | if ($metadata->inheritanceType != ClassMetadataInfo::INHERITANCE_TYPE_NONE) { |
1132 | 1132 | $discrColumn = $metadata->discriminatorColumn; |
1133 | - $columnDefinition = 'name="' . $discrColumn['name'] |
|
1134 | - . '", type="' . $discrColumn['type'] |
|
1135 | - . '", length=' . $discrColumn['length']; |
|
1133 | + $columnDefinition = 'name="'.$discrColumn['name'] |
|
1134 | + . '", type="'.$discrColumn['type'] |
|
1135 | + . '", length='.$discrColumn['length']; |
|
1136 | 1136 | |
1137 | - return '@' . $this->annotationsPrefix . 'DiscriminatorColumn(' . $columnDefinition . ')'; |
|
1137 | + return '@'.$this->annotationsPrefix.'DiscriminatorColumn('.$columnDefinition.')'; |
|
1138 | 1138 | } |
1139 | 1139 | |
1140 | 1140 | return null; |
@@ -1145,7 +1145,7 @@ discard block |
||
1145 | 1145 | * |
1146 | 1146 | * @return string |
1147 | 1147 | */ |
1148 | - protected function generateDiscriminatorMapAnnotation(ClassMetadataInfo $metadata): ?string |
|
1148 | + protected function generateDiscriminatorMapAnnotation(ClassMetadataInfo $metadata): ? string |
|
1149 | 1149 | { |
1150 | 1150 | if ($metadata->inheritanceType === ClassMetadataInfo::INHERITANCE_TYPE_NONE) { |
1151 | 1151 | return null; |
@@ -1154,10 +1154,10 @@ discard block |
||
1154 | 1154 | $inheritanceClassMap = []; |
1155 | 1155 | |
1156 | 1156 | foreach ($metadata->discriminatorMap as $type => $class) { |
1157 | - $inheritanceClassMap[] .= '"' . $type . '" = "' . $class . '"'; |
|
1157 | + $inheritanceClassMap[] .= '"'.$type.'" = "'.$class.'"'; |
|
1158 | 1158 | } |
1159 | 1159 | |
1160 | - return '@' . $this->annotationsPrefix . 'DiscriminatorMap({' . implode(', ', $inheritanceClassMap) . '})'; |
|
1160 | + return '@'.$this->annotationsPrefix.'DiscriminatorMap({'.implode(', ', $inheritanceClassMap).'})'; |
|
1161 | 1161 | } |
1162 | 1162 | |
1163 | 1163 | /** |
@@ -1179,7 +1179,7 @@ discard block |
||
1179 | 1179 | if (( ! isset($fieldMapping['id']) || |
1180 | 1180 | ! $fieldMapping['id'] || |
1181 | 1181 | $metadata->generatorType == ClassMetadataInfo::GENERATOR_TYPE_NONE |
1182 | - ) && (! $metadata->isEmbeddedClass || ! $this->embeddablesImmutable) |
|
1182 | + ) && ( ! $metadata->isEmbeddedClass || ! $this->embeddablesImmutable) |
|
1183 | 1183 | && $code = $this->generateEntityStubMethod($metadata, 'set', $fieldMapping['fieldName'], $fieldMapping['type'], $nullableField) |
1184 | 1184 | ) { |
1185 | 1185 | $methods[] = $code; |
@@ -1250,7 +1250,7 @@ discard block |
||
1250 | 1250 | } |
1251 | 1251 | |
1252 | 1252 | foreach ($joinColumns as $joinColumn) { |
1253 | - if (isset($joinColumn['nullable']) && !$joinColumn['nullable']) { |
|
1253 | + if (isset($joinColumn['nullable']) && ! $joinColumn['nullable']) { |
|
1254 | 1254 | return false; |
1255 | 1255 | } |
1256 | 1256 | } |
@@ -1295,8 +1295,8 @@ discard block |
||
1295 | 1295 | } |
1296 | 1296 | |
1297 | 1297 | $lines[] = $this->generateAssociationMappingPropertyDocBlock($associationMapping, $metadata); |
1298 | - $lines[] = $this->spaces . $this->fieldVisibility . ' $' . $associationMapping['fieldName'] |
|
1299 | - . ($associationMapping['type'] == 'manyToMany' ? ' = array()' : null) . ";\n"; |
|
1298 | + $lines[] = $this->spaces.$this->fieldVisibility.' $'.$associationMapping['fieldName'] |
|
1299 | + . ($associationMapping['type'] == 'manyToMany' ? ' = array()' : null).";\n"; |
|
1300 | 1300 | } |
1301 | 1301 | |
1302 | 1302 | return implode("\n", $lines); |
@@ -1323,8 +1323,8 @@ discard block |
||
1323 | 1323 | } |
1324 | 1324 | |
1325 | 1325 | $lines[] = $this->generateFieldMappingPropertyDocBlock($fieldMapping, $metadata); |
1326 | - $lines[] = $this->spaces . $this->fieldVisibility . ' $' . $fieldMapping['fieldName'] |
|
1327 | - . (isset($fieldMapping['options']['default']) ? ' = ' . var_export($fieldMapping['options']['default'], true) : null) . ";\n"; |
|
1326 | + $lines[] = $this->spaces.$this->fieldVisibility.' $'.$fieldMapping['fieldName'] |
|
1327 | + . (isset($fieldMapping['options']['default']) ? ' = '.var_export($fieldMapping['options']['default'], true) : null).";\n"; |
|
1328 | 1328 | } |
1329 | 1329 | |
1330 | 1330 | return implode("\n", $lines); |
@@ -1345,7 +1345,7 @@ discard block |
||
1345 | 1345 | } |
1346 | 1346 | |
1347 | 1347 | $lines[] = $this->generateEmbeddedPropertyDocBlock($embeddedClass); |
1348 | - $lines[] = $this->spaces . $this->fieldVisibility . ' $' . $fieldName . ";\n"; |
|
1348 | + $lines[] = $this->spaces.$this->fieldVisibility.' $'.$fieldName.";\n"; |
|
1349 | 1349 | } |
1350 | 1350 | |
1351 | 1351 | return implode("\n", $lines); |
@@ -1362,7 +1362,7 @@ discard block |
||
1362 | 1362 | */ |
1363 | 1363 | protected function generateEntityStubMethod(ClassMetadataInfo $metadata, $type, $fieldName, $typeHint = null, $defaultValue = null): string |
1364 | 1364 | { |
1365 | - $methodName = $type . Inflector::classify($fieldName); |
|
1365 | + $methodName = $type.Inflector::classify($fieldName); |
|
1366 | 1366 | $variableName = Inflector::camelize($fieldName); |
1367 | 1367 | if (in_array($type, ["add", "remove"])) { |
1368 | 1368 | $methodName = Inflector::singularize($methodName); |
@@ -1382,18 +1382,18 @@ discard block |
||
1382 | 1382 | $variableType = $typeHint ? $this->getType($typeHint) : null; |
1383 | 1383 | |
1384 | 1384 | if ($typeHint && ! isset($types[$typeHint])) { |
1385 | - $variableType = '\\' . ltrim($variableType, '\\'); |
|
1386 | - $methodTypeHint = '\\' . $typeHint . ' '; |
|
1385 | + $variableType = '\\'.ltrim($variableType, '\\'); |
|
1386 | + $methodTypeHint = '\\'.$typeHint.' '; |
|
1387 | 1387 | } |
1388 | 1388 | |
1389 | 1389 | $replacements = [ |
1390 | - '<description>' => ucfirst($type) . ' ' . $variableName . '.', |
|
1390 | + '<description>' => ucfirst($type).' '.$variableName.'.', |
|
1391 | 1391 | '<methodTypeHint>' => $methodTypeHint, |
1392 | - '<variableType>' => $variableType . (null !== $defaultValue ? ('|' . $defaultValue) : ''), |
|
1392 | + '<variableType>' => $variableType.(null !== $defaultValue ? ('|'.$defaultValue) : ''), |
|
1393 | 1393 | '<variableName>' => $variableName, |
1394 | 1394 | '<methodName>' => $methodName, |
1395 | 1395 | '<fieldName>' => $fieldName, |
1396 | - '<variableDefault>' => ($defaultValue !== null ) ? (' = ' . $defaultValue) : '', |
|
1396 | + '<variableDefault>' => ($defaultValue !== null) ? (' = '.$defaultValue) : '', |
|
1397 | 1397 | '<entity>' => $this->getClassName($metadata) |
1398 | 1398 | ]; |
1399 | 1399 | |
@@ -1421,7 +1421,7 @@ discard block |
||
1421 | 1421 | $this->staticReflection[$metadata->name]['methods'][] = $methodName; |
1422 | 1422 | |
1423 | 1423 | $replacements = [ |
1424 | - '<name>' => $this->annotationsPrefix . ucfirst($name), |
|
1424 | + '<name>' => $this->annotationsPrefix.ucfirst($name), |
|
1425 | 1425 | '<methodName>' => $methodName, |
1426 | 1426 | ]; |
1427 | 1427 | |
@@ -1444,30 +1444,30 @@ discard block |
||
1444 | 1444 | $joinColumnAnnot = []; |
1445 | 1445 | |
1446 | 1446 | if (isset($joinColumn['name'])) { |
1447 | - $joinColumnAnnot[] = 'name="' . $joinColumn['name'] . '"'; |
|
1447 | + $joinColumnAnnot[] = 'name="'.$joinColumn['name'].'"'; |
|
1448 | 1448 | } |
1449 | 1449 | |
1450 | 1450 | if (isset($joinColumn['referencedColumnName'])) { |
1451 | - $joinColumnAnnot[] = 'referencedColumnName="' . $joinColumn['referencedColumnName'] . '"'; |
|
1451 | + $joinColumnAnnot[] = 'referencedColumnName="'.$joinColumn['referencedColumnName'].'"'; |
|
1452 | 1452 | } |
1453 | 1453 | |
1454 | 1454 | if (isset($joinColumn['unique']) && $joinColumn['unique']) { |
1455 | - $joinColumnAnnot[] = 'unique=' . ($joinColumn['unique'] ? 'true' : 'false'); |
|
1455 | + $joinColumnAnnot[] = 'unique='.($joinColumn['unique'] ? 'true' : 'false'); |
|
1456 | 1456 | } |
1457 | 1457 | |
1458 | 1458 | if (isset($joinColumn['nullable'])) { |
1459 | - $joinColumnAnnot[] = 'nullable=' . ($joinColumn['nullable'] ? 'true' : 'false'); |
|
1459 | + $joinColumnAnnot[] = 'nullable='.($joinColumn['nullable'] ? 'true' : 'false'); |
|
1460 | 1460 | } |
1461 | 1461 | |
1462 | 1462 | if (isset($joinColumn['onDelete'])) { |
1463 | - $joinColumnAnnot[] = 'onDelete="' . ($joinColumn['onDelete'] . '"'); |
|
1463 | + $joinColumnAnnot[] = 'onDelete="'.($joinColumn['onDelete'].'"'); |
|
1464 | 1464 | } |
1465 | 1465 | |
1466 | 1466 | if (isset($joinColumn['columnDefinition'])) { |
1467 | - $joinColumnAnnot[] = 'columnDefinition="' . $joinColumn['columnDefinition'] . '"'; |
|
1467 | + $joinColumnAnnot[] = 'columnDefinition="'.$joinColumn['columnDefinition'].'"'; |
|
1468 | 1468 | } |
1469 | 1469 | |
1470 | - return '@' . $this->annotationsPrefix . 'JoinColumn(' . implode(', ', $joinColumnAnnot) . ')'; |
|
1470 | + return '@'.$this->annotationsPrefix.'JoinColumn('.implode(', ', $joinColumnAnnot).')'; |
|
1471 | 1471 | } |
1472 | 1472 | |
1473 | 1473 | /** |
@@ -1479,22 +1479,22 @@ discard block |
||
1479 | 1479 | protected function generateAssociationMappingPropertyDocBlock(array $associationMapping, ClassMetadataInfo $metadata): string |
1480 | 1480 | { |
1481 | 1481 | $lines = []; |
1482 | - $lines[] = $this->spaces . '/**'; |
|
1482 | + $lines[] = $this->spaces.'/**'; |
|
1483 | 1483 | |
1484 | 1484 | if ($associationMapping['type'] & ClassMetadataInfo::TO_MANY) { |
1485 | - $lines[] = $this->spaces . ' * @var \Doctrine\Common\Collections\Collection'; |
|
1485 | + $lines[] = $this->spaces.' * @var \Doctrine\Common\Collections\Collection'; |
|
1486 | 1486 | } else { |
1487 | - $lines[] = $this->spaces . ' * @var \\' . ltrim($associationMapping['targetEntity'], '\\'); |
|
1487 | + $lines[] = $this->spaces.' * @var \\'.ltrim($associationMapping['targetEntity'], '\\'); |
|
1488 | 1488 | } |
1489 | 1489 | |
1490 | 1490 | if ($this->generateAnnotations) { |
1491 | - $lines[] = $this->spaces . ' *'; |
|
1491 | + $lines[] = $this->spaces.' *'; |
|
1492 | 1492 | |
1493 | 1493 | if (isset($associationMapping['id']) && $associationMapping['id']) { |
1494 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'Id'; |
|
1494 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'Id'; |
|
1495 | 1495 | |
1496 | 1496 | if ($generatorType = $this->getIdGeneratorTypeString($metadata->generatorType)) { |
1497 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'GeneratedValue(strategy="' . $generatorType . '")'; |
|
1497 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'GeneratedValue(strategy="'.$generatorType.'")'; |
|
1498 | 1498 | } |
1499 | 1499 | } |
1500 | 1500 | |
@@ -1516,15 +1516,15 @@ discard block |
||
1516 | 1516 | $typeOptions = []; |
1517 | 1517 | |
1518 | 1518 | if (isset($associationMapping['targetEntity'])) { |
1519 | - $typeOptions[] = 'targetEntity="' . $associationMapping['targetEntity'] . '"'; |
|
1519 | + $typeOptions[] = 'targetEntity="'.$associationMapping['targetEntity'].'"'; |
|
1520 | 1520 | } |
1521 | 1521 | |
1522 | 1522 | if (isset($associationMapping['inversedBy'])) { |
1523 | - $typeOptions[] = 'inversedBy="' . $associationMapping['inversedBy'] . '"'; |
|
1523 | + $typeOptions[] = 'inversedBy="'.$associationMapping['inversedBy'].'"'; |
|
1524 | 1524 | } |
1525 | 1525 | |
1526 | 1526 | if (isset($associationMapping['mappedBy'])) { |
1527 | - $typeOptions[] = 'mappedBy="' . $associationMapping['mappedBy'] . '"'; |
|
1527 | + $typeOptions[] = 'mappedBy="'.$associationMapping['mappedBy'].'"'; |
|
1528 | 1528 | } |
1529 | 1529 | |
1530 | 1530 | if ($associationMapping['cascade']) { |
@@ -1540,11 +1540,11 @@ discard block |
||
1540 | 1540 | $cascades = ['"all"']; |
1541 | 1541 | } |
1542 | 1542 | |
1543 | - $typeOptions[] = 'cascade={' . implode(',', $cascades) . '}'; |
|
1543 | + $typeOptions[] = 'cascade={'.implode(',', $cascades).'}'; |
|
1544 | 1544 | } |
1545 | 1545 | |
1546 | 1546 | if (isset($associationMapping['orphanRemoval']) && $associationMapping['orphanRemoval']) { |
1547 | - $typeOptions[] = 'orphanRemoval=' . ($associationMapping['orphanRemoval'] ? 'true' : 'false'); |
|
1547 | + $typeOptions[] = 'orphanRemoval='.($associationMapping['orphanRemoval'] ? 'true' : 'false'); |
|
1548 | 1548 | } |
1549 | 1549 | |
1550 | 1550 | if (isset($associationMapping['fetch']) && $associationMapping['fetch'] !== ClassMetadataInfo::FETCH_LAZY) { |
@@ -1553,71 +1553,71 @@ discard block |
||
1553 | 1553 | ClassMetadataInfo::FETCH_EAGER => 'EAGER', |
1554 | 1554 | ]; |
1555 | 1555 | |
1556 | - $typeOptions[] = 'fetch="' . $fetchMap[$associationMapping['fetch']] . '"'; |
|
1556 | + $typeOptions[] = 'fetch="'.$fetchMap[$associationMapping['fetch']].'"'; |
|
1557 | 1557 | } |
1558 | 1558 | |
1559 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . '' . $type . '(' . implode(', ', $typeOptions) . ')'; |
|
1559 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.''.$type.'('.implode(', ', $typeOptions).')'; |
|
1560 | 1560 | |
1561 | 1561 | if (isset($associationMapping['joinColumns']) && $associationMapping['joinColumns']) { |
1562 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'JoinColumns({'; |
|
1562 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'JoinColumns({'; |
|
1563 | 1563 | |
1564 | 1564 | $joinColumnsLines = []; |
1565 | 1565 | |
1566 | 1566 | foreach ($associationMapping['joinColumns'] as $joinColumn) { |
1567 | 1567 | if ($joinColumnAnnot = $this->generateJoinColumnAnnotation($joinColumn)) { |
1568 | - $joinColumnsLines[] = $this->spaces . ' * ' . $joinColumnAnnot; |
|
1568 | + $joinColumnsLines[] = $this->spaces.' * '.$joinColumnAnnot; |
|
1569 | 1569 | } |
1570 | 1570 | } |
1571 | 1571 | |
1572 | 1572 | $lines[] = implode(",\n", $joinColumnsLines); |
1573 | - $lines[] = $this->spaces . ' * })'; |
|
1573 | + $lines[] = $this->spaces.' * })'; |
|
1574 | 1574 | } |
1575 | 1575 | |
1576 | 1576 | if (isset($associationMapping['joinTable']) && $associationMapping['joinTable']) { |
1577 | 1577 | $joinTable = []; |
1578 | - $joinTable[] = 'name="' . $associationMapping['joinTable']['name'] . '"'; |
|
1578 | + $joinTable[] = 'name="'.$associationMapping['joinTable']['name'].'"'; |
|
1579 | 1579 | |
1580 | 1580 | if (isset($associationMapping['joinTable']['schema'])) { |
1581 | - $joinTable[] = 'schema="' . $associationMapping['joinTable']['schema'] . '"'; |
|
1581 | + $joinTable[] = 'schema="'.$associationMapping['joinTable']['schema'].'"'; |
|
1582 | 1582 | } |
1583 | 1583 | |
1584 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'JoinTable(' . implode(', ', $joinTable) . ','; |
|
1585 | - $lines[] = $this->spaces . ' * joinColumns={'; |
|
1584 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'JoinTable('.implode(', ', $joinTable).','; |
|
1585 | + $lines[] = $this->spaces.' * joinColumns={'; |
|
1586 | 1586 | |
1587 | 1587 | $joinColumnsLines = []; |
1588 | 1588 | |
1589 | 1589 | foreach ($associationMapping['joinTable']['joinColumns'] as $joinColumn) { |
1590 | - $joinColumnsLines[] = $this->spaces . ' * ' . $this->generateJoinColumnAnnotation($joinColumn); |
|
1590 | + $joinColumnsLines[] = $this->spaces.' * '.$this->generateJoinColumnAnnotation($joinColumn); |
|
1591 | 1591 | } |
1592 | 1592 | |
1593 | - $lines[] = implode(",". PHP_EOL, $joinColumnsLines); |
|
1594 | - $lines[] = $this->spaces . ' * },'; |
|
1595 | - $lines[] = $this->spaces . ' * inverseJoinColumns={'; |
|
1593 | + $lines[] = implode(",".PHP_EOL, $joinColumnsLines); |
|
1594 | + $lines[] = $this->spaces.' * },'; |
|
1595 | + $lines[] = $this->spaces.' * inverseJoinColumns={'; |
|
1596 | 1596 | |
1597 | 1597 | $inverseJoinColumnsLines = []; |
1598 | 1598 | |
1599 | 1599 | foreach ($associationMapping['joinTable']['inverseJoinColumns'] as $joinColumn) { |
1600 | - $inverseJoinColumnsLines[] = $this->spaces . ' * ' . $this->generateJoinColumnAnnotation($joinColumn); |
|
1600 | + $inverseJoinColumnsLines[] = $this->spaces.' * '.$this->generateJoinColumnAnnotation($joinColumn); |
|
1601 | 1601 | } |
1602 | 1602 | |
1603 | - $lines[] = implode(",". PHP_EOL, $inverseJoinColumnsLines); |
|
1604 | - $lines[] = $this->spaces . ' * }'; |
|
1605 | - $lines[] = $this->spaces . ' * )'; |
|
1603 | + $lines[] = implode(",".PHP_EOL, $inverseJoinColumnsLines); |
|
1604 | + $lines[] = $this->spaces.' * }'; |
|
1605 | + $lines[] = $this->spaces.' * )'; |
|
1606 | 1606 | } |
1607 | 1607 | |
1608 | 1608 | if (isset($associationMapping['orderBy'])) { |
1609 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'OrderBy({'; |
|
1609 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'OrderBy({'; |
|
1610 | 1610 | |
1611 | 1611 | foreach ($associationMapping['orderBy'] as $name => $direction) { |
1612 | - $lines[] = $this->spaces . ' * "' . $name . '"="' . $direction . '",'; |
|
1612 | + $lines[] = $this->spaces.' * "'.$name.'"="'.$direction.'",'; |
|
1613 | 1613 | } |
1614 | 1614 | |
1615 | 1615 | $lines[count($lines) - 1] = substr($lines[count($lines) - 1], 0, strlen($lines[count($lines) - 1]) - 1); |
1616 | - $lines[] = $this->spaces . ' * })'; |
|
1616 | + $lines[] = $this->spaces.' * })'; |
|
1617 | 1617 | } |
1618 | 1618 | } |
1619 | 1619 | |
1620 | - $lines[] = $this->spaces . ' */'; |
|
1620 | + $lines[] = $this->spaces.' */'; |
|
1621 | 1621 | |
1622 | 1622 | return implode("\n", $lines); |
1623 | 1623 | } |
@@ -1631,37 +1631,37 @@ discard block |
||
1631 | 1631 | protected function generateFieldMappingPropertyDocBlock(array $fieldMapping, ClassMetadataInfo $metadata): string |
1632 | 1632 | { |
1633 | 1633 | $lines = []; |
1634 | - $lines[] = $this->spaces . '/**'; |
|
1635 | - $lines[] = $this->spaces . ' * @var ' |
|
1634 | + $lines[] = $this->spaces.'/**'; |
|
1635 | + $lines[] = $this->spaces.' * @var ' |
|
1636 | 1636 | . $this->getType($fieldMapping['type']) |
1637 | 1637 | . ($this->nullableFieldExpression($fieldMapping) ? '|null' : ''); |
1638 | 1638 | |
1639 | 1639 | if ($this->generateAnnotations) { |
1640 | - $lines[] = $this->spaces . ' *'; |
|
1640 | + $lines[] = $this->spaces.' *'; |
|
1641 | 1641 | |
1642 | 1642 | $column = []; |
1643 | 1643 | if (isset($fieldMapping['columnName'])) { |
1644 | - $column[] = 'name="' . $fieldMapping['columnName'] . '"'; |
|
1644 | + $column[] = 'name="'.$fieldMapping['columnName'].'"'; |
|
1645 | 1645 | } |
1646 | 1646 | |
1647 | 1647 | if (isset($fieldMapping['type'])) { |
1648 | - $column[] = 'type="' . $fieldMapping['type'] . '"'; |
|
1648 | + $column[] = 'type="'.$fieldMapping['type'].'"'; |
|
1649 | 1649 | } |
1650 | 1650 | |
1651 | 1651 | if (isset($fieldMapping['length'])) { |
1652 | - $column[] = 'length=' . $fieldMapping['length']; |
|
1652 | + $column[] = 'length='.$fieldMapping['length']; |
|
1653 | 1653 | } |
1654 | 1654 | |
1655 | 1655 | if (isset($fieldMapping['precision'])) { |
1656 | - $column[] = 'precision=' . $fieldMapping['precision']; |
|
1656 | + $column[] = 'precision='.$fieldMapping['precision']; |
|
1657 | 1657 | } |
1658 | 1658 | |
1659 | 1659 | if (isset($fieldMapping['scale'])) { |
1660 | - $column[] = 'scale=' . $fieldMapping['scale']; |
|
1660 | + $column[] = 'scale='.$fieldMapping['scale']; |
|
1661 | 1661 | } |
1662 | 1662 | |
1663 | 1663 | if (isset($fieldMapping['nullable'])) { |
1664 | - $column[] = 'nullable=' . var_export($fieldMapping['nullable'], true); |
|
1664 | + $column[] = 'nullable='.var_export($fieldMapping['nullable'], true); |
|
1665 | 1665 | } |
1666 | 1666 | |
1667 | 1667 | $options = []; |
@@ -1675,47 +1675,47 @@ discard block |
||
1675 | 1675 | } |
1676 | 1676 | |
1677 | 1677 | if (isset($fieldMapping['columnDefinition'])) { |
1678 | - $column[] = 'columnDefinition="' . $fieldMapping['columnDefinition'] . '"'; |
|
1678 | + $column[] = 'columnDefinition="'.$fieldMapping['columnDefinition'].'"'; |
|
1679 | 1679 | } |
1680 | 1680 | |
1681 | 1681 | if (isset($fieldMapping['unique'])) { |
1682 | - $column[] = 'unique=' . var_export($fieldMapping['unique'], true); |
|
1682 | + $column[] = 'unique='.var_export($fieldMapping['unique'], true); |
|
1683 | 1683 | } |
1684 | 1684 | |
1685 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'Column(' . implode(', ', $column) . ')'; |
|
1685 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'Column('.implode(', ', $column).')'; |
|
1686 | 1686 | |
1687 | 1687 | if (isset($fieldMapping['id']) && $fieldMapping['id']) { |
1688 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'Id'; |
|
1688 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'Id'; |
|
1689 | 1689 | |
1690 | 1690 | if ($generatorType = $this->getIdGeneratorTypeString($metadata->generatorType)) { |
1691 | - $lines[] = $this->spaces.' * @' . $this->annotationsPrefix . 'GeneratedValue(strategy="' . $generatorType . '")'; |
|
1691 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'GeneratedValue(strategy="'.$generatorType.'")'; |
|
1692 | 1692 | } |
1693 | 1693 | |
1694 | 1694 | if ($metadata->sequenceGeneratorDefinition) { |
1695 | 1695 | $sequenceGenerator = []; |
1696 | 1696 | |
1697 | 1697 | if (isset($metadata->sequenceGeneratorDefinition['sequenceName'])) { |
1698 | - $sequenceGenerator[] = 'sequenceName="' . $metadata->sequenceGeneratorDefinition['sequenceName'] . '"'; |
|
1698 | + $sequenceGenerator[] = 'sequenceName="'.$metadata->sequenceGeneratorDefinition['sequenceName'].'"'; |
|
1699 | 1699 | } |
1700 | 1700 | |
1701 | 1701 | if (isset($metadata->sequenceGeneratorDefinition['allocationSize'])) { |
1702 | - $sequenceGenerator[] = 'allocationSize=' . $metadata->sequenceGeneratorDefinition['allocationSize']; |
|
1702 | + $sequenceGenerator[] = 'allocationSize='.$metadata->sequenceGeneratorDefinition['allocationSize']; |
|
1703 | 1703 | } |
1704 | 1704 | |
1705 | 1705 | if (isset($metadata->sequenceGeneratorDefinition['initialValue'])) { |
1706 | - $sequenceGenerator[] = 'initialValue=' . $metadata->sequenceGeneratorDefinition['initialValue']; |
|
1706 | + $sequenceGenerator[] = 'initialValue='.$metadata->sequenceGeneratorDefinition['initialValue']; |
|
1707 | 1707 | } |
1708 | 1708 | |
1709 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'SequenceGenerator(' . implode(', ', $sequenceGenerator) . ')'; |
|
1709 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'SequenceGenerator('.implode(', ', $sequenceGenerator).')'; |
|
1710 | 1710 | } |
1711 | 1711 | } |
1712 | 1712 | |
1713 | 1713 | if (isset($fieldMapping['version']) && $fieldMapping['version']) { |
1714 | - $lines[] = $this->spaces . ' * @' . $this->annotationsPrefix . 'Version'; |
|
1714 | + $lines[] = $this->spaces.' * @'.$this->annotationsPrefix.'Version'; |
|
1715 | 1715 | } |
1716 | 1716 | } |
1717 | 1717 | |
1718 | - $lines[] = $this->spaces . ' */'; |
|
1718 | + $lines[] = $this->spaces.' */'; |
|
1719 | 1719 | |
1720 | 1720 | return implode("\n", $lines); |
1721 | 1721 | } |
@@ -1728,27 +1728,27 @@ discard block |
||
1728 | 1728 | protected function generateEmbeddedPropertyDocBlock(array $embeddedClass): string |
1729 | 1729 | { |
1730 | 1730 | $lines = []; |
1731 | - $lines[] = $this->spaces . '/**'; |
|
1732 | - $lines[] = $this->spaces . ' * @var \\' . ltrim($embeddedClass['class'], '\\'); |
|
1731 | + $lines[] = $this->spaces.'/**'; |
|
1732 | + $lines[] = $this->spaces.' * @var \\'.ltrim($embeddedClass['class'], '\\'); |
|
1733 | 1733 | |
1734 | 1734 | if ($this->generateAnnotations) { |
1735 | - $lines[] = $this->spaces . ' *'; |
|
1735 | + $lines[] = $this->spaces.' *'; |
|
1736 | 1736 | |
1737 | - $embedded = ['class="' . $embeddedClass['class'] . '"']; |
|
1737 | + $embedded = ['class="'.$embeddedClass['class'].'"']; |
|
1738 | 1738 | |
1739 | 1739 | if (isset($embeddedClass['columnPrefix'])) { |
1740 | 1740 | if (is_string($embeddedClass['columnPrefix'])) { |
1741 | - $embedded[] = 'columnPrefix="' . $embeddedClass['columnPrefix'] . '"'; |
|
1741 | + $embedded[] = 'columnPrefix="'.$embeddedClass['columnPrefix'].'"'; |
|
1742 | 1742 | } else { |
1743 | - $embedded[] = 'columnPrefix=' . var_export($embeddedClass['columnPrefix'], true); |
|
1743 | + $embedded[] = 'columnPrefix='.var_export($embeddedClass['columnPrefix'], true); |
|
1744 | 1744 | } |
1745 | 1745 | } |
1746 | 1746 | |
1747 | - $lines[] = $this->spaces . ' * @' . |
|
1748 | - $this->annotationsPrefix . 'Embedded(' . implode(', ', $embedded) . ')'; |
|
1747 | + $lines[] = $this->spaces.' * @'. |
|
1748 | + $this->annotationsPrefix.'Embedded('.implode(', ', $embedded).')'; |
|
1749 | 1749 | } |
1750 | 1750 | |
1751 | - $lines[] = $this->spaces . ' */'; |
|
1751 | + $lines[] = $this->spaces.' */'; |
|
1752 | 1752 | |
1753 | 1753 | return implode("\n", $lines); |
1754 | 1754 | } |
@@ -1767,13 +1767,13 @@ discard block |
||
1767 | 1767 | $processedClasses = []; |
1768 | 1768 | foreach ($metadata->entityListeners as $event => $eventListeners) { |
1769 | 1769 | foreach ($eventListeners as $eventListener) { |
1770 | - $processedClasses[] = '"' . $eventListener['class'] . '"'; |
|
1770 | + $processedClasses[] = '"'.$eventListener['class'].'"'; |
|
1771 | 1771 | } |
1772 | 1772 | } |
1773 | 1773 | |
1774 | 1774 | return \sprintf( |
1775 | 1775 | '%s%s({%s})', |
1776 | - '@' . $this->annotationsPrefix, |
|
1776 | + '@'.$this->annotationsPrefix, |
|
1777 | 1777 | 'EntityListeners', |
1778 | 1778 | \implode(',', \array_unique($processedClasses)) |
1779 | 1779 | ); |
@@ -1791,7 +1791,7 @@ discard block |
||
1791 | 1791 | |
1792 | 1792 | foreach ($lines as $key => $value) { |
1793 | 1793 | if ( ! empty($value)) { |
1794 | - $lines[$key] = str_repeat($this->spaces, $num) . $lines[$key]; |
|
1794 | + $lines[$key] = str_repeat($this->spaces, $num).$lines[$key]; |
|
1795 | 1795 | } |
1796 | 1796 | } |
1797 | 1797 | |
@@ -1851,7 +1851,7 @@ discard block |
||
1851 | 1851 | * |
1852 | 1852 | * @return string|null |
1853 | 1853 | */ |
1854 | - private function nullableFieldExpression(array $fieldMapping): ?string |
|
1854 | + private function nullableFieldExpression(array $fieldMapping): ? string |
|
1855 | 1855 | { |
1856 | 1856 | if (isset($fieldMapping['nullable']) && true === $fieldMapping['nullable']) { |
1857 | 1857 | return 'null'; |
@@ -1873,9 +1873,9 @@ discard block |
||
1873 | 1873 | |
1874 | 1874 | foreach ($options as $name => $option) { |
1875 | 1875 | if (is_array($option)) { |
1876 | - $optionsStr[] = '"' . $name . '"={' . $this->exportTableOptions($option) . '}'; |
|
1876 | + $optionsStr[] = '"'.$name.'"={'.$this->exportTableOptions($option).'}'; |
|
1877 | 1877 | } else { |
1878 | - $optionsStr[] = '"' . $name . '"="' . (string) $option . '"'; |
|
1878 | + $optionsStr[] = '"'.$name.'"="'.(string) $option.'"'; |
|
1879 | 1879 | } |
1880 | 1880 | } |
1881 | 1881 |