@@ -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); |
@@ -88,11 +88,11 @@ discard block |
||
88 | 88 | |
89 | 89 | // Remove all beans and daos from junction tables |
90 | 90 | $junctionTables = $this->configuration->getSchemaAnalyzer()->detectJunctionTables(true); |
91 | - $junctionTableNames = array_map(function (Table $table) { |
|
91 | + $junctionTableNames = array_map(function(Table $table) { |
|
92 | 92 | return $table->getName(); |
93 | 93 | }, $junctionTables); |
94 | 94 | |
95 | - $tableList = array_filter($tableList, function (Table $table) use ($junctionTableNames) { |
|
95 | + $tableList = array_filter($tableList, function(Table $table) use ($junctionTableNames) { |
|
96 | 96 | return !in_array($table->getName(), $junctionTableNames, true); |
97 | 97 | }); |
98 | 98 | |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | $fileContent = $this->psr2Fix($fileContent); |
171 | 171 | // Add the declare strict-types directive |
172 | 172 | $commentEnd = strpos($fileContent, ' */') + 3; |
173 | - $fileContent = substr($fileContent, 0, $commentEnd) . "\n\ndeclare(strict_types=1);" . substr($fileContent, $commentEnd + 1); |
|
173 | + $fileContent = substr($fileContent, 0, $commentEnd)."\n\ndeclare(strict_types=1);".substr($fileContent, $commentEnd + 1); |
|
174 | 174 | |
175 | 175 | $this->dumpFile($possibleBaseFileName, $fileContent); |
176 | 176 | |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | $fileContent = $this->psr2Fix($fileContent); |
233 | 233 | // Add the declare strict-types directive |
234 | 234 | $commentEnd = strpos($fileContent, ' */') + 3; |
235 | - $fileContent = substr($fileContent, 0, $commentEnd) . "\n\ndeclare(strict_types=1);" . substr($fileContent, $commentEnd + 1); |
|
235 | + $fileContent = substr($fileContent, 0, $commentEnd)."\n\ndeclare(strict_types=1);".substr($fileContent, $commentEnd + 1); |
|
236 | 236 | |
237 | 237 | $this->dumpFile($possibleBaseFileName, $fileContent); |
238 | 238 | |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | $resultIteratorClassName = $beanDescriptor->getResultIteratorClassName(); |
291 | 291 | $resultIteratorBaseClassName = $beanDescriptor->getBaseResultIteratorClassName(); |
292 | 292 | $resultIteratorNamespace = $this->configuration->getResultIteratorNamespace(); |
293 | - $resultIteratorBaseNamespace = $resultIteratorNamespace . '\\Generated'; |
|
293 | + $resultIteratorBaseNamespace = $resultIteratorNamespace.'\\Generated'; |
|
294 | 294 | $beanClassWithoutNameSpace = $beanDescriptor->getBeanClassName(); |
295 | 295 | $file = $beanDescriptor->generateResultIteratorPhpCode(); |
296 | 296 | if ($file === null) { |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | |
300 | 300 | $fileContent = $this->psr2Fix($file->generate()); |
301 | 301 | $commentEnd = strpos($fileContent, ' */') + 3; |
302 | - $fileContent = substr($fileContent, 0, $commentEnd) . "\n\ndeclare(strict_types=1);" . substr($fileContent, $commentEnd + 1); |
|
302 | + $fileContent = substr($fileContent, 0, $commentEnd)."\n\ndeclare(strict_types=1);".substr($fileContent, $commentEnd + 1); |
|
303 | 303 | |
304 | 304 | $baseResultIteratorFilePath = $this->configuration->getPathFinder()->getPath($resultIteratorBaseNamespace.'\\'.$resultIteratorBaseClassName)->getPathname(); |
305 | 305 | $this->dumpFile($baseResultIteratorFilePath, $fileContent); |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | |
365 | 365 | $constructorMethod = new MethodGenerator( |
366 | 366 | '__construct', |
367 | - [ new ParameterGenerator('container', ContainerInterface::class) ], |
|
367 | + [new ParameterGenerator('container', ContainerInterface::class)], |
|
368 | 368 | MethodGenerator::FLAG_PUBLIC, |
369 | 369 | '$this->container = $container;' |
370 | 370 | ); |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | |
381 | 381 | $daoInstanceProperty = new PropertyGenerator($daoInstanceName); |
382 | 382 | $daoInstanceProperty->setVisibility(AbstractMemberGenerator::VISIBILITY_PRIVATE); |
383 | - $daoInstanceProperty->setDocBlock(new DocBlockGenerator(null, null, [new VarTag(null, ['\\' . $daoNamespace . '\\' . $daoClassName, 'null'])])); |
|
383 | + $daoInstanceProperty->setDocBlock(new DocBlockGenerator(null, null, [new VarTag(null, ['\\'.$daoNamespace.'\\'.$daoClassName, 'null'])])); |
|
384 | 384 | $class->addPropertyFromGenerator($daoInstanceProperty); |
385 | 385 | |
386 | 386 | $fullClassNameVarExport = var_export($daoNamespace.'\\'.$daoClassName, true); |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | BODY; |
394 | 394 | |
395 | 395 | $getterMethod = new MethodGenerator( |
396 | - 'get' . $daoClassName, |
|
396 | + 'get'.$daoClassName, |
|
397 | 397 | [], |
398 | 398 | MethodGenerator::FLAG_PUBLIC, |
399 | 399 | $getterBody |
@@ -405,10 +405,10 @@ discard block |
||
405 | 405 | } |
406 | 406 | |
407 | 407 | $setterMethod = new MethodGenerator( |
408 | - 'set' . $daoClassName, |
|
409 | - [new ParameterGenerator($daoInstanceName, '\\' . $daoNamespace . '\\' . $daoClassName)], |
|
408 | + 'set'.$daoClassName, |
|
409 | + [new ParameterGenerator($daoInstanceName, '\\'.$daoNamespace.'\\'.$daoClassName)], |
|
410 | 410 | MethodGenerator::FLAG_PUBLIC, |
411 | - '$this->' . $daoInstanceName . ' = $' . $daoInstanceName . ';' |
|
411 | + '$this->'.$daoInstanceName.' = $'.$daoInstanceName.';' |
|
412 | 412 | ); |
413 | 413 | $setterMethod->setReturnType('void'); |
414 | 414 | $setterMethod = $this->configuration->getCodeGeneratorListener()->onDaoFactorySetterGenerated($setterMethod, $beanDescriptor, $this->configuration, $class); |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | $fileContent = $this->psr2Fix($fileContent); |
429 | 429 | // Add the declare strict-types directive |
430 | 430 | $commentEnd = strpos($fileContent, ' */') + 3; |
431 | - $fileContent = substr($fileContent, 0, $commentEnd) . "\n\ndeclare(strict_types=1);" . substr($fileContent, $commentEnd + 1); |
|
431 | + $fileContent = substr($fileContent, 0, $commentEnd)."\n\ndeclare(strict_types=1);".substr($fileContent, $commentEnd + 1); |
|
432 | 432 | |
433 | 433 | $this->dumpFile($possibleFileName, $fileContent); |
434 | 434 | } |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | $map = [ |
536 | 536 | Type::TARRAY => 'array', |
537 | 537 | Type::SIMPLE_ARRAY => 'array', |
538 | - 'json' => 'array', // 'json' is supported from Doctrine DBAL 2.6 only. |
|
538 | + 'json' => 'array', // 'json' is supported from Doctrine DBAL 2.6 only. |
|
539 | 539 | Type::JSON_ARRAY => 'array', |
540 | 540 | Type::BIGINT => 'string', |
541 | 541 | Type::BOOLEAN => 'bool', |
@@ -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 { |
@@ -19,12 +19,12 @@ |
||
19 | 19 | */ |
20 | 20 | private static $levels = array( |
21 | 21 | LogLevel::EMERGENCY, // 0 |
22 | - LogLevel::ALERT, // 1 |
|
23 | - LogLevel::CRITICAL, // 2 |
|
24 | - LogLevel::ERROR, // 3 |
|
25 | - LogLevel::WARNING, // 4 |
|
26 | - LogLevel::NOTICE, // 5 |
|
27 | - LogLevel::INFO, // 6 |
|
22 | + LogLevel::ALERT, // 1 |
|
23 | + LogLevel::CRITICAL, // 2 |
|
24 | + LogLevel::ERROR, // 3 |
|
25 | + LogLevel::WARNING, // 4 |
|
26 | + LogLevel::NOTICE, // 5 |
|
27 | + LogLevel::INFO, // 6 |
|
28 | 28 | LogLevel::DEBUG // 7 |
29 | 29 | ); |
30 | 30 |
@@ -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 | } |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | */ |
215 | 215 | public function getConstructorProperties(): array |
216 | 216 | { |
217 | - $constructorProperties = array_filter($this->beanPropertyDescriptors, static function (AbstractBeanPropertyDescriptor $property) { |
|
217 | + $constructorProperties = array_filter($this->beanPropertyDescriptors, static function(AbstractBeanPropertyDescriptor $property) { |
|
218 | 218 | return !$property instanceof InheritanceReferencePropertyDescriptor && $property->isCompulsory() && !$property->isReadOnly(); |
219 | 219 | }); |
220 | 220 | |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | public function getPropertiesWithDefault(): array |
230 | 230 | { |
231 | 231 | $properties = $this->getPropertiesForTable($this->table); |
232 | - $defaultProperties = array_filter($properties, function (AbstractBeanPropertyDescriptor $property) { |
|
232 | + $defaultProperties = array_filter($properties, function(AbstractBeanPropertyDescriptor $property) { |
|
233 | 233 | return $property->hasDefault(); |
234 | 234 | }); |
235 | 235 | |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | */ |
244 | 244 | public function getExposedProperties(): array |
245 | 245 | { |
246 | - $exposedProperties = array_filter($this->beanPropertyDescriptors, function (AbstractBeanPropertyDescriptor $property) { |
|
246 | + $exposedProperties = array_filter($this->beanPropertyDescriptors, function(AbstractBeanPropertyDescriptor $property) { |
|
247 | 247 | return !$property instanceof InheritanceReferencePropertyDescriptor && $property->getTable()->getName() === $this->table->getName(); |
248 | 248 | }); |
249 | 249 | |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | foreach ($beanPropertyDescriptors as $beanDescriptor) { |
350 | 350 | $name = $beanDescriptor->getGetterName(); |
351 | 351 | if (isset($names[$name])) { |
352 | - throw new TDBMException('Unsolvable name conflict while generating method name "' . $name . '"'); |
|
352 | + throw new TDBMException('Unsolvable name conflict while generating method name "'.$name.'"'); |
|
353 | 353 | } else { |
354 | 354 | $names[$name] = $beanDescriptor; |
355 | 355 | } |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | $assigns[] = $property->assignToDefaultCode()."\n"; |
399 | 399 | } |
400 | 400 | |
401 | - $body = $parentConstructorCode . implode('', $assigns); |
|
401 | + $body = $parentConstructorCode.implode('', $assigns); |
|
402 | 402 | |
403 | 403 | $constructor->setBody($body); |
404 | 404 | |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | foreach ($this->getExposedProperties() as $beanPropertyDescriptor) { |
516 | 516 | $propertyCode = $beanPropertyDescriptor->getJsonSerializeCode(); |
517 | 517 | if (!empty($propertyCode)) { |
518 | - $body .= PHP_EOL . $propertyCode; |
|
518 | + $body .= PHP_EOL.$propertyCode; |
|
519 | 519 | } |
520 | 520 | } |
521 | 521 | |
@@ -523,11 +523,11 @@ discard block |
||
523 | 523 | foreach ($this->getMethodDescriptors() as $methodDescriptor) { |
524 | 524 | $methodCode = $methodDescriptor->getJsonSerializeCode(); |
525 | 525 | if (!empty($methodCode)) { |
526 | - $body .= PHP_EOL . $methodCode; |
|
526 | + $body .= PHP_EOL.$methodCode; |
|
527 | 527 | } |
528 | 528 | } |
529 | 529 | |
530 | - $body .= PHP_EOL . 'return $array;'; |
|
530 | + $body .= PHP_EOL.'return $array;'; |
|
531 | 531 | |
532 | 532 | $method->setBody($body); |
533 | 533 | |
@@ -622,7 +622,7 @@ discard block |
||
622 | 622 | /** @var AddInterface[] $addInterfaceAnnotations */ |
623 | 623 | $addInterfaceAnnotations = $this->annotationParser->getTableAnnotations($this->table)->findAnnotations(AddInterface::class); |
624 | 624 | |
625 | - $interfaces = [ JsonSerializable::class ]; |
|
625 | + $interfaces = [JsonSerializable::class]; |
|
626 | 626 | foreach ($addInterfaceAnnotations as $annotation) { |
627 | 627 | $interfaces[] = $annotation->getName(); |
628 | 628 | } |
@@ -662,7 +662,7 @@ discard block |
||
662 | 662 | } |
663 | 663 | } elseif ($methodDescriptor instanceof PivotTableMethodsDescriptor) { |
664 | 664 | $pivotTableMethodsDescriptors[] = $methodDescriptor; |
665 | - [ $getter, $adder, $remover, $has, $setter ] = $methodDescriptor->getCode(); |
|
665 | + [$getter, $adder, $remover, $has, $setter] = $methodDescriptor->getCode(); |
|
666 | 666 | $methods = $this->codeGeneratorListener->onBaseBeanManyToManyGenerated($getter, $adder, $remover, $has, $setter, $methodDescriptor, $this, $this->configuration, $class); |
667 | 667 | foreach ($methods as $method) { |
668 | 668 | if ($method) { |
@@ -810,7 +810,7 @@ discard block |
||
810 | 810 | |
811 | 811 | $constructorMethod = new MethodGenerator( |
812 | 812 | '__construct', |
813 | - [ new ParameterGenerator('tdbmService', TDBMService::class) ], |
|
813 | + [new ParameterGenerator('tdbmService', TDBMService::class)], |
|
814 | 814 | MethodGenerator::FLAG_PUBLIC, |
815 | 815 | '$this->tdbmService = $tdbmService;', |
816 | 816 | 'Sets the TDBM service used by this DAO.' |
@@ -822,7 +822,7 @@ discard block |
||
822 | 822 | |
823 | 823 | $saveMethod = new MethodGenerator( |
824 | 824 | 'save', |
825 | - [ new ParameterGenerator('obj', $beanClassName) ], |
|
825 | + [new ParameterGenerator('obj', $beanClassName)], |
|
826 | 826 | MethodGenerator::FLAG_PUBLIC, |
827 | 827 | '$this->tdbmService->save($obj);', |
828 | 828 | (new DocBlockGenerator( |
@@ -856,7 +856,7 @@ discard block |
||
856 | 856 | $findAllBody, |
857 | 857 | (new DocBlockGenerator("Get all $beanClassWithoutNameSpace records."))->setWordWrap(false) |
858 | 858 | ); |
859 | - $findAllMethod->setReturnType($this->resultIteratorNamespace . '\\' . $this->getResultIteratorClassName()); |
|
859 | + $findAllMethod->setReturnType($this->resultIteratorNamespace.'\\'.$this->getResultIteratorClassName()); |
|
860 | 860 | $findAllMethod = $this->codeGeneratorListener->onBaseDaoFindAllGenerated($findAllMethod, $this, $this->configuration, $class); |
861 | 861 | if ($findAllMethod !== null) { |
862 | 862 | $class->addMethodFromGenerator($findAllMethod); |
@@ -870,7 +870,7 @@ discard block |
||
870 | 870 | |
871 | 871 | foreach ($primaryKeyColumns as $primaryKeyColumn) { |
872 | 872 | if ($primaryKeyColumn === $lazyLoadingParameterName) { |
873 | - throw new TDBMException('Primary Column name `' . $lazyLoadingParameterName . '` is not allowed.'); |
|
873 | + throw new TDBMException('Primary Column name `'.$lazyLoadingParameterName.'` is not allowed.'); |
|
874 | 874 | } |
875 | 875 | $phpType = TDBMDaoGenerator::dbalTypeToPhpType($this->table->getColumn($primaryKeyColumn)->getType()); |
876 | 876 | $parameters[] = new ParameterGenerator($primaryKeyColumn, $phpType); |
@@ -886,7 +886,7 @@ discard block |
||
886 | 886 | 'getById', |
887 | 887 | $parameters, |
888 | 888 | MethodGenerator::FLAG_PUBLIC, |
889 | - "return \$this->tdbmService->findObjectByPk('$tableName', [" . implode(', ', $primaryKeyFilter) . "], [], \$$lazyLoadingParameterName);", |
|
889 | + "return \$this->tdbmService->findObjectByPk('$tableName', [".implode(', ', $primaryKeyFilter)."], [], \$$lazyLoadingParameterName);", |
|
890 | 890 | (new DocBlockGenerator( |
891 | 891 | "Get $beanClassWithoutNameSpace specified by its ID (its primary key).", |
892 | 892 | 'If the primary key does not exist, an exception is thrown.', |
@@ -963,7 +963,7 @@ discard block |
||
963 | 963 | ] |
964 | 964 | ))->setWordWrap(false) |
965 | 965 | ); |
966 | - $findMethod->setReturnType($this->resultIteratorNamespace . '\\' . $this->getResultIteratorClassName()); |
|
966 | + $findMethod->setReturnType($this->resultIteratorNamespace.'\\'.$this->getResultIteratorClassName()); |
|
967 | 967 | $findMethod = $this->codeGeneratorListener->onBaseDaoFindGenerated($findMethod, $this, $this->configuration, $class); |
968 | 968 | if ($findMethod !== null) { |
969 | 969 | $class->addMethodFromGenerator($findMethod); |
@@ -1005,7 +1005,7 @@ discard block |
||
1005 | 1005 | ] |
1006 | 1006 | ))->setWordWrap(false) |
1007 | 1007 | ); |
1008 | - $findFromSqlMethod->setReturnType($this->resultIteratorNamespace . '\\' . $this->getResultIteratorClassName()); |
|
1008 | + $findFromSqlMethod->setReturnType($this->resultIteratorNamespace.'\\'.$this->getResultIteratorClassName()); |
|
1009 | 1009 | $findFromSqlMethod = $this->codeGeneratorListener->onBaseDaoFindFromSqlGenerated($findFromSqlMethod, $this, $this->configuration, $class); |
1010 | 1010 | if ($findFromSqlMethod !== null) { |
1011 | 1011 | $class->addMethodFromGenerator($findFromSqlMethod); |
@@ -1040,7 +1040,7 @@ discard block |
||
1040 | 1040 | ] |
1041 | 1041 | ))->setWordWrap(false) |
1042 | 1042 | ); |
1043 | - $findFromRawSqlMethod->setReturnType($this->resultIteratorNamespace . '\\' . $this->getResultIteratorClassName()); |
|
1043 | + $findFromRawSqlMethod->setReturnType($this->resultIteratorNamespace.'\\'.$this->getResultIteratorClassName()); |
|
1044 | 1044 | $findFromRawSqlMethod = $this->codeGeneratorListener->onBaseDaoFindFromRawSqlGenerated($findFromRawSqlMethod, $this, $this->configuration, $class); |
1045 | 1045 | if ($findFromRawSqlMethod !== null) { |
1046 | 1046 | $class->addMethodFromGenerator($findFromRawSqlMethod); |
@@ -1174,7 +1174,7 @@ discard block |
||
1174 | 1174 | $class->setDocBlock((new DocBlockGenerator( |
1175 | 1175 | "The $baseClassName class will iterate over results of $beanClassWithoutNameSpace class.", |
1176 | 1176 | null, |
1177 | - [new Tag\MethodTag('getIterator', ['\\' . $beanClassName . '[]'])] |
|
1177 | + [new Tag\MethodTag('getIterator', ['\\'.$beanClassName.'[]'])] |
|
1178 | 1178 | ))->setWordWrap(false)); |
1179 | 1179 | |
1180 | 1180 | $file = $this->codeGeneratorListener->onBaseResultIteratorGenerated($file, $this, $this->configuration); |
@@ -1230,7 +1230,7 @@ discard block |
||
1230 | 1230 | } |
1231 | 1231 | } |
1232 | 1232 | } |
1233 | - usort($methods, static function (MethodGenerator $methodA, MethodGenerator $methodB) { |
|
1233 | + usort($methods, static function(MethodGenerator $methodA, MethodGenerator $methodB) { |
|
1234 | 1234 | return $methodA->getName() <=> $methodB->getName(); |
1235 | 1235 | }); |
1236 | 1236 | |
@@ -1379,11 +1379,11 @@ discard block |
||
1379 | 1379 | |
1380 | 1380 | if ($index->isUnique()) { |
1381 | 1381 | $parameters[] = new ParameterGenerator('additionalTablesFetch', 'array', []); |
1382 | - $params[] = new ParamTag('additionalTablesFetch', [ 'string[]' ], 'A list of additional tables to fetch (for performance improvement)'); |
|
1383 | - $params[] = new ReturnTag([ '\\'.$beanNamespace.'\\'.$beanClassName, 'null' ]); |
|
1382 | + $params[] = new ParamTag('additionalTablesFetch', ['string[]'], 'A list of additional tables to fetch (for performance improvement)'); |
|
1383 | + $params[] = new ReturnTag(['\\'.$beanNamespace.'\\'.$beanClassName, 'null']); |
|
1384 | 1384 | $method->setReturnType('?\\'.$beanNamespace.'\\'.$beanClassName); |
1385 | 1385 | |
1386 | - $docBlock = new DocBlockGenerator("Get a $beanClassName filtered by ".implode(', ', $commentArguments). '.', null, $params); |
|
1386 | + $docBlock = new DocBlockGenerator("Get a $beanClassName filtered by ".implode(', ', $commentArguments).'.', null, $params); |
|
1387 | 1387 | $docBlock->setWordWrap(false); |
1388 | 1388 | |
1389 | 1389 | $body = "\$filter = [ |
@@ -1392,12 +1392,12 @@ discard block |
||
1392 | 1392 | "; |
1393 | 1393 | } else { |
1394 | 1394 | $parameters[] = (new ParameterGenerator('orderBy'))->setDefaultValue(null); |
1395 | - $params[] = new ParamTag('orderBy', [ 'mixed' ], 'The order string'); |
|
1395 | + $params[] = new ParamTag('orderBy', ['mixed'], 'The order string'); |
|
1396 | 1396 | $parameters[] = new ParameterGenerator('additionalTablesFetch', 'array', []); |
1397 | - $params[] = new ParamTag('additionalTablesFetch', [ 'string[]' ], 'A list of additional tables to fetch (for performance improvement)'); |
|
1397 | + $params[] = new ParamTag('additionalTablesFetch', ['string[]'], 'A list of additional tables to fetch (for performance improvement)'); |
|
1398 | 1398 | $parameters[] = (new ParameterGenerator('mode', '?int'))->setDefaultValue(null); |
1399 | - $params[] = new ParamTag('mode', [ 'int', 'null' ], 'Either TDBMService::MODE_ARRAY or TDBMService::MODE_CURSOR (for large datasets). Defaults to TDBMService::MODE_ARRAY.'); |
|
1400 | - $method->setReturnType($this->resultIteratorNamespace . '\\' . $this->getResultIteratorClassName()); |
|
1399 | + $params[] = new ParamTag('mode', ['int', 'null'], 'Either TDBMService::MODE_ARRAY or TDBMService::MODE_CURSOR (for large datasets). Defaults to TDBMService::MODE_ARRAY.'); |
|
1400 | + $method->setReturnType($this->resultIteratorNamespace.'\\'.$this->getResultIteratorClassName()); |
|
1401 | 1401 | |
1402 | 1402 | $docBlock = new DocBlockGenerator("Get a list of $beanClassName filtered by ".implode(', ', $commentArguments).".", null, $params); |
1403 | 1403 | $docBlock->setWordWrap(false); |
@@ -1714,17 +1714,17 @@ discard block |
||
1714 | 1714 | * @param string $indent |
1715 | 1715 | * @return string |
1716 | 1716 | */ |
1717 | - private function psr2VarExport($var, string $indent=''): string |
|
1717 | + private function psr2VarExport($var, string $indent = ''): string |
|
1718 | 1718 | { |
1719 | 1719 | if (is_array($var)) { |
1720 | 1720 | $indexed = array_keys($var) === range(0, count($var) - 1); |
1721 | 1721 | $r = []; |
1722 | 1722 | foreach ($var as $key => $value) { |
1723 | 1723 | $r[] = "$indent " |
1724 | - . ($indexed ? '' : $this->psr2VarExport($key) . ' => ') |
|
1724 | + . ($indexed ? '' : $this->psr2VarExport($key).' => ') |
|
1725 | 1725 | . $this->psr2VarExport($value, "$indent "); |
1726 | 1726 | } |
1727 | - return "[\n" . implode(",\n", $r) . "\n" . $indent . ']'; |
|
1727 | + return "[\n".implode(",\n", $r)."\n".$indent.']'; |
|
1728 | 1728 | } |
1729 | 1729 | return var_export($var, true); |
1730 | 1730 | } |