@@ -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 | |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | $this->descriptorsByMethodName[$name][] = $descriptor; |
473 | 473 | $descriptors = $this->descriptorsByMethodName[$name]; |
474 | 474 | if (count($descriptors) > 1) { |
475 | - $properties = array_filter($descriptors, function ($descriptor) { |
|
475 | + $properties = array_filter($descriptors, function($descriptor) { |
|
476 | 476 | return $descriptor instanceof AbstractBeanPropertyDescriptor; |
477 | 477 | }); |
478 | 478 | $renameProperties = count($properties) > 1; |
@@ -523,7 +523,7 @@ discard block |
||
523 | 523 | foreach ($this->getExposedProperties() as $beanPropertyDescriptor) { |
524 | 524 | $propertyCode = $beanPropertyDescriptor->getJsonSerializeCode(); |
525 | 525 | if (!empty($propertyCode)) { |
526 | - $body .= PHP_EOL . $propertyCode; |
|
526 | + $body .= PHP_EOL.$propertyCode; |
|
527 | 527 | } |
528 | 528 | } |
529 | 529 | |
@@ -531,11 +531,11 @@ discard block |
||
531 | 531 | foreach ($this->getMethodDescriptors() as $methodDescriptor) { |
532 | 532 | $methodCode = $methodDescriptor->getJsonSerializeCode(); |
533 | 533 | if (!empty($methodCode)) { |
534 | - $body .= PHP_EOL . $methodCode; |
|
534 | + $body .= PHP_EOL.$methodCode; |
|
535 | 535 | } |
536 | 536 | } |
537 | 537 | |
538 | - $body .= PHP_EOL . 'return $array;'; |
|
538 | + $body .= PHP_EOL.'return $array;'; |
|
539 | 539 | |
540 | 540 | $method->setBody($body); |
541 | 541 | |
@@ -630,7 +630,7 @@ discard block |
||
630 | 630 | /** @var AddInterface[] $addInterfaceAnnotations */ |
631 | 631 | $addInterfaceAnnotations = $this->annotationParser->getTableAnnotations($this->table)->findAnnotations(AddInterface::class); |
632 | 632 | |
633 | - $interfaces = [ JsonSerializable::class ]; |
|
633 | + $interfaces = [JsonSerializable::class]; |
|
634 | 634 | foreach ($addInterfaceAnnotations as $annotation) { |
635 | 635 | $interfaces[] = $annotation->getName(); |
636 | 636 | } |
@@ -670,7 +670,7 @@ discard block |
||
670 | 670 | } |
671 | 671 | } elseif ($methodDescriptor instanceof PivotTableMethodsDescriptor) { |
672 | 672 | $pivotTableMethodsDescriptors[] = $methodDescriptor; |
673 | - [ $getter, $adder, $remover, $has, $setter ] = $methodDescriptor->getCode(); |
|
673 | + [$getter, $adder, $remover, $has, $setter] = $methodDescriptor->getCode(); |
|
674 | 674 | $methods = $this->codeGeneratorListener->onBaseBeanManyToManyGenerated($getter, $adder, $remover, $has, $setter, $methodDescriptor, $this, $this->configuration, $class); |
675 | 675 | foreach ($methods as $method) { |
676 | 676 | if ($method) { |
@@ -818,7 +818,7 @@ discard block |
||
818 | 818 | |
819 | 819 | $constructorMethod = new MethodGenerator( |
820 | 820 | '__construct', |
821 | - [ new ParameterGenerator('tdbmService', TDBMService::class) ], |
|
821 | + [new ParameterGenerator('tdbmService', TDBMService::class)], |
|
822 | 822 | MethodGenerator::FLAG_PUBLIC, |
823 | 823 | '$this->tdbmService = $tdbmService;', |
824 | 824 | 'Sets the TDBM service used by this DAO.' |
@@ -830,7 +830,7 @@ discard block |
||
830 | 830 | |
831 | 831 | $saveMethod = new MethodGenerator( |
832 | 832 | 'save', |
833 | - [ new ParameterGenerator('obj', $beanClassName) ], |
|
833 | + [new ParameterGenerator('obj', $beanClassName)], |
|
834 | 834 | MethodGenerator::FLAG_PUBLIC, |
835 | 835 | '$this->tdbmService->save($obj);', |
836 | 836 | (new DocBlockGenerator( |
@@ -864,7 +864,7 @@ discard block |
||
864 | 864 | $findAllBody, |
865 | 865 | (new DocBlockGenerator("Get all $beanClassWithoutNameSpace records."))->setWordWrap(false) |
866 | 866 | ); |
867 | - $findAllMethod->setReturnType($this->resultIteratorNamespace . '\\' . $this->getResultIteratorClassName()); |
|
867 | + $findAllMethod->setReturnType($this->resultIteratorNamespace.'\\'.$this->getResultIteratorClassName()); |
|
868 | 868 | $findAllMethod = $this->codeGeneratorListener->onBaseDaoFindAllGenerated($findAllMethod, $this, $this->configuration, $class); |
869 | 869 | if ($findAllMethod !== null) { |
870 | 870 | $class->addMethodFromGenerator($findAllMethod); |
@@ -878,7 +878,7 @@ discard block |
||
878 | 878 | |
879 | 879 | foreach ($primaryKeyColumns as $primaryKeyColumn) { |
880 | 880 | if ($primaryKeyColumn === $lazyLoadingParameterName) { |
881 | - throw new TDBMException('Primary Column name `' . $lazyLoadingParameterName . '` is not allowed.'); |
|
881 | + throw new TDBMException('Primary Column name `'.$lazyLoadingParameterName.'` is not allowed.'); |
|
882 | 882 | } |
883 | 883 | $phpType = TDBMDaoGenerator::dbalTypeToPhpType($this->table->getColumn($primaryKeyColumn)->getType()); |
884 | 884 | $parameters[] = new ParameterGenerator($primaryKeyColumn, $phpType); |
@@ -894,7 +894,7 @@ discard block |
||
894 | 894 | 'getById', |
895 | 895 | $parameters, |
896 | 896 | MethodGenerator::FLAG_PUBLIC, |
897 | - "return \$this->tdbmService->findObjectByPk('$tableName', [" . implode(', ', $primaryKeyFilter) . "], [], \$$lazyLoadingParameterName);", |
|
897 | + "return \$this->tdbmService->findObjectByPk('$tableName', [".implode(', ', $primaryKeyFilter)."], [], \$$lazyLoadingParameterName);", |
|
898 | 898 | (new DocBlockGenerator( |
899 | 899 | "Get $beanClassWithoutNameSpace specified by its ID (its primary key).", |
900 | 900 | 'If the primary key does not exist, an exception is thrown.', |
@@ -971,7 +971,7 @@ discard block |
||
971 | 971 | ] |
972 | 972 | ))->setWordWrap(false) |
973 | 973 | ); |
974 | - $findMethod->setReturnType($this->resultIteratorNamespace . '\\' . $this->getResultIteratorClassName()); |
|
974 | + $findMethod->setReturnType($this->resultIteratorNamespace.'\\'.$this->getResultIteratorClassName()); |
|
975 | 975 | $findMethod = $this->codeGeneratorListener->onBaseDaoFindGenerated($findMethod, $this, $this->configuration, $class); |
976 | 976 | if ($findMethod !== null) { |
977 | 977 | $class->addMethodFromGenerator($findMethod); |
@@ -1013,7 +1013,7 @@ discard block |
||
1013 | 1013 | ] |
1014 | 1014 | ))->setWordWrap(false) |
1015 | 1015 | ); |
1016 | - $findFromSqlMethod->setReturnType($this->resultIteratorNamespace . '\\' . $this->getResultIteratorClassName()); |
|
1016 | + $findFromSqlMethod->setReturnType($this->resultIteratorNamespace.'\\'.$this->getResultIteratorClassName()); |
|
1017 | 1017 | $findFromSqlMethod = $this->codeGeneratorListener->onBaseDaoFindFromSqlGenerated($findFromSqlMethod, $this, $this->configuration, $class); |
1018 | 1018 | if ($findFromSqlMethod !== null) { |
1019 | 1019 | $class->addMethodFromGenerator($findFromSqlMethod); |
@@ -1048,7 +1048,7 @@ discard block |
||
1048 | 1048 | ] |
1049 | 1049 | ))->setWordWrap(false) |
1050 | 1050 | ); |
1051 | - $findFromRawSqlMethod->setReturnType($this->resultIteratorNamespace . '\\' . $this->getResultIteratorClassName()); |
|
1051 | + $findFromRawSqlMethod->setReturnType($this->resultIteratorNamespace.'\\'.$this->getResultIteratorClassName()); |
|
1052 | 1052 | $findFromRawSqlMethod = $this->codeGeneratorListener->onBaseDaoFindFromRawSqlGenerated($findFromRawSqlMethod, $this, $this->configuration, $class); |
1053 | 1053 | if ($findFromRawSqlMethod !== null) { |
1054 | 1054 | $class->addMethodFromGenerator($findFromRawSqlMethod); |
@@ -1182,7 +1182,7 @@ discard block |
||
1182 | 1182 | $class->setDocBlock((new DocBlockGenerator( |
1183 | 1183 | "The $baseClassName class will iterate over results of $beanClassWithoutNameSpace class.", |
1184 | 1184 | null, |
1185 | - [new Tag\MethodTag('getIterator', ['\\' . $beanClassName . '[]'])] |
|
1185 | + [new Tag\MethodTag('getIterator', ['\\'.$beanClassName.'[]'])] |
|
1186 | 1186 | ))->setWordWrap(false)); |
1187 | 1187 | |
1188 | 1188 | $file = $this->codeGeneratorListener->onBaseResultIteratorGenerated($file, $this, $this->configuration); |
@@ -1238,7 +1238,7 @@ discard block |
||
1238 | 1238 | } |
1239 | 1239 | } |
1240 | 1240 | } |
1241 | - usort($methods, static function (MethodGenerator $methodA, MethodGenerator $methodB) { |
|
1241 | + usort($methods, static function(MethodGenerator $methodA, MethodGenerator $methodB) { |
|
1242 | 1242 | return $methodA->getName() <=> $methodB->getName(); |
1243 | 1243 | }); |
1244 | 1244 | |
@@ -1387,11 +1387,11 @@ discard block |
||
1387 | 1387 | |
1388 | 1388 | if ($index->isUnique()) { |
1389 | 1389 | $parameters[] = new ParameterGenerator('additionalTablesFetch', 'array', []); |
1390 | - $params[] = new ParamTag('additionalTablesFetch', [ 'string[]' ], 'A list of additional tables to fetch (for performance improvement)'); |
|
1391 | - $params[] = new ReturnTag([ '\\'.$beanNamespace.'\\'.$beanClassName, 'null' ]); |
|
1390 | + $params[] = new ParamTag('additionalTablesFetch', ['string[]'], 'A list of additional tables to fetch (for performance improvement)'); |
|
1391 | + $params[] = new ReturnTag(['\\'.$beanNamespace.'\\'.$beanClassName, 'null']); |
|
1392 | 1392 | $method->setReturnType('?\\'.$beanNamespace.'\\'.$beanClassName); |
1393 | 1393 | |
1394 | - $docBlock = new DocBlockGenerator("Get a $beanClassName filtered by ".implode(', ', $commentArguments). '.', null, $params); |
|
1394 | + $docBlock = new DocBlockGenerator("Get a $beanClassName filtered by ".implode(', ', $commentArguments).'.', null, $params); |
|
1395 | 1395 | $docBlock->setWordWrap(false); |
1396 | 1396 | |
1397 | 1397 | $body = "\$filter = [ |
@@ -1400,12 +1400,12 @@ discard block |
||
1400 | 1400 | "; |
1401 | 1401 | } else { |
1402 | 1402 | $parameters[] = (new ParameterGenerator('orderBy'))->setDefaultValue(null); |
1403 | - $params[] = new ParamTag('orderBy', [ 'mixed' ], 'The order string'); |
|
1403 | + $params[] = new ParamTag('orderBy', ['mixed'], 'The order string'); |
|
1404 | 1404 | $parameters[] = new ParameterGenerator('additionalTablesFetch', 'array', []); |
1405 | - $params[] = new ParamTag('additionalTablesFetch', [ 'string[]' ], 'A list of additional tables to fetch (for performance improvement)'); |
|
1405 | + $params[] = new ParamTag('additionalTablesFetch', ['string[]'], 'A list of additional tables to fetch (for performance improvement)'); |
|
1406 | 1406 | $parameters[] = (new ParameterGenerator('mode', '?int'))->setDefaultValue(null); |
1407 | - $params[] = new ParamTag('mode', [ 'int', 'null' ], 'Either TDBMService::MODE_ARRAY or TDBMService::MODE_CURSOR (for large datasets). Defaults to TDBMService::MODE_ARRAY.'); |
|
1408 | - $method->setReturnType($this->resultIteratorNamespace . '\\' . $this->getResultIteratorClassName()); |
|
1407 | + $params[] = new ParamTag('mode', ['int', 'null'], 'Either TDBMService::MODE_ARRAY or TDBMService::MODE_CURSOR (for large datasets). Defaults to TDBMService::MODE_ARRAY.'); |
|
1408 | + $method->setReturnType($this->resultIteratorNamespace.'\\'.$this->getResultIteratorClassName()); |
|
1409 | 1409 | |
1410 | 1410 | $docBlock = new DocBlockGenerator("Get a list of $beanClassName filtered by ".implode(', ', $commentArguments).".", null, $params); |
1411 | 1411 | $docBlock->setWordWrap(false); |
@@ -1722,17 +1722,17 @@ discard block |
||
1722 | 1722 | * @param string $indent |
1723 | 1723 | * @return string |
1724 | 1724 | */ |
1725 | - private function psr2VarExport($var, string $indent=''): string |
|
1725 | + private function psr2VarExport($var, string $indent = ''): string |
|
1726 | 1726 | { |
1727 | 1727 | if (is_array($var)) { |
1728 | 1728 | $indexed = array_keys($var) === range(0, count($var) - 1); |
1729 | 1729 | $r = []; |
1730 | 1730 | foreach ($var as $key => $value) { |
1731 | 1731 | $r[] = "$indent " |
1732 | - . ($indexed ? '' : $this->psr2VarExport($key) . ' => ') |
|
1732 | + . ($indexed ? '' : $this->psr2VarExport($key).' => ') |
|
1733 | 1733 | . $this->psr2VarExport($value, "$indent "); |
1734 | 1734 | } |
1735 | - return "[\n" . implode(",\n", $r) . "\n" . $indent . ']'; |
|
1735 | + return "[\n".implode(",\n", $r)."\n".$indent.']'; |
|
1736 | 1736 | } |
1737 | 1737 | return var_export($var, true); |
1738 | 1738 | } |