@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | $lines[] = null; |
30 | 30 | |
31 | 31 | if ($namespace) { |
32 | - $lines[] = 'namespace ' . $namespace . ';'; |
|
32 | + $lines[] = 'namespace '.$namespace.';'; |
|
33 | 33 | $lines[] = null; |
34 | 34 | } |
35 | 35 | |
@@ -65,31 +65,31 @@ discard block |
||
65 | 65 | { |
66 | 66 | $indentation = str_repeat(self::INDENTATION, $indentationLevel); |
67 | 67 | $bodyIndentation = str_repeat(self::INDENTATION, $indentationLevel + 1); |
68 | - $objectReference = $bodyIndentation . static::VARIABLE; |
|
68 | + $objectReference = $bodyIndentation.static::VARIABLE; |
|
69 | 69 | $lines = []; |
70 | 70 | |
71 | - $lines[] = $indentation . 'public function __construct('; |
|
72 | - $lines[] = $bodyIndentation . 'ClassMetadataBuildingContext $metadataBuildingContext,'; |
|
73 | - $lines[] = $bodyIndentation . '?ClassMetadata $parent = null'; |
|
74 | - $lines[] = $indentation . ')'; |
|
75 | - $lines[] = $indentation . '{'; |
|
76 | - $lines[] = $bodyIndentation . 'parent::__construct("' . $metadata->getClassName() . '", $parent);'; |
|
71 | + $lines[] = $indentation.'public function __construct('; |
|
72 | + $lines[] = $bodyIndentation.'ClassMetadataBuildingContext $metadataBuildingContext,'; |
|
73 | + $lines[] = $bodyIndentation.'?ClassMetadata $parent = null'; |
|
74 | + $lines[] = $indentation.')'; |
|
75 | + $lines[] = $indentation.'{'; |
|
76 | + $lines[] = $bodyIndentation.'parent::__construct("'.$metadata->getClassName().'", $parent);'; |
|
77 | 77 | |
78 | 78 | if ($metadata->getCustomRepositoryClassName()) { |
79 | 79 | $lines[] = null; |
80 | - $lines[] = $objectReference . '->setCustomRepositoryClassName("' . $metadata->getCustomRepositoryClassName() . '");'; |
|
80 | + $lines[] = $objectReference.'->setCustomRepositoryClassName("'.$metadata->getCustomRepositoryClassName().'");'; |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | if ($metadata->changeTrackingPolicy) { |
84 | 84 | $lines[] = null; |
85 | - $lines[] = $objectReference . '->setChangeTrackingPolicy(Mapping\ChangeTrackingPolicy::' . strtoupper($metadata->changeTrackingPolicy) . ');'; |
|
85 | + $lines[] = $objectReference.'->setChangeTrackingPolicy(Mapping\ChangeTrackingPolicy::'.strtoupper($metadata->changeTrackingPolicy).');'; |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | $lines[] = $this->exportInheritance($metadata, $indentationLevel); |
89 | 89 | $lines[] = $this->exportTable($metadata, $indentationLevel); |
90 | 90 | $lines[] = $this->exportProperties($metadata, $indentationLevel); |
91 | 91 | $lines[] = $this->exportLifecycleCallbacks($metadata, $indentationLevel); |
92 | - $lines[] = $indentation . '}'; |
|
92 | + $lines[] = $indentation.'}'; |
|
93 | 93 | |
94 | 94 | return implode(PHP_EOL, $lines); |
95 | 95 | } |
@@ -97,17 +97,17 @@ discard block |
||
97 | 97 | private function exportInheritance(Mapping\ClassMetadata $metadata, int $indentationLevel) : string |
98 | 98 | { |
99 | 99 | $bodyIndentation = str_repeat(self::INDENTATION, $indentationLevel + 1); |
100 | - $objectReference = $bodyIndentation . static::VARIABLE; |
|
100 | + $objectReference = $bodyIndentation.static::VARIABLE; |
|
101 | 101 | $lines = []; |
102 | 102 | |
103 | 103 | if ($metadata->inheritanceType) { |
104 | 104 | $lines[] = null; |
105 | - $lines[] = $objectReference . '->setInheritanceType(Mapping\InheritanceType::' . strtoupper($metadata->inheritanceType) . ');'; |
|
105 | + $lines[] = $objectReference.'->setInheritanceType(Mapping\InheritanceType::'.strtoupper($metadata->inheritanceType).');'; |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | if ($metadata->discriminatorColumn) { |
109 | 109 | $lines[] = null; |
110 | - $lines[] = $bodyIndentation . '// Discriminator mapping'; |
|
110 | + $lines[] = $bodyIndentation.'// Discriminator mapping'; |
|
111 | 111 | $lines[] = $this->exportDiscriminatorMetadata($metadata, $indentationLevel + 1); |
112 | 112 | } |
113 | 113 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | |
122 | 122 | if ($metadata->table) { |
123 | 123 | $lines[] = null; |
124 | - $lines[] = $bodyIndentation . '// Table'; |
|
124 | + $lines[] = $bodyIndentation.'// Table'; |
|
125 | 125 | $lines[] = $this->exportTableMetadata($metadata->table, $indentationLevel + 1); |
126 | 126 | } |
127 | 127 | |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | |
136 | 136 | foreach ($metadata->getDeclaredPropertiesIterator() as $name => $property) { |
137 | 137 | $lines[] = null; |
138 | - $lines[] = $bodyIndentation . '// Property: ' . $name; |
|
138 | + $lines[] = $bodyIndentation.'// Property: '.$name; |
|
139 | 139 | $lines[] = $this->exportProperty($property, $indentationLevel + 1); |
140 | 140 | } |
141 | 141 | |
@@ -145,16 +145,16 @@ discard block |
||
145 | 145 | private function exportLifecycleCallbacks(Mapping\ClassMetadata $metadata, int $indentationLevel) : string |
146 | 146 | { |
147 | 147 | $bodyIndentation = str_repeat(self::INDENTATION, $indentationLevel + 1); |
148 | - $objectReference = $bodyIndentation . static::VARIABLE; |
|
148 | + $objectReference = $bodyIndentation.static::VARIABLE; |
|
149 | 149 | $lines = []; |
150 | 150 | |
151 | 151 | if ($metadata->lifecycleCallbacks) { |
152 | 152 | $lines[] = null; |
153 | - $lines[] = $bodyIndentation . '// Lifecycle callbacks'; |
|
153 | + $lines[] = $bodyIndentation.'// Lifecycle callbacks'; |
|
154 | 154 | |
155 | 155 | foreach ($metadata->lifecycleCallbacks as $event => $callbacks) { |
156 | 156 | foreach ($callbacks as $callback) { |
157 | - $lines[] = $objectReference . '->addLifecycleCallback("' . $callback . '", "' . $event . '");'; |
|
157 | + $lines[] = $objectReference.'->addLifecycleCallback("'.$callback.'", "'.$event.'");'; |
|
158 | 158 | } |
159 | 159 | } |
160 | 160 | } |
@@ -167,17 +167,17 @@ discard block |
||
167 | 167 | $variableExporter = new VariableExporter(); |
168 | 168 | $discriminatorExporter = new DiscriminatorColumnMetadataExporter(); |
169 | 169 | $indentation = str_repeat(self::INDENTATION, $indentationLevel); |
170 | - $objectReference = $indentation . static::VARIABLE; |
|
170 | + $objectReference = $indentation.static::VARIABLE; |
|
171 | 171 | $lines = []; |
172 | 172 | |
173 | 173 | $lines[] = $discriminatorExporter->export($metadata->discriminatorColumn, $indentationLevel); |
174 | 174 | $lines[] = null; |
175 | - $lines[] = $objectReference . '->setDiscriminatorColumn(' . $discriminatorExporter::VARIABLE . ');'; |
|
175 | + $lines[] = $objectReference.'->setDiscriminatorColumn('.$discriminatorExporter::VARIABLE.');'; |
|
176 | 176 | |
177 | 177 | if ($metadata->discriminatorMap) { |
178 | 178 | $discriminatorMap = $variableExporter->export($metadata->discriminatorMap, $indentationLevel + 1); |
179 | 179 | |
180 | - $lines[] = $objectReference . '->setDiscriminatorMap(' . $discriminatorMap . ');'; |
|
180 | + $lines[] = $objectReference.'->setDiscriminatorMap('.$discriminatorMap.');'; |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | return implode(PHP_EOL, $lines); |
@@ -187,12 +187,12 @@ discard block |
||
187 | 187 | { |
188 | 188 | $tableExporter = new TableMetadataExporter(); |
189 | 189 | $indentation = str_repeat(self::INDENTATION, $indentationLevel); |
190 | - $objectReference = $indentation . static::VARIABLE; |
|
190 | + $objectReference = $indentation.static::VARIABLE; |
|
191 | 191 | $lines = []; |
192 | 192 | |
193 | 193 | $lines[] = $tableExporter->export($table, $indentationLevel); |
194 | 194 | $lines[] = null; |
195 | - $lines[] = $objectReference . '->setTable(' . $tableExporter::VARIABLE . ');'; |
|
195 | + $lines[] = $objectReference.'->setTable('.$tableExporter::VARIABLE.');'; |
|
196 | 196 | |
197 | 197 | return implode(PHP_EOL, $lines); |
198 | 198 | } |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | private function exportProperty(Mapping\Property $property, int $indentationLevel) : string |
201 | 201 | { |
202 | 202 | $indentation = str_repeat(self::INDENTATION, $indentationLevel); |
203 | - $objectReference = $indentation . static::VARIABLE; |
|
203 | + $objectReference = $indentation.static::VARIABLE; |
|
204 | 204 | $lines = []; |
205 | 205 | |
206 | 206 | switch (true) { |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | |
236 | 236 | $lines[] = $propertyExporter->export($property, $indentationLevel); |
237 | 237 | $lines[] = null; |
238 | - $lines[] = $objectReference . '->addProperty(' . $propertyExporter::VARIABLE . ');'; |
|
238 | + $lines[] = $objectReference.'->addProperty('.$propertyExporter::VARIABLE.');'; |
|
239 | 239 | |
240 | 240 | return implode(PHP_EOL, $lines); |
241 | 241 | } |
@@ -23,13 +23,13 @@ |
||
23 | 23 | { |
24 | 24 | /** @var JoinColumnMetadata $value */ |
25 | 25 | $indentation = str_repeat(self::INDENTATION, $indentationLevel); |
26 | - $objectReference = $indentation . static::VARIABLE; |
|
26 | + $objectReference = $indentation.static::VARIABLE; |
|
27 | 27 | $lines = []; |
28 | 28 | |
29 | 29 | $lines[] = parent::export($value, $indentationLevel); |
30 | - $lines[] = $objectReference . '->setReferencedColumnName("' . $value->getReferencedColumnName() . '");'; |
|
31 | - $lines[] = $objectReference . '->setAliasedName("' . $value->getAliasedName() . '");'; |
|
32 | - $lines[] = $objectReference . '->setOnDelete("' . $value->getOnDelete() . '");'; |
|
30 | + $lines[] = $objectReference.'->setReferencedColumnName("'.$value->getReferencedColumnName().'");'; |
|
31 | + $lines[] = $objectReference.'->setAliasedName("'.$value->getAliasedName().'");'; |
|
32 | + $lines[] = $objectReference.'->setOnDelete("'.$value->getOnDelete().'");'; |
|
33 | 33 | |
34 | 34 | return implode(PHP_EOL, $lines); |
35 | 35 | } |
@@ -24,30 +24,30 @@ |
||
24 | 24 | */ |
25 | 25 | public function export($value, int $indentationLevel = 0) : string |
26 | 26 | { |
27 | - if (! is_array($value)) { |
|
27 | + if ( ! is_array($value)) { |
|
28 | 28 | return var_export($value, true); |
29 | 29 | } |
30 | 30 | |
31 | 31 | $indentation = str_repeat(self::INDENTATION, $indentationLevel); |
32 | - $longestKey = array_reduce(array_keys($value), function ($k, $v) { |
|
32 | + $longestKey = array_reduce(array_keys($value), function($k, $v) { |
|
33 | 33 | return (string) (strlen((string) $k) > strlen((string) $v) ? $k : $v); |
34 | 34 | }); |
35 | 35 | $maxKeyLength = strlen($longestKey) + (is_numeric($longestKey) ? 0 : 2); |
36 | 36 | |
37 | 37 | $lines = []; |
38 | 38 | |
39 | - $lines[] = $indentation . '['; |
|
39 | + $lines[] = $indentation.'['; |
|
40 | 40 | |
41 | 41 | foreach ($value as $entryKey => $entryValue) { |
42 | 42 | $lines[] = sprintf( |
43 | 43 | '%s%s => %s,', |
44 | - $indentation . self::INDENTATION, |
|
44 | + $indentation.self::INDENTATION, |
|
45 | 45 | str_pad(var_export($entryKey, true), $maxKeyLength), |
46 | 46 | ltrim($this->export($entryValue, $indentationLevel + 1)) |
47 | 47 | ); |
48 | 48 | } |
49 | 49 | |
50 | - $lines[] = $indentation . ']'; |
|
50 | + $lines[] = $indentation.']'; |
|
51 | 51 | |
52 | 52 | return implode(PHP_EOL, $lines); |
53 | 53 | } |
@@ -24,33 +24,33 @@ |
||
24 | 24 | $cacheExporter = new CacheMetadataExporter(); |
25 | 25 | $variableExporter = new VariableExporter(); |
26 | 26 | $indentation = str_repeat(self::INDENTATION, $indentationLevel); |
27 | - $objectReference = $indentation . static::VARIABLE; |
|
27 | + $objectReference = $indentation.static::VARIABLE; |
|
28 | 28 | $cascade = $this->resolveCascade($value->getCascade()); |
29 | 29 | $lines = []; |
30 | 30 | |
31 | - $lines[] = $objectReference . ' = ' . $this->exportInstantiation($value); |
|
31 | + $lines[] = $objectReference.' = '.$this->exportInstantiation($value); |
|
32 | 32 | |
33 | - if (! empty($value->getCache())) { |
|
33 | + if ( ! empty($value->getCache())) { |
|
34 | 34 | $lines[] = $cacheExporter->export($value->getCache(), $indentationLevel); |
35 | 35 | $lines[] = null; |
36 | - $lines[] = $objectReference . '->setCache(' . $cacheExporter::VARIABLE . ');'; |
|
36 | + $lines[] = $objectReference.'->setCache('.$cacheExporter::VARIABLE.');'; |
|
37 | 37 | } |
38 | 38 | |
39 | - if (! empty($value->getMappedBy())) { |
|
40 | - $lines[] = $objectReference . '->setMappedBy("' . $value->getMappedBy() . '");'; |
|
41 | - $lines[] = $objectReference . '->setOwningSide(false);'; |
|
39 | + if ( ! empty($value->getMappedBy())) { |
|
40 | + $lines[] = $objectReference.'->setMappedBy("'.$value->getMappedBy().'");'; |
|
41 | + $lines[] = $objectReference.'->setOwningSide(false);'; |
|
42 | 42 | } |
43 | 43 | |
44 | - if (! empty($value->getInversedBy())) { |
|
45 | - $lines[] = $objectReference . '->setInversedBy("' . $value->getInversedBy() . '");'; |
|
44 | + if ( ! empty($value->getInversedBy())) { |
|
45 | + $lines[] = $objectReference.'->setInversedBy("'.$value->getInversedBy().'");'; |
|
46 | 46 | } |
47 | 47 | |
48 | - $lines[] = $objectReference . '->setSourceEntity("' . $value->getSourceEntity() . '");'; |
|
49 | - $lines[] = $objectReference . '->setTargetEntity("' . $value->getTargetEntity() . '");'; |
|
50 | - $lines[] = $objectReference . '->setFetchMode(Mapping\FetchMode::' . strtoupper($value->getFetchMode()) . '");'; |
|
51 | - $lines[] = $objectReference . '->setCascade(' . $variableExporter->export($cascade, $indentationLevel + 1) . ');'; |
|
52 | - $lines[] = $objectReference . '->setOrphanRemoval(' . $variableExporter->export($value->isOrphanRemoval(), $indentationLevel + 1) . ');'; |
|
53 | - $lines[] = $objectReference . '->setPrimaryKey(' . $variableExporter->export($value->isPrimaryKey(), $indentationLevel + 1) . ');'; |
|
48 | + $lines[] = $objectReference.'->setSourceEntity("'.$value->getSourceEntity().'");'; |
|
49 | + $lines[] = $objectReference.'->setTargetEntity("'.$value->getTargetEntity().'");'; |
|
50 | + $lines[] = $objectReference.'->setFetchMode(Mapping\FetchMode::'.strtoupper($value->getFetchMode()).'");'; |
|
51 | + $lines[] = $objectReference.'->setCascade('.$variableExporter->export($cascade, $indentationLevel + 1).');'; |
|
52 | + $lines[] = $objectReference.'->setOrphanRemoval('.$variableExporter->export($value->isOrphanRemoval(), $indentationLevel + 1).');'; |
|
53 | + $lines[] = $objectReference.'->setPrimaryKey('.$variableExporter->export($value->isPrimaryKey(), $indentationLevel + 1).');'; |
|
54 | 54 | |
55 | 55 | return implode(PHP_EOL, $lines); |
56 | 56 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | public function getQuotedQualifiedName(AbstractPlatform $platform) : string |
57 | 57 | { |
58 | - if (! $this->schema) { |
|
58 | + if ( ! $this->schema) { |
|
59 | 59 | return $platform->quoteIdentifier($this->name); |
60 | 60 | } |
61 | 61 | |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | */ |
128 | 128 | public function addIndex(array $index) : void |
129 | 129 | { |
130 | - if (! isset($index['name'])) { |
|
130 | + if ( ! isset($index['name'])) { |
|
131 | 131 | $this->indexes[] = $index; |
132 | 132 | |
133 | 133 | return; |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | */ |
163 | 163 | public function addUniqueConstraint(array $constraint) : void |
164 | 164 | { |
165 | - if (! isset($constraint['name'])) { |
|
165 | + if ( ! isset($constraint['name'])) { |
|
166 | 166 | $this->uniqueConstraints[] = $constraint; |
167 | 167 | |
168 | 168 | return; |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | */ |
125 | 125 | public function getAllMetadata() : array |
126 | 126 | { |
127 | - if (! $this->initialized) { |
|
127 | + if ( ! $this->initialized) { |
|
128 | 128 | $this->initialize(); |
129 | 129 | } |
130 | 130 | |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | |
166 | 166 | try { |
167 | 167 | if ($this->cacheDriver) { |
168 | - $cached = $this->cacheDriver->fetch($realClassName . $this->cacheSalt); |
|
168 | + $cached = $this->cacheDriver->fetch($realClassName.$this->cacheSalt); |
|
169 | 169 | |
170 | 170 | if ($cached instanceof ClassMetadata) { |
171 | 171 | $this->loadedMetadata[$realClassName] = $cached; |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | foreach ($this->loadMetadata($realClassName, $metadataBuildingContext) as $loadedClass) { |
176 | 176 | $loadedClassName = $loadedClass->getClassName(); |
177 | 177 | |
178 | - $this->cacheDriver->save($loadedClassName . $this->cacheSalt, $loadedClass, null); |
|
178 | + $this->cacheDriver->save($loadedClassName.$this->cacheSalt, $loadedClass, null); |
|
179 | 179 | } |
180 | 180 | } |
181 | 181 | } else { |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | } catch (CommonMappingException $loadingException) { |
185 | 185 | $fallbackMetadataResponse = $this->onNotFoundMetadata($realClassName, $metadataBuildingContext); |
186 | 186 | |
187 | - if (! $fallbackMetadataResponse) { |
|
187 | + if ( ! $fallbackMetadataResponse) { |
|
188 | 188 | throw $loadingException; |
189 | 189 | } |
190 | 190 | |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | */ |
221 | 221 | protected function loadMetadata(string $name, ClassMetadataBuildingContext $metadataBuildingContext) : array |
222 | 222 | { |
223 | - if (! $this->initialized) { |
|
223 | + if ( ! $this->initialized) { |
|
224 | 224 | $this->initialize(); |
225 | 225 | } |
226 | 226 | |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | */ |
257 | 257 | public function isTransient($className) : bool |
258 | 258 | { |
259 | - if (! $this->initialized) { |
|
259 | + if ( ! $this->initialized) { |
|
260 | 260 | $this->initialize(); |
261 | 261 | } |
262 | 262 | |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | $parentClasses = []; |
279 | 279 | |
280 | 280 | foreach (array_reverse($this->getReflectionService()->getParentClasses($name)) as $parentClass) { |
281 | - if (! $this->getDriver()->isTransient($parentClass)) { |
|
281 | + if ( ! $this->getDriver()->isTransient($parentClass)) { |
|
282 | 282 | $parentClasses[] = $parentClass; |
283 | 283 | } |
284 | 284 | } |
@@ -10,6 +10,6 @@ |
||
10 | 10 | { |
11 | 11 | public static function create(string $generatorType) : self |
12 | 12 | { |
13 | - return new self('Unknown generator type: ' . $generatorType); |
|
13 | + return new self('Unknown generator type: '.$generatorType); |
|
14 | 14 | } |
15 | 15 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | } |
59 | 59 | |
60 | 60 | // If $value is not a Collection then use an ArrayCollection. |
61 | - if (! $collection instanceof Collection) { |
|
61 | + if ( ! $collection instanceof Collection) { |
|
62 | 62 | // @todo guilhermeblanco Conceptually, support to custom collections by replacing ArrayCollection creation. |
63 | 63 | $collection = new ArrayCollection((array) $collection); |
64 | 64 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | $collection = new PersistentCollection($entityManager, $targetClass, $collection); |
69 | 69 | |
70 | 70 | $collection->setOwner($owner, $this); |
71 | - $collection->setDirty(! $collection->isEmpty()); |
|
71 | + $collection->setDirty( ! $collection->isEmpty()); |
|
72 | 72 | $collection->setInitialized(true); |
73 | 73 | |
74 | 74 | return $collection; |
@@ -14,7 +14,7 @@ |
||
14 | 14 | */ |
15 | 15 | public function generate(string $filePath, ClassMetadataDefinition $definition) : void |
16 | 16 | { |
17 | - if (! file_exists($filePath)) { |
|
17 | + if ( ! file_exists($filePath)) { |
|
18 | 18 | parent::generate($filePath, $definition); |
19 | 19 | |
20 | 20 | return; |