@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | |
4 | -declare(strict_types=1); |
|
4 | +declare(strict_types = 1); |
|
5 | 5 | |
6 | 6 | namespace Doctrine\ORM\Mapping\Exporter; |
7 | 7 |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | |
4 | -declare(strict_types=1); |
|
4 | +declare(strict_types = 1); |
|
5 | 5 | |
6 | 6 | namespace Doctrine\ORM\Mapping\Exporter; |
7 | 7 | |
@@ -16,18 +16,18 @@ discard block |
||
16 | 16 | { |
17 | 17 | /** @var LocalColumnMetadata $value */ |
18 | 18 | $indentation = str_repeat(self::INDENTATION, $indentationLevel); |
19 | - $objectReference = $indentation . static::VARIABLE; |
|
19 | + $objectReference = $indentation.static::VARIABLE; |
|
20 | 20 | $lines = []; |
21 | 21 | |
22 | 22 | $lines[] = parent::export($value, $indentationLevel); |
23 | 23 | |
24 | - $lines[] = $objectReference . '->setLength(' . $value->getLength() . ');'; |
|
25 | - $lines[] = $objectReference . '->setScale(' . $value->getScale() . ');'; |
|
26 | - $lines[] = $objectReference . '->setPrecision(' . $value->getPrecision() . ');'; |
|
24 | + $lines[] = $objectReference.'->setLength('.$value->getLength().');'; |
|
25 | + $lines[] = $objectReference.'->setScale('.$value->getScale().');'; |
|
26 | + $lines[] = $objectReference.'->setPrecision('.$value->getPrecision().');'; |
|
27 | 27 | |
28 | 28 | if ($value->hasValueGenerator()) { |
29 | 29 | $lines[] = sprintf( |
30 | - $objectReference . '->setValueGenerator(new ValueGenerator(%s, %s));', |
|
30 | + $objectReference.'->setValueGenerator(new ValueGenerator(%s, %s));', |
|
31 | 31 | var_export($value->getValueGenerator()->getType(), true), |
32 | 32 | var_export($value->getValueGenerator()->getDefinition(), true) |
33 | 33 | ); |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | |
4 | -declare(strict_types=1); |
|
4 | +declare(strict_types = 1); |
|
5 | 5 | |
6 | 6 | namespace Doctrine\ORM\Mapping\Exporter; |
7 | 7 |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | |
4 | -declare(strict_types=1); |
|
4 | +declare(strict_types = 1); |
|
5 | 5 | |
6 | 6 | namespace Doctrine\ORM\Mapping\Exporter; |
7 | 7 | |
@@ -18,10 +18,10 @@ discard block |
||
18 | 18 | { |
19 | 19 | /** @var CacheMetadata $value */ |
20 | 20 | $indentation = str_repeat(self::INDENTATION, $indentationLevel); |
21 | - $objectReference = $indentation . static::VARIABLE; |
|
21 | + $objectReference = $indentation.static::VARIABLE; |
|
22 | 22 | $lines = []; |
23 | 23 | |
24 | - $lines[] = $objectReference . ' = ' . $this->exportInstantiation($value); |
|
24 | + $lines[] = $objectReference.' = '.$this->exportInstantiation($value); |
|
25 | 25 | |
26 | 26 | return implode(PHP_EOL, $lines); |
27 | 27 | } |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | |
4 | -declare(strict_types=1); |
|
4 | +declare(strict_types = 1); |
|
5 | 5 | |
6 | 6 | namespace Doctrine\ORM\Mapping\Exporter; |
7 | 7 | |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | { |
17 | 17 | /** @var ManyToManyAssociationMetadata $value */ |
18 | 18 | $indentation = str_repeat(self::INDENTATION, $indentationLevel); |
19 | - $objectReference = $indentation . static::VARIABLE; |
|
19 | + $objectReference = $indentation.static::VARIABLE; |
|
20 | 20 | $lines = []; |
21 | 21 | |
22 | 22 | $lines[] = parent::export($value, $indentationLevel); |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | $lines[] = null; |
28 | 28 | $lines[] = $joinTableExporter->export($value->getJoinTable(), $indentationLevel); |
29 | 29 | $lines[] = null; |
30 | - $lines[] = $objectReference . '->setJoinTable(' . $joinTableExporter::VARIABLE . ');'; |
|
30 | + $lines[] = $objectReference.'->setJoinTable('.$joinTableExporter::VARIABLE.');'; |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | return implode(PHP_EOL, $lines); |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | |
4 | -declare(strict_types=1); |
|
4 | +declare(strict_types = 1); |
|
5 | 5 | |
6 | 6 | namespace Doctrine\ORM\Mapping\Exporter; |
7 | 7 |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | |
4 | -declare(strict_types=1); |
|
4 | +declare(strict_types = 1); |
|
5 | 5 | |
6 | 6 | namespace Doctrine\ORM\Mapping\Exporter; |
7 | 7 | |
@@ -19,19 +19,19 @@ discard block |
||
19 | 19 | /** @var JoinTableMetadata $value */ |
20 | 20 | $joinColumnExporter = new JoinColumnMetadataExporter(); |
21 | 21 | $indentation = str_repeat(self::INDENTATION, $indentationLevel); |
22 | - $objectReference = $indentation . static::VARIABLE; |
|
22 | + $objectReference = $indentation.static::VARIABLE; |
|
23 | 23 | $lines = []; |
24 | 24 | |
25 | 25 | $lines[] = parent::export($value, $indentationLevel); |
26 | 26 | |
27 | 27 | foreach ($value->getJoinColumns() as $joinColumn) { |
28 | 28 | $lines[] = $joinColumnExporter->export($joinColumn, $indentationLevel); |
29 | - $lines[] = $objectReference . '->addJoinColumn(' . $joinColumnExporter::VARIABLE . ');'; |
|
29 | + $lines[] = $objectReference.'->addJoinColumn('.$joinColumnExporter::VARIABLE.');'; |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | foreach ($value->getInverseJoinColumns() as $inverseJoinColumn) { |
33 | 33 | $lines[] = $joinColumnExporter->export($inverseJoinColumn, $indentationLevel); |
34 | - $lines[] = $objectReference . '->addInverseJoinColumn(' . $joinColumnExporter::VARIABLE . ');'; |
|
34 | + $lines[] = $objectReference.'->addInverseJoinColumn('.$joinColumnExporter::VARIABLE.');'; |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | return implode(PHP_EOL, $lines); |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | |
4 | -declare(strict_types=1); |
|
4 | +declare(strict_types = 1); |
|
5 | 5 | |
6 | 6 | namespace Doctrine\ORM\Mapping\Exporter; |
7 | 7 | |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | $lines[] = null; |
27 | 27 | |
28 | 28 | if ($namespace) { |
29 | - $lines[] = 'namespace ' . $namespace . ';'; |
|
29 | + $lines[] = 'namespace '.$namespace.';'; |
|
30 | 30 | $lines[] = null; |
31 | 31 | } |
32 | 32 | |
@@ -74,31 +74,31 @@ discard block |
||
74 | 74 | { |
75 | 75 | $indentation = str_repeat(self::INDENTATION, $indentationLevel); |
76 | 76 | $bodyIndentation = str_repeat(self::INDENTATION, $indentationLevel + 1); |
77 | - $objectReference = $bodyIndentation . static::VARIABLE; |
|
77 | + $objectReference = $bodyIndentation.static::VARIABLE; |
|
78 | 78 | $lines = []; |
79 | 79 | |
80 | - $lines[] = $indentation . 'public function __construct('; |
|
81 | - $lines[] = $bodyIndentation . 'ClassMetadataBuildingContext $metadataBuildingContext,'; |
|
82 | - $lines[] = $bodyIndentation . '?ClassMetadata $parent = null'; |
|
83 | - $lines[] = $indentation . ')'; |
|
84 | - $lines[] = $indentation . '{'; |
|
85 | - $lines[] = $bodyIndentation . 'parent::__construct("' . $metadata->getClassName() . '", $parent);'; |
|
80 | + $lines[] = $indentation.'public function __construct('; |
|
81 | + $lines[] = $bodyIndentation.'ClassMetadataBuildingContext $metadataBuildingContext,'; |
|
82 | + $lines[] = $bodyIndentation.'?ClassMetadata $parent = null'; |
|
83 | + $lines[] = $indentation.')'; |
|
84 | + $lines[] = $indentation.'{'; |
|
85 | + $lines[] = $bodyIndentation.'parent::__construct("'.$metadata->getClassName().'", $parent);'; |
|
86 | 86 | |
87 | 87 | if ($metadata->getCustomRepositoryClassName()) { |
88 | 88 | $lines[] = null; |
89 | - $lines[] = $objectReference . '->setCustomRepositoryClassName("' . $metadata->getCustomRepositoryClassName() . '");'; |
|
89 | + $lines[] = $objectReference.'->setCustomRepositoryClassName("'.$metadata->getCustomRepositoryClassName().'");'; |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | if ($metadata->changeTrackingPolicy) { |
93 | 93 | $lines[] = null; |
94 | - $lines[] = $objectReference . '->setChangeTrackingPolicy(Mapping\ChangeTrackingPolicy::' . strtoupper($metadata->changeTrackingPolicy) . ');'; |
|
94 | + $lines[] = $objectReference.'->setChangeTrackingPolicy(Mapping\ChangeTrackingPolicy::'.strtoupper($metadata->changeTrackingPolicy).');'; |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | $lines[] = $this->exportInheritance($metadata, $indentationLevel); |
98 | 98 | $lines[] = $this->exportTable($metadata, $indentationLevel); |
99 | 99 | $lines[] = $this->exportProperties($metadata, $indentationLevel); |
100 | 100 | $lines[] = $this->exportLifecycleCallbacks($metadata, $indentationLevel); |
101 | - $lines[] = $indentation . '}'; |
|
101 | + $lines[] = $indentation.'}'; |
|
102 | 102 | |
103 | 103 | return implode(PHP_EOL, $lines); |
104 | 104 | } |
@@ -112,17 +112,17 @@ discard block |
||
112 | 112 | private function exportInheritance(Mapping\ClassMetadata $metadata, int $indentationLevel) : string |
113 | 113 | { |
114 | 114 | $bodyIndentation = str_repeat(self::INDENTATION, $indentationLevel + 1); |
115 | - $objectReference = $bodyIndentation . static::VARIABLE; |
|
115 | + $objectReference = $bodyIndentation.static::VARIABLE; |
|
116 | 116 | $lines = []; |
117 | 117 | |
118 | 118 | if ($metadata->inheritanceType) { |
119 | 119 | $lines[] = null; |
120 | - $lines[] = $objectReference . '->setInheritanceType(Mapping\InheritanceType::' . strtoupper($metadata->inheritanceType) . ');'; |
|
120 | + $lines[] = $objectReference.'->setInheritanceType(Mapping\InheritanceType::'.strtoupper($metadata->inheritanceType).');'; |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | if ($metadata->discriminatorColumn) { |
124 | 124 | $lines[] = null; |
125 | - $lines[] = $bodyIndentation . '// Discriminator mapping'; |
|
125 | + $lines[] = $bodyIndentation.'// Discriminator mapping'; |
|
126 | 126 | $lines[] = $this->exportDiscriminatorMetadata($metadata, $indentationLevel + 1); |
127 | 127 | } |
128 | 128 | |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | |
143 | 143 | if ($metadata->table) { |
144 | 144 | $lines[] = null; |
145 | - $lines[] = $bodyIndentation . '// Table'; |
|
145 | + $lines[] = $bodyIndentation.'// Table'; |
|
146 | 146 | $lines[] = $this->exportTableMetadata($metadata->table, $indentationLevel + 1); |
147 | 147 | } |
148 | 148 | |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | |
163 | 163 | foreach ($metadata->getProperties() as $name => $property) { |
164 | 164 | $lines[] = null; |
165 | - $lines[] = $bodyIndentation . '// Property: ' . $name; |
|
165 | + $lines[] = $bodyIndentation.'// Property: '.$name; |
|
166 | 166 | $lines[] = $this->exportProperty($property, $indentationLevel + 1); |
167 | 167 | } |
168 | 168 | |
@@ -178,16 +178,16 @@ discard block |
||
178 | 178 | private function exportLifecycleCallbacks(Mapping\ClassMetadata $metadata, int $indentationLevel) : string |
179 | 179 | { |
180 | 180 | $bodyIndentation = str_repeat(self::INDENTATION, $indentationLevel + 1); |
181 | - $objectReference = $bodyIndentation . static::VARIABLE; |
|
181 | + $objectReference = $bodyIndentation.static::VARIABLE; |
|
182 | 182 | $lines = []; |
183 | 183 | |
184 | 184 | if ($metadata->lifecycleCallbacks) { |
185 | 185 | $lines[] = null; |
186 | - $lines[] = $bodyIndentation . '// Lifecycle callbacks'; |
|
186 | + $lines[] = $bodyIndentation.'// Lifecycle callbacks'; |
|
187 | 187 | |
188 | 188 | foreach ($metadata->lifecycleCallbacks as $event => $callbacks) { |
189 | 189 | foreach ($callbacks as $callback) { |
190 | - $lines[] = $objectReference . '->addLifecycleCallback("' . $callback . '", "' . $event . '");'; |
|
190 | + $lines[] = $objectReference.'->addLifecycleCallback("'.$callback.'", "'.$event.'");'; |
|
191 | 191 | } |
192 | 192 | } |
193 | 193 | } |
@@ -206,17 +206,17 @@ discard block |
||
206 | 206 | $variableExporter = new VariableExporter(); |
207 | 207 | $discriminatorExporter = new DiscriminatorColumnMetadataExporter(); |
208 | 208 | $indentation = str_repeat(self::INDENTATION, $indentationLevel); |
209 | - $objectReference = $indentation . static::VARIABLE; |
|
209 | + $objectReference = $indentation.static::VARIABLE; |
|
210 | 210 | $lines = []; |
211 | 211 | |
212 | 212 | $lines[] = $discriminatorExporter->export($metadata->discriminatorColumn, $indentationLevel); |
213 | 213 | $lines[] = null; |
214 | - $lines[] = $objectReference . '->setDiscriminatorColumn(' . $discriminatorExporter::VARIABLE . ');'; |
|
214 | + $lines[] = $objectReference.'->setDiscriminatorColumn('.$discriminatorExporter::VARIABLE.');'; |
|
215 | 215 | |
216 | 216 | if ($metadata->discriminatorMap) { |
217 | 217 | $discriminatorMap = $variableExporter->export($metadata->discriminatorMap, $indentationLevel + 1); |
218 | 218 | |
219 | - $lines[] = $objectReference . '->setDiscriminatorMap(' . $discriminatorMap . ');'; |
|
219 | + $lines[] = $objectReference.'->setDiscriminatorMap('.$discriminatorMap.');'; |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | return implode(PHP_EOL, $lines); |
@@ -232,12 +232,12 @@ discard block |
||
232 | 232 | { |
233 | 233 | $tableExporter = new TableMetadataExporter(); |
234 | 234 | $indentation = str_repeat(self::INDENTATION, $indentationLevel); |
235 | - $objectReference = $indentation . static::VARIABLE; |
|
235 | + $objectReference = $indentation.static::VARIABLE; |
|
236 | 236 | $lines = []; |
237 | 237 | |
238 | 238 | $lines[] = $tableExporter->export($table, $indentationLevel); |
239 | 239 | $lines[] = null; |
240 | - $lines[] = $objectReference . '->setTable(' . $tableExporter::VARIABLE . ');'; |
|
240 | + $lines[] = $objectReference.'->setTable('.$tableExporter::VARIABLE.');'; |
|
241 | 241 | |
242 | 242 | return implode(PHP_EOL, $lines); |
243 | 243 | } |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | private function exportProperty(Mapping\Property $property, int $indentationLevel) : string |
252 | 252 | { |
253 | 253 | $indentation = str_repeat(self::INDENTATION, $indentationLevel); |
254 | - $objectReference = $indentation . static::VARIABLE; |
|
254 | + $objectReference = $indentation.static::VARIABLE; |
|
255 | 255 | $lines = []; |
256 | 256 | |
257 | 257 | switch (true) { |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | |
287 | 287 | $lines[] = $propertyExporter->export($property, $indentationLevel); |
288 | 288 | $lines[] = null; |
289 | - $lines[] = $objectReference . '->addProperty(' . $propertyExporter::VARIABLE . ');'; |
|
289 | + $lines[] = $objectReference.'->addProperty('.$propertyExporter::VARIABLE.');'; |
|
290 | 290 | |
291 | 291 | return implode(PHP_EOL, $lines); |
292 | 292 | } |
@@ -1,42 +1,42 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | |
4 | -declare(strict_types=1); |
|
4 | +declare(strict_types = 1); |
|
5 | 5 | |
6 | 6 | namespace Doctrine\ORM\Mapping\Exporter; |
7 | 7 | |
8 | 8 | class VariableExporter implements Exporter |
9 | 9 | { |
10 | - const INDENTATION = ' '; |
|
10 | + const INDENTATION = ' '; |
|
11 | 11 | |
12 | 12 | /** |
13 | 13 | * {@inheritdoc} |
14 | 14 | */ |
15 | 15 | public function export($value, int $indentationLevel = 0) : string |
16 | 16 | { |
17 | - if (! is_array($value)) { |
|
17 | + if ( ! is_array($value)) { |
|
18 | 18 | return var_export($value, true); |
19 | 19 | } |
20 | 20 | |
21 | 21 | $indentation = str_repeat(self::INDENTATION, $indentationLevel); |
22 | - $longestKey = array_reduce(array_keys($value), function ($k, $v) { |
|
22 | + $longestKey = array_reduce(array_keys($value), function($k, $v) { |
|
23 | 23 | return (string) (strlen((string) $k) > strlen((string) $v) ? $k : $v); |
24 | 24 | }); |
25 | 25 | $maxKeyLength = strlen($longestKey) + (is_numeric($longestKey) ? 0 : 2); |
26 | 26 | |
27 | 27 | $lines = []; |
28 | 28 | |
29 | - $lines[] = $indentation . '['; |
|
29 | + $lines[] = $indentation.'['; |
|
30 | 30 | |
31 | 31 | foreach ($value as $entryKey => $entryValue) { |
32 | 32 | $lines[] = sprintf('%s%s => %s,', |
33 | - $indentation . self::INDENTATION, |
|
33 | + $indentation.self::INDENTATION, |
|
34 | 34 | str_pad(var_export($entryKey, true), $maxKeyLength), |
35 | 35 | ltrim($this->export($entryValue, $indentationLevel + 1)) |
36 | 36 | ); |
37 | 37 | } |
38 | 38 | |
39 | - $lines[] = $indentation . ']'; |
|
39 | + $lines[] = $indentation.']'; |
|
40 | 40 | |
41 | 41 | return implode(PHP_EOL, $lines); |
42 | 42 | } |