@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | // Let's add the ORDER BY if any |
| 140 | 140 | if (isset($parsedSql['0']['ORDER'])) { |
| 141 | 141 | $orderByBuilder = new OrderByBuilder(); |
| 142 | - $processedSql .= " " . $orderByBuilder->build($parsedSql['0']['ORDER']); |
|
| 142 | + $processedSql .= " ".$orderByBuilder->build($parsedSql['0']['ORDER']); |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | return [$processedSql, $sqlCount ?? $processedSqlCount, $columnDescriptors]; |
@@ -152,8 +152,8 @@ discard block |
||
| 152 | 152 | { |
| 153 | 153 | $selectBuilder = new SelectStatementBuilder(); |
| 154 | 154 | |
| 155 | - return implode(' UNION ', array_map(function ($clause) use ($selectBuilder) { |
|
| 156 | - return '(' . $selectBuilder->build($clause) . ')'; |
|
| 155 | + return implode(' UNION ', array_map(function($clause) use ($selectBuilder) { |
|
| 156 | + return '('.$selectBuilder->build($clause).')'; |
|
| 157 | 157 | }, $parsed['UNION'])); |
| 158 | 158 | } |
| 159 | 159 | |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | $alias = AbstractQueryFactory::getColumnAlias($tableName, $columnName); |
| 236 | 236 | $astColumn = [ |
| 237 | 237 | 'expr_type' => 'colref', |
| 238 | - 'base_expr' => $connection->quoteIdentifier($tableName) . '.' . $connection->quoteIdentifier($columnName), |
|
| 238 | + 'base_expr' => $connection->quoteIdentifier($tableName).'.'.$connection->quoteIdentifier($columnName), |
|
| 239 | 239 | 'no_quotes' => [ |
| 240 | 240 | 'delim' => '.', |
| 241 | 241 | 'parts' => [ |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | return $this->generateWrappedSqlCount($parsedSql); |
| 324 | 324 | } |
| 325 | 325 | |
| 326 | - $countSubExpr = array_map(function (array $item) { |
|
| 326 | + $countSubExpr = array_map(function(array $item) { |
|
| 327 | 327 | unset($item['alias']); |
| 328 | 328 | return $item; |
| 329 | 329 | }, $parsedSql['SELECT']); |
@@ -96,8 +96,8 @@ discard block |
||
| 96 | 96 | $schemaLockFileDumper = new SchemaLockFileDumper($connection, new ArrayCache(), Configuration::getDefaultLockFilePath()); |
| 97 | 97 | $tdbmSchemaAnalyzer = new TDBMSchemaAnalyzer($connection, new ArrayCache(), $schemaAnalyzer, $schemaLockFileDumper); |
| 98 | 98 | $tdbmDaoGenerator = new TDBMDaoGenerator(self::createConfiguration(), $tdbmSchemaAnalyzer); |
| 99 | - $rootPath = __DIR__ . '/../'; |
|
| 100 | - self::recursiveDelete(__DIR__. '/../../src/Test/Dao/'); |
|
| 99 | + $rootPath = __DIR__.'/../'; |
|
| 100 | + self::recursiveDelete(__DIR__.'/../../src/Test/Dao/'); |
|
| 101 | 101 | |
| 102 | 102 | $tdbmDaoGenerator->generateAllDaosAndBeans(); |
| 103 | 103 | } |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | if (is_file($str)) { |
| 114 | 114 | return @unlink($str); |
| 115 | 115 | } elseif (is_dir($str)) { |
| 116 | - $scan = glob(rtrim($str, '/') . '/*'); |
|
| 116 | + $scan = glob(rtrim($str, '/').'/*'); |
|
| 117 | 117 | foreach ($scan as $index => $path) { |
| 118 | 118 | self::recursiveDelete($path); |
| 119 | 119 | } |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | */ |
| 218 | 218 | public function getConstructorProperties(): array |
| 219 | 219 | { |
| 220 | - $constructorProperties = array_filter($this->beanPropertyDescriptors, static function (AbstractBeanPropertyDescriptor $property) { |
|
| 220 | + $constructorProperties = array_filter($this->beanPropertyDescriptors, static function(AbstractBeanPropertyDescriptor $property) { |
|
| 221 | 221 | return !$property instanceof InheritanceReferencePropertyDescriptor && $property->isCompulsory() && !$property->isReadOnly(); |
| 222 | 222 | }); |
| 223 | 223 | |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | public function getPropertiesWithDefault(): array |
| 233 | 233 | { |
| 234 | 234 | $properties = $this->getPropertiesForTable($this->table); |
| 235 | - $defaultProperties = array_filter($properties, function (AbstractBeanPropertyDescriptor $property) { |
|
| 235 | + $defaultProperties = array_filter($properties, function(AbstractBeanPropertyDescriptor $property) { |
|
| 236 | 236 | return $property->hasDefault(); |
| 237 | 237 | }); |
| 238 | 238 | |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | */ |
| 247 | 247 | public function getExposedProperties(): array |
| 248 | 248 | { |
| 249 | - $exposedProperties = array_filter($this->beanPropertyDescriptors, function (AbstractBeanPropertyDescriptor $property) { |
|
| 249 | + $exposedProperties = array_filter($this->beanPropertyDescriptors, function(AbstractBeanPropertyDescriptor $property) { |
|
| 250 | 250 | return !$property instanceof InheritanceReferencePropertyDescriptor && $property->getTable()->getName() === $this->table->getName(); |
| 251 | 251 | }); |
| 252 | 252 | |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | foreach ($beanPropertyDescriptors as $beanDescriptor) { |
| 353 | 353 | $name = $beanDescriptor->getGetterName(); |
| 354 | 354 | if (isset($names[$name])) { |
| 355 | - throw new TDBMException('Unsolvable name conflict while generating method name "' . $name . '"'); |
|
| 355 | + throw new TDBMException('Unsolvable name conflict while generating method name "'.$name.'"'); |
|
| 356 | 356 | } else { |
| 357 | 357 | $names[$name] = $beanDescriptor; |
| 358 | 358 | } |
@@ -401,7 +401,7 @@ discard block |
||
| 401 | 401 | $assigns[] = $property->assignToDefaultCode()."\n"; |
| 402 | 402 | } |
| 403 | 403 | |
| 404 | - $body = $parentConstructorCode . implode('', $assigns); |
|
| 404 | + $body = $parentConstructorCode.implode('', $assigns); |
|
| 405 | 405 | |
| 406 | 406 | $constructor->setBody($body); |
| 407 | 407 | |
@@ -475,7 +475,7 @@ discard block |
||
| 475 | 475 | $this->descriptorsByMethodName[$name][] = $descriptor; |
| 476 | 476 | $descriptors = $this->descriptorsByMethodName[$name]; |
| 477 | 477 | if (count($descriptors) > 1) { |
| 478 | - $properties = array_filter($descriptors, function ($descriptor) { |
|
| 478 | + $properties = array_filter($descriptors, function($descriptor) { |
|
| 479 | 479 | return $descriptor instanceof AbstractBeanPropertyDescriptor; |
| 480 | 480 | }); |
| 481 | 481 | $renameProperties = count($properties) > 1; |
@@ -533,7 +533,7 @@ discard block |
||
| 533 | 533 | foreach ($this->getExposedProperties() as $beanPropertyDescriptor) { |
| 534 | 534 | $propertyCode = $beanPropertyDescriptor->getJsonSerializeCode(); |
| 535 | 535 | if (!empty($propertyCode)) { |
| 536 | - $body .= PHP_EOL . $propertyCode; |
|
| 536 | + $body .= PHP_EOL.$propertyCode; |
|
| 537 | 537 | } |
| 538 | 538 | } |
| 539 | 539 | |
@@ -541,11 +541,11 @@ discard block |
||
| 541 | 541 | foreach ($this->getMethodDescriptors() as $methodDescriptor) { |
| 542 | 542 | $methodCode = $methodDescriptor->getJsonSerializeCode(); |
| 543 | 543 | if (!empty($methodCode)) { |
| 544 | - $body .= PHP_EOL . $methodCode; |
|
| 544 | + $body .= PHP_EOL.$methodCode; |
|
| 545 | 545 | } |
| 546 | 546 | } |
| 547 | 547 | |
| 548 | - $body .= PHP_EOL . 'return $array;'; |
|
| 548 | + $body .= PHP_EOL.'return $array;'; |
|
| 549 | 549 | |
| 550 | 550 | $method->setBody($body); |
| 551 | 551 | |
@@ -641,10 +641,10 @@ discard block |
||
| 641 | 641 | /** @var AddInterface[] $addInterfaceAnnotations */ |
| 642 | 642 | $addInterfaceAnnotations = $this->annotationParser->getTableAnnotations($this->table)->findAnnotations(AddInterface::class); |
| 643 | 643 | |
| 644 | - $interfaces = [ JsonSerializable::class ]; |
|
| 644 | + $interfaces = [JsonSerializable::class]; |
|
| 645 | 645 | foreach ($addInterfaceAnnotations as $annotation) { |
| 646 | 646 | /** @phpstan-var class-string $className */ |
| 647 | - $className = $annotation->getName(); |
|
| 647 | + $className = $annotation->getName(); |
|
| 648 | 648 | $interfaces[] = $className; |
| 649 | 649 | } |
| 650 | 650 | |
@@ -683,7 +683,7 @@ discard block |
||
| 683 | 683 | } |
| 684 | 684 | } elseif ($methodDescriptor instanceof PivotTableMethodsDescriptor) { |
| 685 | 685 | $pivotTableMethodsDescriptors[] = $methodDescriptor; |
| 686 | - [ $getter, $adder, $remover, $has, $setter ] = $methodDescriptor->getCode(); |
|
| 686 | + [$getter, $adder, $remover, $has, $setter] = $methodDescriptor->getCode(); |
|
| 687 | 687 | $methods = $this->codeGeneratorListener->onBaseBeanManyToManyGenerated($getter, $adder, $remover, $has, $setter, $methodDescriptor, $this, $this->configuration, $class); |
| 688 | 688 | foreach ($methods as $method) { |
| 689 | 689 | if ($method) { |
@@ -813,7 +813,7 @@ discard block |
||
| 813 | 813 | $interfaces = []; |
| 814 | 814 | foreach ($addInterfaceOnDaoAnnotations as $annotation) { |
| 815 | 815 | /** @phpstan-var class-string $className */ |
| 816 | - $className = $annotation->getName(); |
|
| 816 | + $className = $annotation->getName(); |
|
| 817 | 817 | $interfaces[] = $className; |
| 818 | 818 | } |
| 819 | 819 | |
@@ -835,7 +835,7 @@ discard block |
||
| 835 | 835 | |
| 836 | 836 | $constructorMethod = new MethodGenerator( |
| 837 | 837 | '__construct', |
| 838 | - [ new ParameterGenerator('tdbmService', TDBMService::class) ], |
|
| 838 | + [new ParameterGenerator('tdbmService', TDBMService::class)], |
|
| 839 | 839 | MethodGenerator::FLAG_PUBLIC, |
| 840 | 840 | '$this->tdbmService = $tdbmService;', |
| 841 | 841 | 'Sets the TDBM service used by this DAO.' |
@@ -847,7 +847,7 @@ discard block |
||
| 847 | 847 | |
| 848 | 848 | $saveMethod = new MethodGenerator( |
| 849 | 849 | 'save', |
| 850 | - [ new ParameterGenerator('obj', $beanClassName) ], |
|
| 850 | + [new ParameterGenerator('obj', $beanClassName)], |
|
| 851 | 851 | MethodGenerator::FLAG_PUBLIC, |
| 852 | 852 | '$this->tdbmService->save($obj);', |
| 853 | 853 | (new DocBlockGenerator( |
@@ -895,7 +895,7 @@ discard block |
||
| 895 | 895 | |
| 896 | 896 | foreach ($primaryKeyColumns as $primaryKeyColumn) { |
| 897 | 897 | if ($primaryKeyColumn === $lazyLoadingParameterName) { |
| 898 | - throw new TDBMException('Primary Column name `' . $lazyLoadingParameterName . '` is not allowed.'); |
|
| 898 | + throw new TDBMException('Primary Column name `'.$lazyLoadingParameterName.'` is not allowed.'); |
|
| 899 | 899 | } |
| 900 | 900 | $phpType = TDBMDaoGenerator::dbalTypeToPhpType($this->table->getColumn($primaryKeyColumn)->getType()); |
| 901 | 901 | $parameters[] = new ParameterGenerator($primaryKeyColumn, $phpType); |
@@ -911,7 +911,7 @@ discard block |
||
| 911 | 911 | 'getById', |
| 912 | 912 | $parameters, |
| 913 | 913 | MethodGenerator::FLAG_PUBLIC, |
| 914 | - "return \$this->tdbmService->findObjectByPk('$tableName', [" . implode(', ', $primaryKeyFilter) . "], [], \$$lazyLoadingParameterName, \\$beanClassName::class, \\$resultIteratorClass::class);", |
|
| 914 | + "return \$this->tdbmService->findObjectByPk('$tableName', [".implode(', ', $primaryKeyFilter)."], [], \$$lazyLoadingParameterName, \\$beanClassName::class, \\$resultIteratorClass::class);", |
|
| 915 | 915 | (new DocBlockGenerator( |
| 916 | 916 | "Get $beanClassWithoutNameSpace specified by its ID (its primary key).", |
| 917 | 917 | 'If the primary key does not exist, an exception is thrown.', |
@@ -1199,7 +1199,7 @@ discard block |
||
| 1199 | 1199 | $class->addUse(ResultIterator::class); |
| 1200 | 1200 | $class->setExtendedClass(ResultIterator::class); |
| 1201 | 1201 | } else { |
| 1202 | - $class->addUse($this->resultIteratorNamespace . '\\' . $extends); |
|
| 1202 | + $class->addUse($this->resultIteratorNamespace.'\\'.$extends); |
|
| 1203 | 1203 | /** @var class-string $extends */ |
| 1204 | 1204 | $class->setExtendedClass($extends); |
| 1205 | 1205 | } |
@@ -1207,7 +1207,7 @@ discard block |
||
| 1207 | 1207 | $class->setDocBlock((new DocBlockGenerator( |
| 1208 | 1208 | "The $baseClassName class will iterate over results of $beanClassWithoutNameSpace class.", |
| 1209 | 1209 | null, |
| 1210 | - [new Tag\MethodTag('getIterator', ['\\' . $beanClassName . '[]']), new Tag\MethodTag('toArray', ['\\' . $beanClassName . '[]'])] |
|
| 1210 | + [new Tag\MethodTag('getIterator', ['\\'.$beanClassName.'[]']), new Tag\MethodTag('toArray', ['\\'.$beanClassName.'[]'])] |
|
| 1211 | 1211 | ))->setWordWrap(false)); |
| 1212 | 1212 | |
| 1213 | 1213 | $file = $this->codeGeneratorListener->onBaseResultIteratorGenerated($file, $this, $this->configuration); |
@@ -1263,7 +1263,7 @@ discard block |
||
| 1263 | 1263 | } |
| 1264 | 1264 | } |
| 1265 | 1265 | } |
| 1266 | - usort($methods, static function (MethodGenerator $methodA, MethodGenerator $methodB) { |
|
| 1266 | + usort($methods, static function(MethodGenerator $methodA, MethodGenerator $methodB) { |
|
| 1267 | 1267 | return $methodA->getName() <=> $methodB->getName(); |
| 1268 | 1268 | }); |
| 1269 | 1269 | |
@@ -1412,11 +1412,11 @@ discard block |
||
| 1412 | 1412 | |
| 1413 | 1413 | if ($index->isUnique()) { |
| 1414 | 1414 | $parameters[] = new ParameterGenerator('additionalTablesFetch', 'array', []); |
| 1415 | - $params[] = new ParamTag('additionalTablesFetch', [ 'string[]' ], 'A list of additional tables to fetch (for performance improvement)'); |
|
| 1416 | - $params[] = new ReturnTag([ '\\'.$beanNamespace.'\\'.$beanClassName, 'null' ]); |
|
| 1415 | + $params[] = new ParamTag('additionalTablesFetch', ['string[]'], 'A list of additional tables to fetch (for performance improvement)'); |
|
| 1416 | + $params[] = new ReturnTag(['\\'.$beanNamespace.'\\'.$beanClassName, 'null']); |
|
| 1417 | 1417 | $method->setReturnType('?\\'.$beanNamespace.'\\'.$beanClassName); |
| 1418 | 1418 | |
| 1419 | - $docBlock = new DocBlockGenerator("Get a $beanClassName filtered by ".implode(', ', $commentArguments). '.', null, $params); |
|
| 1419 | + $docBlock = new DocBlockGenerator("Get a $beanClassName filtered by ".implode(', ', $commentArguments).'.', null, $params); |
|
| 1420 | 1420 | $docBlock->setWordWrap(false); |
| 1421 | 1421 | |
| 1422 | 1422 | $body = "\$filter = [ |
@@ -1425,12 +1425,12 @@ discard block |
||
| 1425 | 1425 | "; |
| 1426 | 1426 | } else { |
| 1427 | 1427 | $parameters[] = (new ParameterGenerator('orderBy'))->setDefaultValue(null); |
| 1428 | - $params[] = new ParamTag('orderBy', [ 'mixed' ], 'The order string'); |
|
| 1428 | + $params[] = new ParamTag('orderBy', ['mixed'], 'The order string'); |
|
| 1429 | 1429 | $parameters[] = new ParameterGenerator('additionalTablesFetch', 'array', []); |
| 1430 | - $params[] = new ParamTag('additionalTablesFetch', [ 'string[]' ], 'A list of additional tables to fetch (for performance improvement)'); |
|
| 1430 | + $params[] = new ParamTag('additionalTablesFetch', ['string[]'], 'A list of additional tables to fetch (for performance improvement)'); |
|
| 1431 | 1431 | $parameters[] = (new ParameterGenerator('mode', '?int'))->setDefaultValue(null); |
| 1432 | - $params[] = new ParamTag('mode', [ 'int', 'null' ], 'Either TDBMService::MODE_ARRAY or TDBMService::MODE_CURSOR (for large datasets). Defaults to TDBMService::MODE_ARRAY.'); |
|
| 1433 | - $method->setReturnType($this->resultIteratorNamespace . '\\' . $this->getResultIteratorClassName()); |
|
| 1432 | + $params[] = new ParamTag('mode', ['int', 'null'], 'Either TDBMService::MODE_ARRAY or TDBMService::MODE_CURSOR (for large datasets). Defaults to TDBMService::MODE_ARRAY.'); |
|
| 1433 | + $method->setReturnType($this->resultIteratorNamespace.'\\'.$this->getResultIteratorClassName()); |
|
| 1434 | 1434 | |
| 1435 | 1435 | $docBlock = new DocBlockGenerator("Get a list of $beanClassName filtered by ".implode(', ', $commentArguments).".", null, $params); |
| 1436 | 1436 | $docBlock->setWordWrap(false); |
@@ -1490,8 +1490,8 @@ discard block |
||
| 1490 | 1490 | var_export($tdbmFk->getCacheKey(), true), |
| 1491 | 1491 | 'null', |
| 1492 | 1492 | var_export($this->table->getName(), true), |
| 1493 | - '\\' . $this->beanNamespace . '\\' . $this->namingStrategy->getBeanClassName($foreignTableName) . '::class', |
|
| 1494 | - '\\' . $this->resultIteratorNamespace . '\\' . $this->namingStrategy->getResultIteratorClassName($foreignTableName) . '::class' |
|
| 1493 | + '\\'.$this->beanNamespace.'\\'.$this->namingStrategy->getBeanClassName($foreignTableName).'::class', |
|
| 1494 | + '\\'.$this->resultIteratorNamespace.'\\'.$this->namingStrategy->getResultIteratorClassName($foreignTableName).'::class' |
|
| 1495 | 1495 | ); |
| 1496 | 1496 | } |
| 1497 | 1497 | } |
@@ -1772,10 +1772,10 @@ discard block |
||
| 1772 | 1772 | $r = []; |
| 1773 | 1773 | foreach ($var as $key => $value) { |
| 1774 | 1774 | $r[] = "$indent " |
| 1775 | - . ($indexed ? '' : $this->psr2VarExport($key) . ' => ') |
|
| 1775 | + . ($indexed ? '' : $this->psr2VarExport($key).' => ') |
|
| 1776 | 1776 | . $this->psr2VarExport($value, "$indent "); |
| 1777 | 1777 | } |
| 1778 | - return "[\n" . implode(",\n", $r) . "\n" . $indent . ']'; |
|
| 1778 | + return "[\n".implode(",\n", $r)."\n".$indent.']'; |
|
| 1779 | 1779 | } |
| 1780 | 1780 | return var_export($var, true); |
| 1781 | 1781 | } |