@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | */ |
202 | 202 | public function getConstructorProperties(): array |
203 | 203 | { |
204 | - $constructorProperties = array_filter($this->beanPropertyDescriptors, function (AbstractBeanPropertyDescriptor $property) { |
|
204 | + $constructorProperties = array_filter($this->beanPropertyDescriptors, function(AbstractBeanPropertyDescriptor $property) { |
|
205 | 205 | return !$property instanceof InheritanceReferencePropertyDescriptor && $property->isCompulsory(); |
206 | 206 | }); |
207 | 207 | |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | public function getPropertiesWithDefault(): array |
217 | 217 | { |
218 | 218 | $properties = $this->getPropertiesForTable($this->table); |
219 | - $defaultProperties = array_filter($properties, function (AbstractBeanPropertyDescriptor $property) { |
|
219 | + $defaultProperties = array_filter($properties, function(AbstractBeanPropertyDescriptor $property) { |
|
220 | 220 | return $property->hasDefault(); |
221 | 221 | }); |
222 | 222 | |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | */ |
231 | 231 | public function getExposedProperties(): array |
232 | 232 | { |
233 | - $exposedProperties = array_filter($this->beanPropertyDescriptors, function (AbstractBeanPropertyDescriptor $property) { |
|
233 | + $exposedProperties = array_filter($this->beanPropertyDescriptors, function(AbstractBeanPropertyDescriptor $property) { |
|
234 | 234 | return !$property instanceof InheritanceReferencePropertyDescriptor && $property->getTable()->getName() === $this->table->getName(); |
235 | 235 | }); |
236 | 236 | |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | foreach ($beanPropertyDescriptors as $beanDescriptor) { |
337 | 337 | $name = $beanDescriptor->getGetterName(); |
338 | 338 | if (isset($names[$name])) { |
339 | - throw new TDBMException('Unsolvable name conflict while generating method name "' . $name . '"'); |
|
339 | + throw new TDBMException('Unsolvable name conflict while generating method name "'.$name.'"'); |
|
340 | 340 | } else { |
341 | 341 | $names[$name] = $beanDescriptor; |
342 | 342 | } |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | $assigns[] = $property->assignToDefaultCode()."\n"; |
386 | 386 | } |
387 | 387 | |
388 | - $body = $parentConstructorCode . implode('', $assigns); |
|
388 | + $body = $parentConstructorCode.implode('', $assigns); |
|
389 | 389 | |
390 | 390 | $constructor->setBody($body); |
391 | 391 | |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | foreach ($this->getExposedProperties() as $beanPropertyDescriptor) { |
503 | 503 | $propertyCode = $beanPropertyDescriptor->getJsonSerializeCode(); |
504 | 504 | if (!empty($propertyCode)) { |
505 | - $body .= PHP_EOL . $propertyCode; |
|
505 | + $body .= PHP_EOL.$propertyCode; |
|
506 | 506 | } |
507 | 507 | } |
508 | 508 | |
@@ -510,11 +510,11 @@ discard block |
||
510 | 510 | foreach ($this->getMethodDescriptors() as $methodDescriptor) { |
511 | 511 | $methodCode = $methodDescriptor->getJsonSerializeCode(); |
512 | 512 | if (!empty($methodCode)) { |
513 | - $body .= PHP_EOL . $methodCode; |
|
513 | + $body .= PHP_EOL.$methodCode; |
|
514 | 514 | } |
515 | 515 | } |
516 | 516 | |
517 | - $body .= PHP_EOL . 'return $array;'; |
|
517 | + $body .= PHP_EOL.'return $array;'; |
|
518 | 518 | |
519 | 519 | $method->setBody($body); |
520 | 520 | |
@@ -609,7 +609,7 @@ discard block |
||
609 | 609 | /** @var AddInterface[] $addInterfaceAnnotations */ |
610 | 610 | $addInterfaceAnnotations = $this->annotationParser->getTableAnnotations($this->table)->findAnnotations(AddInterface::class); |
611 | 611 | |
612 | - $interfaces = [ JsonSerializable::class ]; |
|
612 | + $interfaces = [JsonSerializable::class]; |
|
613 | 613 | foreach ($addInterfaceAnnotations as $annotation) { |
614 | 614 | $interfaces[] = $annotation->getName(); |
615 | 615 | } |
@@ -649,7 +649,7 @@ discard block |
||
649 | 649 | } |
650 | 650 | } elseif ($methodDescriptor instanceof PivotTableMethodsDescriptor) { |
651 | 651 | $pivotTableMethodsDescriptors[] = $methodDescriptor; |
652 | - [ $getter, $adder, $remover, $has, $setter ] = $methodDescriptor->getCode(); |
|
652 | + [$getter, $adder, $remover, $has, $setter] = $methodDescriptor->getCode(); |
|
653 | 653 | $methods = $this->codeGeneratorListener->onBaseBeanManyToManyGenerated($getter, $adder, $remover, $has, $setter, $methodDescriptor, $this, $this->configuration, $class); |
654 | 654 | foreach ($methods as $method) { |
655 | 655 | if ($method) { |
@@ -797,7 +797,7 @@ discard block |
||
797 | 797 | |
798 | 798 | $constructorMethod = new MethodGenerator( |
799 | 799 | '__construct', |
800 | - [ new ParameterGenerator('tdbmService', TDBMService::class) ], |
|
800 | + [new ParameterGenerator('tdbmService', TDBMService::class)], |
|
801 | 801 | MethodGenerator::FLAG_PUBLIC, |
802 | 802 | '$this->tdbmService = $tdbmService;', |
803 | 803 | 'Sets the TDBM service used by this DAO.' |
@@ -809,7 +809,7 @@ discard block |
||
809 | 809 | |
810 | 810 | $saveMethod = new MethodGenerator( |
811 | 811 | 'save', |
812 | - [ new ParameterGenerator('obj', $beanClassName) ], |
|
812 | + [new ParameterGenerator('obj', $beanClassName)], |
|
813 | 813 | MethodGenerator::FLAG_PUBLIC, |
814 | 814 | '$this->tdbmService->save($obj);', |
815 | 815 | (new DocBlockGenerator( |
@@ -845,7 +845,7 @@ discard block |
||
845 | 845 | "Get all $beanClassWithoutNameSpace records.", |
846 | 846 | null, |
847 | 847 | [ |
848 | - new ReturnTag([ '\\'.$beanClassName.'[]', '\\'.ResultIterator::class ]) |
|
848 | + new ReturnTag(['\\'.$beanClassName.'[]', '\\'.ResultIterator::class]) |
|
849 | 849 | ] |
850 | 850 | ))->setWordWrap(false) |
851 | 851 | ); |
@@ -863,7 +863,7 @@ discard block |
||
863 | 863 | |
864 | 864 | foreach ($primaryKeyColumns as $primaryKeyColumn) { |
865 | 865 | if ($primaryKeyColumn === $lazyLoadingParameterName) { |
866 | - throw new TDBMException('Primary Column name `' . $lazyLoadingParameterName . '` is not allowed.'); |
|
866 | + throw new TDBMException('Primary Column name `'.$lazyLoadingParameterName.'` is not allowed.'); |
|
867 | 867 | } |
868 | 868 | $phpType = TDBMDaoGenerator::dbalTypeToPhpType($this->table->getColumn($primaryKeyColumn)->getType()); |
869 | 869 | $parameters[] = new ParameterGenerator($primaryKeyColumn, $phpType); |
@@ -879,7 +879,7 @@ discard block |
||
879 | 879 | 'getById', |
880 | 880 | $parameters, |
881 | 881 | MethodGenerator::FLAG_PUBLIC, |
882 | - "return \$this->tdbmService->findObjectByPk('$tableName', [" . implode(', ', $primaryKeyFilter) . "], [], \$$lazyLoadingParameterName);", |
|
882 | + "return \$this->tdbmService->findObjectByPk('$tableName', [".implode(', ', $primaryKeyFilter)."], [], \$$lazyLoadingParameterName);", |
|
883 | 883 | (new DocBlockGenerator( |
884 | 884 | "Get $beanClassWithoutNameSpace specified by its ID (its primary key).", |
885 | 885 | 'If the primary key does not exist, an exception is thrown.', |
@@ -953,7 +953,7 @@ discard block |
||
953 | 953 | new ParamTag('orderBy', ['mixed'], 'The order string'), |
954 | 954 | new ParamTag('additionalTablesFetch', ['string[]'], 'A list of additional tables to fetch (for performance improvement)'), |
955 | 955 | new ParamTag('mode', ['int', 'null'], 'Either TDBMService::MODE_ARRAY or TDBMService::MODE_CURSOR (for large datasets). Defaults to TDBMService::MODE_ARRAY.'), |
956 | - new ReturnTag(['\\' . $beanClassName . '[]', '\\'.ResultIterator::class]) |
|
956 | + new ReturnTag(['\\'.$beanClassName.'[]', '\\'.ResultIterator::class]) |
|
957 | 957 | ] |
958 | 958 | ))->setWordWrap(false) |
959 | 959 | ); |
@@ -996,7 +996,7 @@ discard block |
||
996 | 996 | new ParamTag('orderBy', ['mixed'], 'The order string'), |
997 | 997 | new ParamTag('additionalTablesFetch', ['string[]'], 'A list of additional tables to fetch (for performance improvement)'), |
998 | 998 | new ParamTag('mode', ['int', 'null'], 'Either TDBMService::MODE_ARRAY or TDBMService::MODE_CURSOR (for large datasets). Defaults to TDBMService::MODE_ARRAY.'), |
999 | - new ReturnTag(['\\'.$beanClassName . '[]', '\\'.ResultIterator::class]) |
|
999 | + new ReturnTag(['\\'.$beanClassName.'[]', '\\'.ResultIterator::class]) |
|
1000 | 1000 | ] |
1001 | 1001 | ))->setWordWrap(false) |
1002 | 1002 | ); |
@@ -1032,7 +1032,7 @@ discard block |
||
1032 | 1032 | new ParamTag('parameters', ['mixed[]'], 'The parameters associated with the query'), |
1033 | 1033 | new ParamTag('countSql', ['string', 'null'], 'The sql query that provides total count of rows (automatically computed if not provided)'), |
1034 | 1034 | new ParamTag('mode', ['int', 'null'], 'Either TDBMService::MODE_ARRAY or TDBMService::MODE_CURSOR (for large datasets). Defaults to TDBMService::MODE_ARRAY.'), |
1035 | - new ReturnTag(['\\'.$beanClassName . '[]', '\\'.ResultIterator::class]) |
|
1035 | + new ReturnTag(['\\'.$beanClassName.'[]', '\\'.ResultIterator::class]) |
|
1036 | 1036 | ] |
1037 | 1037 | ))->setWordWrap(false) |
1038 | 1038 | ); |
@@ -1186,7 +1186,7 @@ discard block |
||
1186 | 1186 | } |
1187 | 1187 | } |
1188 | 1188 | } |
1189 | - usort($methods, static function (MethodGenerator $methodA, MethodGenerator $methodB) { |
|
1189 | + usort($methods, static function(MethodGenerator $methodA, MethodGenerator $methodB) { |
|
1190 | 1190 | return $methodA->getName() <=> $methodB->getName(); |
1191 | 1191 | }); |
1192 | 1192 | |
@@ -1335,11 +1335,11 @@ discard block |
||
1335 | 1335 | |
1336 | 1336 | if ($index->isUnique()) { |
1337 | 1337 | $parameters[] = new ParameterGenerator('additionalTablesFetch', 'array', []); |
1338 | - $params[] = new ParamTag('additionalTablesFetch', [ 'string[]' ], 'A list of additional tables to fetch (for performance improvement)'); |
|
1339 | - $params[] = new ReturnTag([ '\\'.$beanNamespace.'\\'.$beanClassName, 'null' ]); |
|
1338 | + $params[] = new ParamTag('additionalTablesFetch', ['string[]'], 'A list of additional tables to fetch (for performance improvement)'); |
|
1339 | + $params[] = new ReturnTag(['\\'.$beanNamespace.'\\'.$beanClassName, 'null']); |
|
1340 | 1340 | $method->setReturnType('?\\'.$beanNamespace.'\\'.$beanClassName); |
1341 | 1341 | |
1342 | - $docBlock = new DocBlockGenerator("Get a $beanClassName filtered by ".implode(', ', $commentArguments). '.', null, $params); |
|
1342 | + $docBlock = new DocBlockGenerator("Get a $beanClassName filtered by ".implode(', ', $commentArguments).'.', null, $params); |
|
1343 | 1343 | $docBlock->setWordWrap(false); |
1344 | 1344 | |
1345 | 1345 | $body = "\$filter = [ |
@@ -1348,12 +1348,12 @@ discard block |
||
1348 | 1348 | "; |
1349 | 1349 | } else { |
1350 | 1350 | $parameters[] = (new ParameterGenerator('orderBy'))->setDefaultValue(null); |
1351 | - $params[] = new ParamTag('orderBy', [ 'mixed' ], 'The order string'); |
|
1351 | + $params[] = new ParamTag('orderBy', ['mixed'], 'The order string'); |
|
1352 | 1352 | $parameters[] = new ParameterGenerator('additionalTablesFetch', 'array', []); |
1353 | - $params[] = new ParamTag('additionalTablesFetch', [ 'string[]' ], 'A list of additional tables to fetch (for performance improvement)'); |
|
1353 | + $params[] = new ParamTag('additionalTablesFetch', ['string[]'], 'A list of additional tables to fetch (for performance improvement)'); |
|
1354 | 1354 | $parameters[] = (new ParameterGenerator('mode', '?int'))->setDefaultValue(null); |
1355 | - $params[] = new ParamTag('mode', [ 'int', 'null' ], 'Either TDBMService::MODE_ARRAY or TDBMService::MODE_CURSOR (for large datasets). Defaults to TDBMService::MODE_ARRAY.'); |
|
1356 | - $params[] = new ReturnTag([ '\\'.$beanNamespace.'\\'.$beanClassName.'[]', '\\'.ResultIterator::class ]); |
|
1355 | + $params[] = new ParamTag('mode', ['int', 'null'], 'Either TDBMService::MODE_ARRAY or TDBMService::MODE_CURSOR (for large datasets). Defaults to TDBMService::MODE_ARRAY.'); |
|
1356 | + $params[] = new ReturnTag(['\\'.$beanNamespace.'\\'.$beanClassName.'[]', '\\'.ResultIterator::class]); |
|
1357 | 1357 | $method->setReturnType('\\'.ResultIterator::class); |
1358 | 1358 | |
1359 | 1359 | $docBlock = new DocBlockGenerator("Get a list of $beanClassName filtered by ".implode(', ', $commentArguments).".", null, $params); |
@@ -1651,17 +1651,17 @@ discard block |
||
1651 | 1651 | * @param string $indent |
1652 | 1652 | * @return string |
1653 | 1653 | */ |
1654 | - private function psr2VarExport($var, string $indent=''): string |
|
1654 | + private function psr2VarExport($var, string $indent = ''): string |
|
1655 | 1655 | { |
1656 | 1656 | if (is_array($var)) { |
1657 | 1657 | $indexed = array_keys($var) === range(0, count($var) - 1); |
1658 | 1658 | $r = []; |
1659 | 1659 | foreach ($var as $key => $value) { |
1660 | 1660 | $r[] = "$indent " |
1661 | - . ($indexed ? '' : $this->psr2VarExport($key) . ' => ') |
|
1661 | + . ($indexed ? '' : $this->psr2VarExport($key).' => ') |
|
1662 | 1662 | . $this->psr2VarExport($value, "$indent "); |
1663 | 1663 | } |
1664 | - return "[\n" . implode(",\n", $r) . "\n" . $indent . ']'; |
|
1664 | + return "[\n".implode(",\n", $r)."\n".$indent.']'; |
|
1665 | 1665 | } |
1666 | 1666 | return var_export($var, true); |
1667 | 1667 | } |
@@ -85,11 +85,11 @@ discard block |
||
85 | 85 | |
86 | 86 | // Remove all beans and daos from junction tables |
87 | 87 | $junctionTables = $this->configuration->getSchemaAnalyzer()->detectJunctionTables(true); |
88 | - $junctionTableNames = array_map(function (Table $table) { |
|
88 | + $junctionTableNames = array_map(function(Table $table) { |
|
89 | 89 | return $table->getName(); |
90 | 90 | }, $junctionTables); |
91 | 91 | |
92 | - $tableList = array_filter($tableList, function (Table $table) use ($junctionTableNames) { |
|
92 | + $tableList = array_filter($tableList, function(Table $table) use ($junctionTableNames) { |
|
93 | 93 | return !in_array($table->getName(), $junctionTableNames, true); |
94 | 94 | }); |
95 | 95 | |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | $fileContent = $this->psr2Fix($fileContent); |
164 | 164 | // Add the declare strict-types directive |
165 | 165 | $commentEnd = strpos($fileContent, ' */') + 3; |
166 | - $fileContent = substr($fileContent, 0, $commentEnd) . "\n\ndeclare(strict_types=1);" . substr($fileContent, $commentEnd + 1); |
|
166 | + $fileContent = substr($fileContent, 0, $commentEnd)."\n\ndeclare(strict_types=1);".substr($fileContent, $commentEnd + 1); |
|
167 | 167 | |
168 | 168 | $this->dumpFile($possibleBaseFileName, $fileContent); |
169 | 169 | |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | $fileContent = $this->psr2Fix($fileContent); |
226 | 226 | // Add the declare strict-types directive |
227 | 227 | $commentEnd = strpos($fileContent, ' */') + 3; |
228 | - $fileContent = substr($fileContent, 0, $commentEnd) . "\n\ndeclare(strict_types=1);" . substr($fileContent, $commentEnd + 1); |
|
228 | + $fileContent = substr($fileContent, 0, $commentEnd)."\n\ndeclare(strict_types=1);".substr($fileContent, $commentEnd + 1); |
|
229 | 229 | |
230 | 230 | $this->dumpFile($possibleBaseFileName, $fileContent); |
231 | 231 | |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | |
310 | 310 | $constructorMethod = new MethodGenerator( |
311 | 311 | '__construct', |
312 | - [ new ParameterGenerator('container', ContainerInterface::class) ], |
|
312 | + [new ParameterGenerator('container', ContainerInterface::class)], |
|
313 | 313 | MethodGenerator::FLAG_PUBLIC, |
314 | 314 | '$this->container = $container;' |
315 | 315 | ); |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | |
326 | 326 | $daoInstanceProperty = new PropertyGenerator($daoInstanceName); |
327 | 327 | $daoInstanceProperty->setVisibility(AbstractMemberGenerator::VISIBILITY_PRIVATE); |
328 | - $daoInstanceProperty->setDocBlock(new DocBlockGenerator(null, null, [new VarTag(null, ['\\' . $daoNamespace . '\\' . $daoClassName, 'null'])])); |
|
328 | + $daoInstanceProperty->setDocBlock(new DocBlockGenerator(null, null, [new VarTag(null, ['\\'.$daoNamespace.'\\'.$daoClassName, 'null'])])); |
|
329 | 329 | $class->addPropertyFromGenerator($daoInstanceProperty); |
330 | 330 | |
331 | 331 | $fullClassNameVarExport = var_export($daoNamespace.'\\'.$daoClassName, true); |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | BODY; |
339 | 339 | |
340 | 340 | $getterMethod = new MethodGenerator( |
341 | - 'get' . $daoClassName, |
|
341 | + 'get'.$daoClassName, |
|
342 | 342 | [], |
343 | 343 | MethodGenerator::FLAG_PUBLIC, |
344 | 344 | $getterBody |
@@ -350,10 +350,10 @@ discard block |
||
350 | 350 | } |
351 | 351 | |
352 | 352 | $setterMethod = new MethodGenerator( |
353 | - 'set' . $daoClassName, |
|
354 | - [new ParameterGenerator($daoInstanceName, '\\' . $daoNamespace . '\\' . $daoClassName)], |
|
353 | + 'set'.$daoClassName, |
|
354 | + [new ParameterGenerator($daoInstanceName, '\\'.$daoNamespace.'\\'.$daoClassName)], |
|
355 | 355 | MethodGenerator::FLAG_PUBLIC, |
356 | - '$this->' . $daoInstanceName . ' = $' . $daoInstanceName . ';' |
|
356 | + '$this->'.$daoInstanceName.' = $'.$daoInstanceName.';' |
|
357 | 357 | ); |
358 | 358 | $setterMethod->setReturnType('void'); |
359 | 359 | $setterMethod = $this->configuration->getCodeGeneratorListener()->onDaoFactorySetterGenerated($setterMethod, $beanDescriptor, $this->configuration, $class); |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | $fileContent = $this->psr2Fix($fileContent); |
374 | 374 | // Add the declare strict-types directive |
375 | 375 | $commentEnd = strpos($fileContent, ' */') + 3; |
376 | - $fileContent = substr($fileContent, 0, $commentEnd) . "\n\ndeclare(strict_types=1);" . substr($fileContent, $commentEnd + 1); |
|
376 | + $fileContent = substr($fileContent, 0, $commentEnd)."\n\ndeclare(strict_types=1);".substr($fileContent, $commentEnd + 1); |
|
377 | 377 | |
378 | 378 | $this->dumpFile($possibleFileName, $fileContent); |
379 | 379 | } |
@@ -476,7 +476,7 @@ discard block |
||
476 | 476 | $map = [ |
477 | 477 | Type::TARRAY => 'array', |
478 | 478 | Type::SIMPLE_ARRAY => 'array', |
479 | - 'json' => 'array', // 'json' is supported from Doctrine DBAL 2.6 only. |
|
479 | + 'json' => 'array', // 'json' is supported from Doctrine DBAL 2.6 only. |
|
480 | 480 | Type::JSON_ARRAY => 'array', |
481 | 481 | Type::BIGINT => 'string', |
482 | 482 | Type::BOOLEAN => 'bool', |
@@ -51,9 +51,9 @@ |
||
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->getSchemaAnalyzer(), |
58 | 58 | $this->schema, |
59 | 59 | $this->tdbmSchemaAnalyzer, |
@@ -40,7 +40,7 @@ |
||
40 | 40 | $alteredConf = new AlteredConfiguration($this->configuration); |
41 | 41 | |
42 | 42 | |
43 | - $loggers = [ new ConsoleLogger($output) ]; |
|
43 | + $loggers = [new ConsoleLogger($output)]; |
|
44 | 44 | |
45 | 45 | $logger = $alteredConf->getLogger(); |
46 | 46 | if ($logger) { |
@@ -252,7 +252,7 @@ |
||
252 | 252 | */ |
253 | 253 | public function jsonSerialize($stopRecursion = false) |
254 | 254 | { |
255 | - return array_map(function (AbstractTDBMObject $item) use ($stopRecursion) { |
|
255 | + return array_map(function(AbstractTDBMObject $item) use ($stopRecursion) { |
|
256 | 256 | return $item->jsonSerialize($stopRecursion); |
257 | 257 | }, $this->toArray()); |
258 | 258 | } |
@@ -105,17 +105,17 @@ discard block |
||
105 | 105 | $schemaAnalyzer = new SchemaAnalyzer($schemaManager); |
106 | 106 | $tdbmSchemaAnalyzer = new TDBMSchemaAnalyzer($this->tdbmService->getConnection(), new ArrayCache(), $schemaAnalyzer); |
107 | 107 | $this->tdbmDaoGenerator = new TDBMDaoGenerator($this->getConfiguration(), $tdbmSchemaAnalyzer); |
108 | - $this->rootPath = __DIR__ . '/../'; |
|
108 | + $this->rootPath = __DIR__.'/../'; |
|
109 | 109 | //$this->tdbmDaoGenerator->setComposerFile($this->rootPath.'composer.json'); |
110 | 110 | } |
111 | 111 | |
112 | 112 | public function testDaoGeneration(): void |
113 | 113 | { |
114 | 114 | // Remove all previously generated files. |
115 | - $this->recursiveDelete($this->rootPath . 'src/Test/Dao/'); |
|
116 | - mkdir($this->rootPath . 'src/Test/Dao/Generated', 0755, true); |
|
115 | + $this->recursiveDelete($this->rootPath.'src/Test/Dao/'); |
|
116 | + mkdir($this->rootPath.'src/Test/Dao/Generated', 0755, true); |
|
117 | 117 | // Let's generate a dummy file to see it is indeed removed. |
118 | - $dummyFile = $this->rootPath . 'src/Test/Dao/Generated/foobar.php'; |
|
118 | + $dummyFile = $this->rootPath.'src/Test/Dao/Generated/foobar.php'; |
|
119 | 119 | touch($dummyFile); |
120 | 120 | $this->assertFileExists($dummyFile); |
121 | 121 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | |
126 | 126 | // Let's require all files to check they are valid PHP! |
127 | 127 | // Test the daoFactory |
128 | - require_once $this->rootPath . 'src/Test/Dao/Generated/DaoFactory.php'; |
|
128 | + require_once $this->rootPath.'src/Test/Dao/Generated/DaoFactory.php'; |
|
129 | 129 | // Test the others |
130 | 130 | |
131 | 131 | $beanDescriptors = $this->getDummyGeneratorListener()->getBeanDescriptors(); |
@@ -135,10 +135,10 @@ discard block |
||
135 | 135 | $daoBaseName = $beanDescriptor->getBaseDaoClassName(); |
136 | 136 | $beanName = $beanDescriptor->getBeanClassName(); |
137 | 137 | $baseBeanName = $beanDescriptor->getBaseBeanClassName(); |
138 | - require_once $this->rootPath . 'src/Test/Dao/Bean/Generated/' . $baseBeanName . '.php'; |
|
139 | - require_once $this->rootPath . 'src/Test/Dao/Bean/' . $beanName . '.php'; |
|
140 | - require_once $this->rootPath . 'src/Test/Dao/Generated/' . $daoBaseName . '.php'; |
|
141 | - require_once $this->rootPath . 'src/Test/Dao/' . $daoName . '.php'; |
|
138 | + require_once $this->rootPath.'src/Test/Dao/Bean/Generated/'.$baseBeanName.'.php'; |
|
139 | + require_once $this->rootPath.'src/Test/Dao/Bean/'.$beanName.'.php'; |
|
140 | + require_once $this->rootPath.'src/Test/Dao/Generated/'.$daoBaseName.'.php'; |
|
141 | + require_once $this->rootPath.'src/Test/Dao/'.$daoName.'.php'; |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | // Check that pivot tables do not generate DAOs or beans. |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | $schemaAnalyzer = new SchemaAnalyzer($schemaManager); |
154 | 154 | $tdbmSchemaAnalyzer = new TDBMSchemaAnalyzer($this->tdbmService->getConnection(), new ArrayCache(), $schemaAnalyzer); |
155 | 155 | $tdbmDaoGenerator = new TDBMDaoGenerator($configuration, $tdbmSchemaAnalyzer); |
156 | - $this->rootPath = __DIR__ . '/../../../../'; |
|
156 | + $this->rootPath = __DIR__.'/../../../../'; |
|
157 | 157 | //$tdbmDaoGenerator->setComposerFile($this->rootPath.'composer.json'); |
158 | 158 | |
159 | 159 | $this->expectException(NoPathFoundException::class); |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | if (is_file($str)) { |
172 | 172 | return @unlink($str); |
173 | 173 | } elseif (is_dir($str)) { |
174 | - $scan = glob(rtrim($str, '/') . '/*'); |
|
174 | + $scan = glob(rtrim($str, '/').'/*'); |
|
175 | 175 | foreach ($scan as $index => $path) { |
176 | 176 | $this->recursiveDelete($path); |
177 | 177 | } |
@@ -1984,7 +1984,7 @@ discard block |
||
1984 | 1984 | { |
1985 | 1985 | $artists = new ArtistDao($this->tdbmService); |
1986 | 1986 | $pinkFloyd = $artists->getById(1); |
1987 | - $animals = $pinkFloyd->getAlbums()[0]; |
|
1987 | + $animals = $pinkFloyd->getAlbums()[0]; |
|
1988 | 1988 | $json = $pinkFloyd->jsonSerialize(); |
1989 | 1989 | // Collection name properly handled ('discography' instead of default 'albums') |
1990 | 1990 | self::assertTrue(isset($json['discography'])); |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | */ |
68 | 68 | public function getParamAnnotation(): ParamTag |
69 | 69 | { |
70 | - return new ParamTag($this->getSafeVariableName(), [ $this->getPhpType() ]); |
|
70 | + return new ParamTag($this->getSafeVariableName(), [$this->getPhpType()]); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | public function getVariableName(): string |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | |
78 | 78 | public function getSafeVariableName(): string |
79 | 79 | { |
80 | - return '$' . StringUtils::getValidVariableName(ltrim($this->getVariableName(), '$')); |
|
80 | + return '$'.StringUtils::getValidVariableName(ltrim($this->getVariableName(), '$')); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | public function getSetterName(): string |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | */ |
88 | 88 | public function getPhpType(): string |
89 | 89 | { |
90 | - return '\\' . $this->beanNamespace . '\\' . $this->getClassName(); |
|
90 | + return '\\'.$this->beanNamespace.'\\'.$this->getClassName(); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | /** |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | $referencedBeanName = $this->namingStrategy->getBeanClassName($this->foreignKey->getForeignTableName()); |
161 | 161 | |
162 | 162 | $getter = new MethodGenerator($getterName); |
163 | - $getter->setDocBlock(new DocBlockGenerator('Returns the ' . $referencedBeanName . ' object bound to this object via the ' . implode(' and ', $this->foreignKey->getUnquotedLocalColumns()) . ' column.')); |
|
163 | + $getter->setDocBlock(new DocBlockGenerator('Returns the '.$referencedBeanName.' object bound to this object via the '.implode(' and ', $this->foreignKey->getUnquotedLocalColumns()).' column.')); |
|
164 | 164 | |
165 | 165 | /*$types = [ $referencedBeanName ]; |
166 | 166 | if ($isNullable) { |
@@ -168,23 +168,23 @@ discard block |
||
168 | 168 | } |
169 | 169 | $getter->getDocBlock()->setTag(new ReturnTag($types));*/ |
170 | 170 | |
171 | - $getter->setReturnType(($isNullable ? '?' : '') . $this->beanNamespace . '\\' . $referencedBeanName); |
|
171 | + $getter->setReturnType(($isNullable ? '?' : '').$this->beanNamespace.'\\'.$referencedBeanName); |
|
172 | 172 | $tdbmFk = ForeignKey::createFromFk($this->foreignKey); |
173 | 173 | |
174 | - $getter->setBody('return $this->getRef(' . var_export($tdbmFk->getCacheKey(), true) . ', ' . var_export($tableName, true) . ');'); |
|
174 | + $getter->setBody('return $this->getRef('.var_export($tdbmFk->getCacheKey(), true).', '.var_export($tableName, true).');'); |
|
175 | 175 | |
176 | 176 | if ($this->isGetterProtected()) { |
177 | 177 | $getter->setVisibility(AbstractMemberGenerator::VISIBILITY_PROTECTED); |
178 | 178 | } |
179 | 179 | |
180 | 180 | $setter = new MethodGenerator($setterName); |
181 | - $setter->setDocBlock(new DocBlockGenerator('The setter for the ' . $referencedBeanName . ' object bound to this object via the ' . implode(' and ', $this->foreignKey->getUnquotedLocalColumns()) . ' column.')); |
|
181 | + $setter->setDocBlock(new DocBlockGenerator('The setter for the '.$referencedBeanName.' object bound to this object via the '.implode(' and ', $this->foreignKey->getUnquotedLocalColumns()).' column.')); |
|
182 | 182 | |
183 | - $setter->setParameter(new ParameterGenerator('object', ($isNullable ? '?' : '') . $this->beanNamespace . '\\' . $referencedBeanName)); |
|
183 | + $setter->setParameter(new ParameterGenerator('object', ($isNullable ? '?' : '').$this->beanNamespace.'\\'.$referencedBeanName)); |
|
184 | 184 | |
185 | 185 | $setter->setReturnType('void'); |
186 | 186 | |
187 | - $setter->setBody('$this->setRef(' . var_export($tdbmFk->getCacheKey(), true) . ', $object, ' . var_export($tableName, true) . ');'); |
|
187 | + $setter->setBody('$this->setRef('.var_export($tdbmFk->getCacheKey(), true).', $object, '.var_export($tableName, true).');'); |
|
188 | 188 | |
189 | 189 | if ($this->isSetterProtected()) { |
190 | 190 | $setter->setVisibility(AbstractMemberGenerator::VISIBILITY_PROTECTED); |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | /** @var Annotation\JsonFormat|null $jsonFormat */ |
221 | 221 | $jsonFormat = $this->findAnnotation(Annotation\JsonFormat::class); |
222 | 222 | if ($jsonFormat !== null) { |
223 | - $method = $jsonFormat->method ?? 'get' . ucfirst($jsonFormat->property); |
|
223 | + $method = $jsonFormat->method ?? 'get'.ucfirst($jsonFormat->property); |
|
224 | 224 | $format = "$method()"; |
225 | 225 | } else { |
226 | 226 | $stopRecursion = $this->findAnnotation(Annotation\JsonRecursive::class) ? '' : 'true'; |
@@ -277,10 +277,10 @@ discard block |
||
277 | 277 | } elseif ($descriptor instanceof ScalarBeanPropertyDescriptor) { |
278 | 278 | $rows[] = "'$indexName' => $propertyAccess->$columnGetterName()"; |
279 | 279 | } else { |
280 | - throw new TDBMException('PropertyDescriptor of class `' . get_class($descriptor) . '` cannot be serialized.'); |
|
280 | + throw new TDBMException('PropertyDescriptor of class `'.get_class($descriptor).'` cannot be serialized.'); |
|
281 | 281 | } |
282 | 282 | } |
283 | - return '[' . implode(', ', $rows) . ']'; |
|
283 | + return '['.implode(', ', $rows).']'; |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | private function getBeanPropertyDescriptor(string $column): AbstractBeanPropertyDescriptor |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | return $descriptor; |
294 | 294 | } |
295 | 295 | } |
296 | - throw new TDBMException('PropertyDescriptor for `'.$this->table->getName().'`.`' . $column . '` not found in `' . $this->foreignBeanDescriptor->getTable()->getName() . '`'); |
|
296 | + throw new TDBMException('PropertyDescriptor for `'.$this->table->getName().'`.`'.$column.'` not found in `'.$this->foreignBeanDescriptor->getTable()->getName().'`'); |
|
297 | 297 | } |
298 | 298 | |
299 | 299 | /** |
@@ -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']); |