@@ -39,7 +39,7 @@ |
||
39 | 39 | */ |
40 | 40 | public function findAnnotations(string $annotationType): array |
41 | 41 | { |
42 | - return array_values(array_filter($this->annotations, function ($annotation) use ($annotationType) { |
|
42 | + return array_values(array_filter($this->annotations, function($annotation) use ($annotationType) { |
|
43 | 43 | return is_a($annotation, $annotationType); |
44 | 44 | })); |
45 | 45 | } |
@@ -71,7 +71,7 @@ |
||
71 | 71 | |
72 | 72 | // Let's add * in front of the line (otherwise, parsing is failing) |
73 | 73 | $lines = explode("\n", $comment); |
74 | - $lines = array_map(function (string $line) { |
|
74 | + $lines = array_map(function(string $line) { |
|
75 | 75 | return '* '.$line; |
76 | 76 | }, $lines); |
77 | 77 | $comment = implode("\n", $lines); |
@@ -71,9 +71,9 @@ discard block |
||
71 | 71 | public function getName() : string |
72 | 72 | { |
73 | 73 | if (!$this->useAlternateName) { |
74 | - return 'get' . $this->getPropertyName(); |
|
74 | + return 'get'.$this->getPropertyName(); |
|
75 | 75 | } else { |
76 | - $methodName = 'get' . $this->getPropertyName() . 'By'; |
|
76 | + $methodName = 'get'.$this->getPropertyName().'By'; |
|
77 | 77 | |
78 | 78 | $camelizedColumns = array_map([TDBMDaoGenerator::class, 'toCamelCase'], $this->foreignKey->getUnquotedLocalColumns()); |
79 | 79 | |
@@ -128,12 +128,12 @@ discard block |
||
128 | 128 | $getter = new MethodGenerator($this->getName()); |
129 | 129 | |
130 | 130 | if ($this->hasLocalUniqueIndex()) { |
131 | - $classType = '\\' . $this->beanNamespace . '\\' . $beanClass; |
|
131 | + $classType = '\\'.$this->beanNamespace.'\\'.$beanClass; |
|
132 | 132 | $getterDocBlock = new DocBlockGenerator(sprintf('Returns the %s pointing to this bean via the %s column.', $beanClass, implode(', ', $this->foreignKey->getUnquotedLocalColumns()))); |
133 | - $getterDocBlock->setTag([new ReturnTag([$classType . '|null'])]); |
|
133 | + $getterDocBlock->setTag([new ReturnTag([$classType.'|null'])]); |
|
134 | 134 | $getterDocBlock->setWordWrap(false); |
135 | 135 | $getter->setDocBlock($getterDocBlock); |
136 | - $getter->setReturnType('?' . $classType); |
|
136 | + $getter->setReturnType('?'.$classType); |
|
137 | 137 | |
138 | 138 | $code = sprintf( |
139 | 139 | 'return $this->retrieveManyToOneRelationshipsStorage(%s, %s, %s)->first();', |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | ); |
144 | 144 | } else { |
145 | 145 | $getterDocBlock = new DocBlockGenerator(sprintf('Returns the list of %s pointing to this bean via the %s column.', $beanClass, implode(', ', $this->foreignKey->getUnquotedLocalColumns()))); |
146 | - $getterDocBlock->setTag(new ReturnTag([$beanClass . '[]', '\\' . AlterableResultIterator::class])); |
|
146 | + $getterDocBlock->setTag(new ReturnTag([$beanClass.'[]', '\\'.AlterableResultIterator::class])); |
|
147 | 147 | $getterDocBlock->setWordWrap(false); |
148 | 148 | $getter->setDocBlock($getterDocBlock); |
149 | 149 | $getter->setReturnType(AlterableResultIterator::class); |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | $getter->setVisibility(AbstractMemberGenerator::VISIBILITY_PROTECTED); |
163 | 163 | } |
164 | 164 | |
165 | - return [ $getter ]; |
|
165 | + return [$getter]; |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | private function getFilters(ForeignKeyConstraint $fk) : string |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | /** @var Annotation\JsonFormat|null $jsonFormat */ |
234 | 234 | $jsonFormat = $this->findAnnotation(Annotation\JsonFormat::class); |
235 | 235 | if ($jsonFormat !== null) { |
236 | - $method = $jsonFormat->method ?? 'get' . ucfirst($jsonFormat->property); |
|
236 | + $method = $jsonFormat->method ?? 'get'.ucfirst($jsonFormat->property); |
|
237 | 237 | $format = "$method()"; |
238 | 238 | } else { |
239 | 239 | $stopRecursion = $this->findAnnotation(Annotation\JsonRecursive::class) ? '' : 'true'; |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | $isIncluded = $this->findAnnotation(Annotation\JsonInclude::class) !== null; |
243 | 243 | $index = $jsonCollection->key ?: lcfirst($this->getPropertyName()); |
244 | 244 | $class = $this->getBeanClassName(); |
245 | - $variableName = '$' . TDBMDaoGenerator::toVariableName($class); |
|
245 | + $variableName = '$'.TDBMDaoGenerator::toVariableName($class); |
|
246 | 246 | $getter = $this->getName(); |
247 | 247 | if ($this->hasLocalUniqueIndex()) { |
248 | 248 | $code = "\$array['$index'] = (\$object = \$this->$getter()) ? \$object->$format : null;"; |
@@ -51,11 +51,11 @@ |
||
51 | 51 | $this->registry[$table->getName()] = new BeanDescriptor( |
52 | 52 | $table, |
53 | 53 | $this->configuration->getBeanNamespace(), |
54 | - $this->configuration->getBeanNamespace() . '\\Generated', |
|
54 | + $this->configuration->getBeanNamespace().'\\Generated', |
|
55 | 55 | $this->configuration->getDaoNamespace(), |
56 | - $this->configuration->getDaoNamespace() . '\\Generated', |
|
56 | + $this->configuration->getDaoNamespace().'\\Generated', |
|
57 | 57 | $this->configuration->getResultIteratorNamespace(), |
58 | - $this->configuration->getResultIteratorNamespace() . '\\Generated', |
|
58 | + $this->configuration->getResultIteratorNamespace().'\\Generated', |
|
59 | 59 | $this->configuration->getSchemaAnalyzer(), |
60 | 60 | $this->schema, |
61 | 61 | $this->tdbmSchemaAnalyzer, |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | 'time', |
163 | 163 | 'time_immutable', |
164 | 164 | ], true)) { |
165 | - if ($default !== null && in_array(strtoupper($default), ['CURRENT_TIMESTAMP' /* MySQL */, 'NOW()' /* PostgreSQL */, 'SYSDATE' /* Oracle */ , 'CURRENT_TIMESTAMP()' /* MariaDB 10.3 */], true)) { |
|
165 | + if ($default !== null && in_array(strtoupper($default), ['CURRENT_TIMESTAMP' /* MySQL */, 'NOW()' /* PostgreSQL */, 'SYSDATE' /* Oracle */, 'CURRENT_TIMESTAMP()' /* MariaDB 10.3 */], true)) { |
|
166 | 166 | $defaultCode = 'new \DateTimeImmutable()'; |
167 | 167 | } else { |
168 | 168 | throw new TDBMException('Unable to set default value for date in "'.$this->table->getName().'.'.$this->column->getName().'". Database passed this default value: "'.$default.'"'); |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | case 'v4': |
187 | 187 | return 'Uuid::uuid4()->toString()'; |
188 | 188 | default: |
189 | - throw new TDBMException('@UUID annotation accepts either "v1" or "v4" parameter. Unexpected parameter: ' . $comment); |
|
189 | + throw new TDBMException('@UUID annotation accepts either "v1" or "v4" parameter. Unexpected parameter: '.$comment); |
|
190 | 190 | } |
191 | 191 | } |
192 | 192 | |
@@ -234,14 +234,14 @@ discard block |
||
234 | 234 | $resourceTypeCheck = sprintf($resourceTypeCheck, $checkNullable, $variableName, $variableName); |
235 | 235 | } |
236 | 236 | |
237 | - $types = [ $normalizedType ]; |
|
237 | + $types = [$normalizedType]; |
|
238 | 238 | if ($isNullable) { |
239 | 239 | $types[] = 'null'; |
240 | 240 | } |
241 | 241 | |
242 | 242 | $paramType = null; |
243 | 243 | if ($this->isTypeHintable()) { |
244 | - $paramType = ($isNullable?'?':'').$normalizedType; |
|
244 | + $paramType = ($isNullable ? '?' : '').$normalizedType; |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | $getter = new MethodGenerator($columnGetterName); |
@@ -337,11 +337,11 @@ discard block |
||
337 | 337 | break; |
338 | 338 | } |
339 | 339 | } |
340 | - $args = array_map(function ($v) { |
|
340 | + $args = array_map(function($v) { |
|
341 | 341 | return var_export($v, true); |
342 | 342 | }, $args); |
343 | - $args = empty($args) ? '' : ', ' . implode(', ', $args); |
|
344 | - $unit = $jsonFormat->unit ? ' . ' . var_export($jsonFormat->unit, true) : ''; |
|
343 | + $args = empty($args) ? '' : ', '.implode(', ', $args); |
|
344 | + $unit = $jsonFormat->unit ? ' . '.var_export($jsonFormat->unit, true) : ''; |
|
345 | 345 | if ($this->column->getNotnull()) { |
346 | 346 | return "\$array['$index'] = number_format(\$this->$getter()$args)$unit;"; |
347 | 347 | } else { |
@@ -76,7 +76,7 @@ |
||
76 | 76 | if ($index->isUnique()) { |
77 | 77 | return 'findOneBy'.implode('And', $methodNameComponent); |
78 | 78 | } else { |
79 | - return 'findBy' . implode('And', $methodNameComponent); |
|
79 | + return 'findBy'.implode('And', $methodNameComponent); |
|
80 | 80 | } |
81 | 81 | } |
82 | 82 | } |
@@ -50,7 +50,7 @@ |
||
50 | 50 | |
51 | 51 | $pkColumnNames = $this->tdbmService->getPrimaryKeyColumns($this->mainTable); |
52 | 52 | $mysqlPlatform = new MySqlPlatform(); |
53 | - $pkColumnNames = array_map(function ($pkColumn) use ($mysqlPlatform) { |
|
53 | + $pkColumnNames = array_map(function($pkColumn) use ($mysqlPlatform) { |
|
54 | 54 | return $mysqlPlatform->quoteIdentifier($this->mainTable).'.'.$mysqlPlatform->quoteIdentifier($pkColumn); |
55 | 55 | }, $pkColumnNames); |
56 | 56 |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | // Let's compute the COUNT. |
51 | 51 | $pkColumnNames = $this->tdbmService->getPrimaryKeyColumns($this->mainTable); |
52 | - $pkColumnNames = array_map(function ($pkColumn) use ($mySqlPlatform) { |
|
52 | + $pkColumnNames = array_map(function($pkColumn) use ($mySqlPlatform) { |
|
53 | 53 | return $mySqlPlatform->quoteIdentifier($this->mainTable).'.'.$mySqlPlatform->quoteIdentifier($pkColumn); |
54 | 54 | }, $pkColumnNames); |
55 | 55 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | */ |
114 | 114 | private function getParentRelationshipForeignKeys(string $tableName): array |
115 | 115 | { |
116 | - return $this->fromCache($this->cachePrefix.'_parentrelationshipfks_'.$tableName, function () use ($tableName) { |
|
116 | + return $this->fromCache($this->cachePrefix.'_parentrelationshipfks_'.$tableName, function() use ($tableName) { |
|
117 | 117 | return $this->getParentRelationshipForeignKeysWithoutCache($tableName); |
118 | 118 | }); |
119 | 119 | } |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | */ |
143 | 143 | private function getChildrenRelationshipForeignKeys(string $tableName) : array |
144 | 144 | { |
145 | - return $this->fromCache($this->cachePrefix.'_childrenrelationshipfks_'.$tableName, function () use ($tableName) { |
|
145 | + return $this->fromCache($this->cachePrefix.'_childrenrelationshipfks_'.$tableName, function() use ($tableName) { |
|
146 | 146 | return $this->getChildrenRelationshipForeignKeysWithoutCache($tableName); |
147 | 147 | }); |
148 | 148 | } |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | $children = $this->schemaAnalyzer->getChildrenRelationships($tableName); |
158 | 158 | |
159 | 159 | if (!empty($children)) { |
160 | - $fksTables = array_map(function (ForeignKeyConstraint $fk) { |
|
160 | + $fksTables = array_map(function(ForeignKeyConstraint $fk) { |
|
161 | 161 | return $this->getChildrenRelationshipForeignKeys($fk->getLocalTableName()); |
162 | 162 | }, $children); |
163 | 163 |
@@ -207,7 +207,7 @@ |
||
207 | 207 | if (strlen($alias) <= 30) { // Older oracle version had a limit of 30 characters for identifiers |
208 | 208 | return $alias; |
209 | 209 | } |
210 | - return substr($columnName, 0, 20) . crc32($tableName.'____'.$columnName); |
|
210 | + return substr($columnName, 0, 20).crc32($tableName.'____'.$columnName); |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | abstract protected function compute(): void; |