@@ -454,7 +454,7 @@ discard block |
||
454 | 454 | { |
455 | 455 | $beans = $this->tdbmService->findObjects('person', null, [], 'person.id ASC', [], null, TDBMObject::class, ResultIterator::class); |
456 | 456 | |
457 | - $results = $beans->map(function ($item) { |
|
457 | + $results = $beans->map(function($item) { |
|
458 | 458 | return $item->getProperty('id', 'person'); |
459 | 459 | })->toArray(); |
460 | 460 | |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | // Same test with page |
464 | 464 | $page = $beans->take(0, 2); |
465 | 465 | |
466 | - $results = $page->map(function ($item) { |
|
466 | + $results = $page->map(function($item) { |
|
467 | 467 | return $item->getProperty('id', 'person'); |
468 | 468 | })->toArray(); |
469 | 469 | |
@@ -843,7 +843,7 @@ discard block |
||
843 | 843 | public function testFindObjectsMethodWithoutResultIteratorClass(): void |
844 | 844 | { |
845 | 845 | $this->expectException(TDBMInvalidArgumentException::class); |
846 | - $this->expectExceptionMessageMatches('/^\$resultIteratorClass should be a `' . preg_quote(ResultIterator::class, '/') . '`. `(.*)` provided\.$/'); |
|
846 | + $this->expectExceptionMessageMatches('/^\$resultIteratorClass should be a `'.preg_quote(ResultIterator::class, '/').'`. `(.*)` provided\.$/'); |
|
847 | 847 | $tdbmService = new TDBMService(new Configuration('TheCodingMachine\\TDBM\\Test\\Dao\\Bean', 'TheCodingMachine\\TDBM\\Test\\Dao', self::getConnection(), $this->getNamingStrategy(), null, null, new NullLogger())); |
848 | 848 | |
849 | 849 | $tdbmService->findObjects('', null, [], null, [], null, null, self::class); |
@@ -852,7 +852,7 @@ discard block |
||
852 | 852 | public function testFindObjectsFromSqlMethodWithoutResultIteratorClass(): void |
853 | 853 | { |
854 | 854 | $this->expectException(TDBMInvalidArgumentException::class); |
855 | - $this->expectExceptionMessageMatches('/^\$resultIteratorClass should be a `' . preg_quote(ResultIterator::class, '/') . '`. `(.*)` provided\.$/'); |
|
855 | + $this->expectExceptionMessageMatches('/^\$resultIteratorClass should be a `'.preg_quote(ResultIterator::class, '/').'`. `(.*)` provided\.$/'); |
|
856 | 856 | $tdbmService = new TDBMService(new Configuration('TheCodingMachine\\TDBM\\Test\\Dao\\Bean', 'TheCodingMachine\\TDBM\\Test\\Dao', self::getConnection(), $this->getNamingStrategy(), null, null, new NullLogger())); |
857 | 857 | |
858 | 858 | $tdbmService->findObjectsFromSql('', '', null, [], null, null, null, self::class); |
@@ -861,7 +861,7 @@ discard block |
||
861 | 861 | public function testFindObjectsFromRawSqlMethodWithoutResultIteratorClass(): void |
862 | 862 | { |
863 | 863 | $this->expectException(TDBMInvalidArgumentException::class); |
864 | - $this->expectExceptionMessageMatches('/^\$resultIteratorClass should be a `' . preg_quote(ResultIterator::class, '/') . '`. `(.*)` provided\.$/'); |
|
864 | + $this->expectExceptionMessageMatches('/^\$resultIteratorClass should be a `'.preg_quote(ResultIterator::class, '/').'`. `(.*)` provided\.$/'); |
|
865 | 865 | $tdbmService = new TDBMService(new Configuration('TheCodingMachine\\TDBM\\Test\\Dao\\Bean', 'TheCodingMachine\\TDBM\\Test\\Dao', self::getConnection(), $this->getNamingStrategy(), null, null, new NullLogger())); |
866 | 866 | |
867 | 867 | $tdbmService->findObjectsFromRawSql('', '', [], null, null, null, self::class); |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | |
254 | 254 | protected function setRef(string $foreignKeyName, ?AbstractTDBMObject $bean, string $tableName, string $className, string $resultIteratorClass): void |
255 | 255 | { |
256 | - assert($bean === null || is_a($bean, $className), new TDBMInvalidArgumentException('$bean should be `null` or `' . $className . '`. `' . ($bean === null ? 'null' : get_class($bean)) . '` provided.')); |
|
256 | + assert($bean === null || is_a($bean, $className), new TDBMInvalidArgumentException('$bean should be `null` or `'.$className.'`. `'.($bean === null ? 'null' : get_class($bean)).'` provided.')); |
|
257 | 257 | |
258 | 258 | if (!isset($this->dbRows[$tableName])) { |
259 | 259 | $this->registerTable($tableName); |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | */ |
516 | 516 | protected function retrieveManyToOneRelationshipsStorage(string $tableName, string $foreignKeyName, array $searchFilter, ?string $orderString, string $resultIteratorClass) : AlterableResultIterator |
517 | 517 | { |
518 | - assert(is_a($resultIteratorClass, ResultIterator::class, true), new TDBMInvalidArgumentException('$resultIteratorClass should be a `'. ResultIterator::class. '`. `' . $resultIteratorClass . '` provided.')); |
|
518 | + assert(is_a($resultIteratorClass, ResultIterator::class, true), new TDBMInvalidArgumentException('$resultIteratorClass should be a `'.ResultIterator::class.'`. `'.$resultIteratorClass.'` provided.')); |
|
519 | 519 | $key = $tableName.'___'.$foreignKeyName; |
520 | 520 | $alterableResultIterator = $this->getManyToOneAlterableResultIterator($tableName, $foreignKeyName); |
521 | 521 | if ($this->status === TDBMObjectStateEnum::STATE_DETACHED || $this->status === TDBMObjectStateEnum::STATE_NEW || (isset($this->manyToOneRelationships[$key]) && $this->manyToOneRelationships[$key]->getUnderlyingResultIterator() !== null)) { |
@@ -377,8 +377,8 @@ discard block |
||
377 | 377 | null, |
378 | 378 | [], |
379 | 379 | null, |
380 | - $this->beanNamespace . '\\' . $this->namingStrategy->getBeanClassName($localTableName), |
|
381 | - $this->resultIteratorNamespace . '\\' . $this->namingStrategy->getResultIteratorClassName($localTableName) |
|
380 | + $this->beanNamespace.'\\'.$this->namingStrategy->getBeanClassName($localTableName), |
|
381 | + $this->resultIteratorNamespace.'\\'.$this->namingStrategy->getResultIteratorClassName($localTableName) |
|
382 | 382 | ); |
383 | 383 | |
384 | 384 | foreach ($results as $bean) { |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | } |
438 | 438 | } |
439 | 439 | |
440 | - return ['(' . implode(') AND (', $sqlParts) . ')', $parameters, $counter]; |
|
440 | + return ['('.implode(') AND (', $sqlParts).')', $parameters, $counter]; |
|
441 | 441 | } elseif ($filter_bag instanceof ResultIterator) { |
442 | 442 | $subQuery = $filter_bag->_getSubQuery(); |
443 | 443 | return [$subQuery, [], $counter]; |
@@ -1015,7 +1015,7 @@ discard block |
||
1015 | 1015 | |
1016 | 1016 | return $this->fromCache( |
1017 | 1017 | $this->cachePrefix.'_linkbetweeninheritedtables_'.implode('__split__', $tables), |
1018 | - function () use ($tables) { |
|
1018 | + function() use ($tables) { |
|
1019 | 1019 | return $this->_getLinkBetweenInheritedTablesWithoutCache($tables); |
1020 | 1020 | } |
1021 | 1021 | ); |
@@ -1063,7 +1063,7 @@ discard block |
||
1063 | 1063 | */ |
1064 | 1064 | public function _getRelatedTablesByInheritance(string $table): array |
1065 | 1065 | { |
1066 | - return $this->fromCache($this->cachePrefix.'_relatedtables_'.$table, function () use ($table) { |
|
1066 | + return $this->fromCache($this->cachePrefix.'_relatedtables_'.$table, function() use ($table) { |
|
1067 | 1067 | return $this->_getRelatedTablesByInheritanceWithoutCache($table); |
1068 | 1068 | }); |
1069 | 1069 | } |
@@ -1152,7 +1152,7 @@ discard block |
||
1152 | 1152 | public function findObjects(string $mainTable, $filter, array $parameters, $orderString, array $additionalTablesFetch, ?int $mode, ?string $className, string $resultIteratorClass): ResultIterator |
1153 | 1153 | { |
1154 | 1154 | if (!is_a($resultIteratorClass, ResultIterator::class, true)) { |
1155 | - throw new TDBMInvalidArgumentException('$resultIteratorClass should be a `'. ResultIterator::class. '`. `' . $resultIteratorClass . '` provided.'); |
|
1155 | + throw new TDBMInvalidArgumentException('$resultIteratorClass should be a `'.ResultIterator::class.'`. `'.$resultIteratorClass.'` provided.'); |
|
1156 | 1156 | } |
1157 | 1157 | // $mainTable is not secured in MagicJoin, let's add a bit of security to avoid SQL injection. |
1158 | 1158 | if (!preg_match('/^[a-zA-Z_][a-zA-Z0-9_]*$/', $mainTable)) { |
@@ -1189,7 +1189,7 @@ discard block |
||
1189 | 1189 | public function findObjectsFromSql(string $mainTable, string $from, $filter, array $parameters, $orderString, ?int $mode, ?string $className, string $resultIteratorClass): ResultIterator |
1190 | 1190 | { |
1191 | 1191 | if (!is_a($resultIteratorClass, ResultIterator::class, true)) { |
1192 | - throw new TDBMInvalidArgumentException('$resultIteratorClass should be a `'. ResultIterator::class. '`. `' . $resultIteratorClass . '` provided.'); |
|
1192 | + throw new TDBMInvalidArgumentException('$resultIteratorClass should be a `'.ResultIterator::class.'`. `'.$resultIteratorClass.'` provided.'); |
|
1193 | 1193 | } |
1194 | 1194 | // $mainTable is not secured in MagicJoin, let's add a bit of security to avoid SQL injection. |
1195 | 1195 | if (!preg_match('/^[a-zA-Z_][a-zA-Z0-9_]*$/', $mainTable)) { |
@@ -1222,8 +1222,8 @@ discard block |
||
1222 | 1222 | */ |
1223 | 1223 | public function findObjectByPk(string $table, array $primaryKeys, array $additionalTablesFetch, bool $lazy, string $className, string $resultIteratorClass): AbstractTDBMObject |
1224 | 1224 | { |
1225 | - assert(is_a($resultIteratorClass, ResultIterator::class, true), new TDBMInvalidArgumentException('$resultIteratorClass should be a `'. ResultIterator::class. '`. `' . $resultIteratorClass . '` provided.')); |
|
1226 | - assert(is_a($className, AbstractTDBMObject::class, true), new TDBMInvalidArgumentException('$className should be a `'. AbstractTDBMObject::class. '`. `' . $className . '` provided.')); |
|
1225 | + assert(is_a($resultIteratorClass, ResultIterator::class, true), new TDBMInvalidArgumentException('$resultIteratorClass should be a `'.ResultIterator::class.'`. `'.$resultIteratorClass.'` provided.')); |
|
1226 | + assert(is_a($className, AbstractTDBMObject::class, true), new TDBMInvalidArgumentException('$className should be a `'.AbstractTDBMObject::class.'`. `'.$className.'` provided.')); |
|
1227 | 1227 | $primaryKeys = $this->_getPrimaryKeysFromObjectData($table, $primaryKeys); |
1228 | 1228 | $hash = $this->getObjectHash($primaryKeys); |
1229 | 1229 | |
@@ -1279,7 +1279,7 @@ discard block |
||
1279 | 1279 | */ |
1280 | 1280 | public function findObject(string $mainTable, $filter, array $parameters, array $additionalTablesFetch, string $className, string $resultIteratorClass) : ?AbstractTDBMObject |
1281 | 1281 | { |
1282 | - assert(is_a($resultIteratorClass, ResultIterator::class, true), new TDBMInvalidArgumentException('$resultIteratorClass should be a `'. ResultIterator::class. '`. `' . $resultIteratorClass . '` provided.')); |
|
1282 | + assert(is_a($resultIteratorClass, ResultIterator::class, true), new TDBMInvalidArgumentException('$resultIteratorClass should be a `'.ResultIterator::class.'`. `'.$resultIteratorClass.'` provided.')); |
|
1283 | 1283 | $objects = $this->findObjects($mainTable, $filter, $parameters, null, $additionalTablesFetch, self::MODE_ARRAY, $className, $resultIteratorClass); |
1284 | 1284 | return $this->getAtMostOneObjectOrFail($objects, $mainTable, $filter, $parameters); |
1285 | 1285 | } |
@@ -1301,18 +1301,18 @@ discard block |
||
1301 | 1301 | if ($count > 1) { |
1302 | 1302 | $additionalErrorInfos = ''; |
1303 | 1303 | if (is_string($filter) && !empty($parameters)) { |
1304 | - $additionalErrorInfos = ' for filter "' . $filter.'"'; |
|
1304 | + $additionalErrorInfos = ' for filter "'.$filter.'"'; |
|
1305 | 1305 | foreach ($parameters as $fieldName => $parameter) { |
1306 | 1306 | if (is_array($parameter)) { |
1307 | - $value = '(' . implode(',', $parameter) . ')'; |
|
1307 | + $value = '('.implode(',', $parameter).')'; |
|
1308 | 1308 | } else { |
1309 | 1309 | $value = $parameter; |
1310 | 1310 | } |
1311 | - $additionalErrorInfos = str_replace(':' . $fieldName, var_export($value, true), $additionalErrorInfos); |
|
1311 | + $additionalErrorInfos = str_replace(':'.$fieldName, var_export($value, true), $additionalErrorInfos); |
|
1312 | 1312 | } |
1313 | 1313 | } |
1314 | 1314 | $additionalErrorInfos .= '.'; |
1315 | - throw new DuplicateRowException("Error while querying an object in table '$mainTable': More than 1 row have been returned, but we should have received at most one" . $additionalErrorInfos); |
|
1315 | + throw new DuplicateRowException("Error while querying an object in table '$mainTable': More than 1 row have been returned, but we should have received at most one".$additionalErrorInfos); |
|
1316 | 1316 | } elseif ($count === 0) { |
1317 | 1317 | return null; |
1318 | 1318 | } |
@@ -1335,7 +1335,7 @@ discard block |
||
1335 | 1335 | */ |
1336 | 1336 | public function findObjectFromSql(string $mainTable, string $from, $filter, array $parameters, ?string $className, string $resultIteratorClass) : ?AbstractTDBMObject |
1337 | 1337 | { |
1338 | - assert(is_a($resultIteratorClass, ResultIterator::class, true), new TDBMInvalidArgumentException('$resultIteratorClass should be a `'. ResultIterator::class. '`. `' . $resultIteratorClass . '` provided.')); |
|
1338 | + assert(is_a($resultIteratorClass, ResultIterator::class, true), new TDBMInvalidArgumentException('$resultIteratorClass should be a `'.ResultIterator::class.'`. `'.$resultIteratorClass.'` provided.')); |
|
1339 | 1339 | $objects = $this->findObjectsFromSql($mainTable, $from, $filter, $parameters, null, self::MODE_ARRAY, $className, $resultIteratorClass); |
1340 | 1340 | return $this->getAtMostOneObjectOrFail($objects, $mainTable, $filter, $parameters); |
1341 | 1341 | } |
@@ -1356,7 +1356,7 @@ discard block |
||
1356 | 1356 | public function findObjectsFromRawSql(string $mainTable, string $sql, array $parameters, ?int $mode, ?string $className, ?string $sqlCount, string $resultIteratorClass): ResultIterator |
1357 | 1357 | { |
1358 | 1358 | if (!is_a($resultIteratorClass, ResultIterator::class, true)) { |
1359 | - throw new TDBMInvalidArgumentException('$resultIteratorClass should be a `'. ResultIterator::class. '`. `' . $resultIteratorClass . '` provided.'); |
|
1359 | + throw new TDBMInvalidArgumentException('$resultIteratorClass should be a `'.ResultIterator::class.'`. `'.$resultIteratorClass.'` provided.'); |
|
1360 | 1360 | } |
1361 | 1361 | // $mainTable is not secured in MagicJoin, let's add a bit of security to avoid SQL injection. |
1362 | 1362 | if (!preg_match('/^[a-zA-Z_][a-zA-Z0-9_]*$/', $mainTable)) { |
@@ -1386,7 +1386,7 @@ discard block |
||
1386 | 1386 | */ |
1387 | 1387 | public function findObjectOrFail(string $mainTable, $filter, array $parameters, array $additionalTablesFetch, string $className, string $resultIteratorClass): AbstractTDBMObject |
1388 | 1388 | { |
1389 | - assert(is_a($resultIteratorClass, ResultIterator::class, true), new TDBMInvalidArgumentException('$resultIteratorClass should be a `'. ResultIterator::class. '`. `' . $resultIteratorClass . '` provided.')); |
|
1389 | + assert(is_a($resultIteratorClass, ResultIterator::class, true), new TDBMInvalidArgumentException('$resultIteratorClass should be a `'.ResultIterator::class.'`. `'.$resultIteratorClass.'` provided.')); |
|
1390 | 1390 | $bean = $this->findObject($mainTable, $filter, $parameters, $additionalTablesFetch, $className, $resultIteratorClass); |
1391 | 1391 | if ($bean === null) { |
1392 | 1392 | throw NoBeanFoundException::missFilterRecord($mainTable); |
@@ -1496,7 +1496,7 @@ discard block |
||
1496 | 1496 | $table1 = $fks[0]->getForeignTableName(); |
1497 | 1497 | $table2 = $fks[1]->getForeignTableName(); |
1498 | 1498 | |
1499 | - $beanTables = array_map(function (DbRow $dbRow) { |
|
1499 | + $beanTables = array_map(function(DbRow $dbRow) { |
|
1500 | 1500 | return $dbRow->_getDbTableName(); |
1501 | 1501 | }, $bean->_getDbRows()); |
1502 | 1502 |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | */ |
216 | 216 | public function getConstructorProperties(): array |
217 | 217 | { |
218 | - $constructorProperties = array_filter($this->beanPropertyDescriptors, static function (AbstractBeanPropertyDescriptor $property) { |
|
218 | + $constructorProperties = array_filter($this->beanPropertyDescriptors, static function(AbstractBeanPropertyDescriptor $property) { |
|
219 | 219 | return !$property instanceof InheritanceReferencePropertyDescriptor && $property->isCompulsory() && !$property->isReadOnly(); |
220 | 220 | }); |
221 | 221 | |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | public function getPropertiesWithDefault(): array |
231 | 231 | { |
232 | 232 | $properties = $this->getPropertiesForTable($this->table); |
233 | - $defaultProperties = array_filter($properties, function (AbstractBeanPropertyDescriptor $property) { |
|
233 | + $defaultProperties = array_filter($properties, function(AbstractBeanPropertyDescriptor $property) { |
|
234 | 234 | return $property->hasDefault(); |
235 | 235 | }); |
236 | 236 | |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | */ |
245 | 245 | public function getExposedProperties(): array |
246 | 246 | { |
247 | - $exposedProperties = array_filter($this->beanPropertyDescriptors, function (AbstractBeanPropertyDescriptor $property) { |
|
247 | + $exposedProperties = array_filter($this->beanPropertyDescriptors, function(AbstractBeanPropertyDescriptor $property) { |
|
248 | 248 | return !$property instanceof InheritanceReferencePropertyDescriptor && $property->getTable()->getName() === $this->table->getName(); |
249 | 249 | }); |
250 | 250 | |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | foreach ($beanPropertyDescriptors as $beanDescriptor) { |
351 | 351 | $name = $beanDescriptor->getGetterName(); |
352 | 352 | if (isset($names[$name])) { |
353 | - throw new TDBMException('Unsolvable name conflict while generating method name "' . $name . '"'); |
|
353 | + throw new TDBMException('Unsolvable name conflict while generating method name "'.$name.'"'); |
|
354 | 354 | } else { |
355 | 355 | $names[$name] = $beanDescriptor; |
356 | 356 | } |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | $assigns[] = $property->assignToDefaultCode()."\n"; |
400 | 400 | } |
401 | 401 | |
402 | - $body = $parentConstructorCode . implode('', $assigns); |
|
402 | + $body = $parentConstructorCode.implode('', $assigns); |
|
403 | 403 | |
404 | 404 | $constructor->setBody($body); |
405 | 405 | |
@@ -473,7 +473,7 @@ discard block |
||
473 | 473 | $this->descriptorsByMethodName[$name][] = $descriptor; |
474 | 474 | $descriptors = $this->descriptorsByMethodName[$name]; |
475 | 475 | if (count($descriptors) > 1) { |
476 | - $properties = array_filter($descriptors, function ($descriptor) { |
|
476 | + $properties = array_filter($descriptors, function($descriptor) { |
|
477 | 477 | return $descriptor instanceof AbstractBeanPropertyDescriptor; |
478 | 478 | }); |
479 | 479 | $renameProperties = count($properties) > 1; |
@@ -524,7 +524,7 @@ discard block |
||
524 | 524 | foreach ($this->getExposedProperties() as $beanPropertyDescriptor) { |
525 | 525 | $propertyCode = $beanPropertyDescriptor->getJsonSerializeCode(); |
526 | 526 | if (!empty($propertyCode)) { |
527 | - $body .= PHP_EOL . $propertyCode; |
|
527 | + $body .= PHP_EOL.$propertyCode; |
|
528 | 528 | } |
529 | 529 | } |
530 | 530 | |
@@ -532,11 +532,11 @@ discard block |
||
532 | 532 | foreach ($this->getMethodDescriptors() as $methodDescriptor) { |
533 | 533 | $methodCode = $methodDescriptor->getJsonSerializeCode(); |
534 | 534 | if (!empty($methodCode)) { |
535 | - $body .= PHP_EOL . $methodCode; |
|
535 | + $body .= PHP_EOL.$methodCode; |
|
536 | 536 | } |
537 | 537 | } |
538 | 538 | |
539 | - $body .= PHP_EOL . 'return $array;'; |
|
539 | + $body .= PHP_EOL.'return $array;'; |
|
540 | 540 | |
541 | 541 | $method->setBody($body); |
542 | 542 | |
@@ -631,10 +631,10 @@ discard block |
||
631 | 631 | /** @var AddInterface[] $addInterfaceAnnotations */ |
632 | 632 | $addInterfaceAnnotations = $this->annotationParser->getTableAnnotations($this->table)->findAnnotations(AddInterface::class); |
633 | 633 | |
634 | - $interfaces = [ JsonSerializable::class ]; |
|
634 | + $interfaces = [JsonSerializable::class]; |
|
635 | 635 | foreach ($addInterfaceAnnotations as $annotation) { |
636 | 636 | /** @phpstan-var class-string $className */ |
637 | - $className = $annotation->getName(); |
|
637 | + $className = $annotation->getName(); |
|
638 | 638 | $interfaces[] = $className; |
639 | 639 | } |
640 | 640 | |
@@ -673,7 +673,7 @@ discard block |
||
673 | 673 | } |
674 | 674 | } elseif ($methodDescriptor instanceof PivotTableMethodsDescriptor) { |
675 | 675 | $pivotTableMethodsDescriptors[] = $methodDescriptor; |
676 | - [ $getter, $adder, $remover, $has, $setter ] = $methodDescriptor->getCode(); |
|
676 | + [$getter, $adder, $remover, $has, $setter] = $methodDescriptor->getCode(); |
|
677 | 677 | $methods = $this->codeGeneratorListener->onBaseBeanManyToManyGenerated($getter, $adder, $remover, $has, $setter, $methodDescriptor, $this, $this->configuration, $class); |
678 | 678 | foreach ($methods as $method) { |
679 | 679 | if ($method) { |
@@ -803,7 +803,7 @@ discard block |
||
803 | 803 | $interfaces = []; |
804 | 804 | foreach ($addInterfaceOnDaoAnnotations as $annotation) { |
805 | 805 | /** @phpstan-var class-string $className */ |
806 | - $className = $annotation->getName(); |
|
806 | + $className = $annotation->getName(); |
|
807 | 807 | $interfaces[] = $className; |
808 | 808 | } |
809 | 809 | |
@@ -825,7 +825,7 @@ discard block |
||
825 | 825 | |
826 | 826 | $constructorMethod = new MethodGenerator( |
827 | 827 | '__construct', |
828 | - [ new ParameterGenerator('tdbmService', TDBMService::class) ], |
|
828 | + [new ParameterGenerator('tdbmService', TDBMService::class)], |
|
829 | 829 | MethodGenerator::FLAG_PUBLIC, |
830 | 830 | '$this->tdbmService = $tdbmService;', |
831 | 831 | 'Sets the TDBM service used by this DAO.' |
@@ -837,7 +837,7 @@ discard block |
||
837 | 837 | |
838 | 838 | $saveMethod = new MethodGenerator( |
839 | 839 | 'save', |
840 | - [ new ParameterGenerator('obj', $beanClassName) ], |
|
840 | + [new ParameterGenerator('obj', $beanClassName)], |
|
841 | 841 | MethodGenerator::FLAG_PUBLIC, |
842 | 842 | '$this->tdbmService->save($obj);', |
843 | 843 | (new DocBlockGenerator( |
@@ -885,7 +885,7 @@ discard block |
||
885 | 885 | |
886 | 886 | foreach ($primaryKeyColumns as $primaryKeyColumn) { |
887 | 887 | if ($primaryKeyColumn === $lazyLoadingParameterName) { |
888 | - throw new TDBMException('Primary Column name `' . $lazyLoadingParameterName . '` is not allowed.'); |
|
888 | + throw new TDBMException('Primary Column name `'.$lazyLoadingParameterName.'` is not allowed.'); |
|
889 | 889 | } |
890 | 890 | $phpType = TDBMDaoGenerator::dbalTypeToPhpType($this->table->getColumn($primaryKeyColumn)->getType()); |
891 | 891 | $parameters[] = new ParameterGenerator($primaryKeyColumn, $phpType); |
@@ -901,7 +901,7 @@ discard block |
||
901 | 901 | 'getById', |
902 | 902 | $parameters, |
903 | 903 | MethodGenerator::FLAG_PUBLIC, |
904 | - "return \$this->tdbmService->findObjectByPk('$tableName', [" . implode(', ', $primaryKeyFilter) . "], [], \$$lazyLoadingParameterName, \\$beanClassName::class, \\$resultIteratorClass::class);", |
|
904 | + "return \$this->tdbmService->findObjectByPk('$tableName', [".implode(', ', $primaryKeyFilter)."], [], \$$lazyLoadingParameterName, \\$beanClassName::class, \\$resultIteratorClass::class);", |
|
905 | 905 | (new DocBlockGenerator( |
906 | 906 | "Get $beanClassWithoutNameSpace specified by its ID (its primary key).", |
907 | 907 | 'If the primary key does not exist, an exception is thrown.', |
@@ -1189,14 +1189,14 @@ discard block |
||
1189 | 1189 | $class->addUse(ResultIterator::class); |
1190 | 1190 | $class->setExtendedClass(ResultIterator::class); |
1191 | 1191 | } else { |
1192 | - $class->addUse($this->resultIteratorNamespace . '\\' . $extends); |
|
1192 | + $class->addUse($this->resultIteratorNamespace.'\\'.$extends); |
|
1193 | 1193 | $class->setExtendedClass($extends); |
1194 | 1194 | } |
1195 | 1195 | |
1196 | 1196 | $class->setDocBlock((new DocBlockGenerator( |
1197 | 1197 | "The $baseClassName class will iterate over results of $beanClassWithoutNameSpace class.", |
1198 | 1198 | null, |
1199 | - [new Tag\MethodTag('getIterator', ['\\' . $beanClassName . '[]'])] |
|
1199 | + [new Tag\MethodTag('getIterator', ['\\'.$beanClassName.'[]'])] |
|
1200 | 1200 | ))->setWordWrap(false)); |
1201 | 1201 | |
1202 | 1202 | $file = $this->codeGeneratorListener->onBaseResultIteratorGenerated($file, $this, $this->configuration); |
@@ -1252,7 +1252,7 @@ discard block |
||
1252 | 1252 | } |
1253 | 1253 | } |
1254 | 1254 | } |
1255 | - usort($methods, static function (MethodGenerator $methodA, MethodGenerator $methodB) { |
|
1255 | + usort($methods, static function(MethodGenerator $methodA, MethodGenerator $methodB) { |
|
1256 | 1256 | return $methodA->getName() <=> $methodB->getName(); |
1257 | 1257 | }); |
1258 | 1258 | |
@@ -1401,11 +1401,11 @@ discard block |
||
1401 | 1401 | |
1402 | 1402 | if ($index->isUnique()) { |
1403 | 1403 | $parameters[] = new ParameterGenerator('additionalTablesFetch', 'array', []); |
1404 | - $params[] = new ParamTag('additionalTablesFetch', [ 'string[]' ], 'A list of additional tables to fetch (for performance improvement)'); |
|
1405 | - $params[] = new ReturnTag([ '\\'.$beanNamespace.'\\'.$beanClassName, 'null' ]); |
|
1404 | + $params[] = new ParamTag('additionalTablesFetch', ['string[]'], 'A list of additional tables to fetch (for performance improvement)'); |
|
1405 | + $params[] = new ReturnTag(['\\'.$beanNamespace.'\\'.$beanClassName, 'null']); |
|
1406 | 1406 | $method->setReturnType('?\\'.$beanNamespace.'\\'.$beanClassName); |
1407 | 1407 | |
1408 | - $docBlock = new DocBlockGenerator("Get a $beanClassName filtered by ".implode(', ', $commentArguments). '.', null, $params); |
|
1408 | + $docBlock = new DocBlockGenerator("Get a $beanClassName filtered by ".implode(', ', $commentArguments).'.', null, $params); |
|
1409 | 1409 | $docBlock->setWordWrap(false); |
1410 | 1410 | |
1411 | 1411 | $body = "\$filter = [ |
@@ -1414,12 +1414,12 @@ discard block |
||
1414 | 1414 | "; |
1415 | 1415 | } else { |
1416 | 1416 | $parameters[] = (new ParameterGenerator('orderBy'))->setDefaultValue(null); |
1417 | - $params[] = new ParamTag('orderBy', [ 'mixed' ], 'The order string'); |
|
1417 | + $params[] = new ParamTag('orderBy', ['mixed'], 'The order string'); |
|
1418 | 1418 | $parameters[] = new ParameterGenerator('additionalTablesFetch', 'array', []); |
1419 | - $params[] = new ParamTag('additionalTablesFetch', [ 'string[]' ], 'A list of additional tables to fetch (for performance improvement)'); |
|
1419 | + $params[] = new ParamTag('additionalTablesFetch', ['string[]'], 'A list of additional tables to fetch (for performance improvement)'); |
|
1420 | 1420 | $parameters[] = (new ParameterGenerator('mode', '?int'))->setDefaultValue(null); |
1421 | - $params[] = new ParamTag('mode', [ 'int', 'null' ], 'Either TDBMService::MODE_ARRAY or TDBMService::MODE_CURSOR (for large datasets). Defaults to TDBMService::MODE_ARRAY.'); |
|
1422 | - $method->setReturnType($this->resultIteratorNamespace . '\\' . $this->getResultIteratorClassName()); |
|
1421 | + $params[] = new ParamTag('mode', ['int', 'null'], 'Either TDBMService::MODE_ARRAY or TDBMService::MODE_CURSOR (for large datasets). Defaults to TDBMService::MODE_ARRAY.'); |
|
1422 | + $method->setReturnType($this->resultIteratorNamespace.'\\'.$this->getResultIteratorClassName()); |
|
1423 | 1423 | |
1424 | 1424 | $docBlock = new DocBlockGenerator("Get a list of $beanClassName filtered by ".implode(', ', $commentArguments).".", null, $params); |
1425 | 1425 | $docBlock->setWordWrap(false); |
@@ -1479,8 +1479,8 @@ discard block |
||
1479 | 1479 | var_export($tdbmFk->getCacheKey(), true), |
1480 | 1480 | 'null', |
1481 | 1481 | var_export($this->table->getName(), true), |
1482 | - '\\' . $this->beanNamespace . '\\' . $this->namingStrategy->getBeanClassName($foreignTableName) . '::class', |
|
1483 | - '\\' . $this->resultIteratorNamespace . '\\' . $this->namingStrategy->getResultIteratorClassName($foreignTableName) . '::class' |
|
1482 | + '\\'.$this->beanNamespace.'\\'.$this->namingStrategy->getBeanClassName($foreignTableName).'::class', |
|
1483 | + '\\'.$this->resultIteratorNamespace.'\\'.$this->namingStrategy->getResultIteratorClassName($foreignTableName).'::class' |
|
1484 | 1484 | ); |
1485 | 1485 | } |
1486 | 1486 | } |
@@ -1754,17 +1754,17 @@ discard block |
||
1754 | 1754 | * @param string $indent |
1755 | 1755 | * @return string |
1756 | 1756 | */ |
1757 | - private function psr2VarExport($var, string $indent=''): string |
|
1757 | + private function psr2VarExport($var, string $indent = ''): string |
|
1758 | 1758 | { |
1759 | 1759 | if (is_array($var)) { |
1760 | 1760 | $indexed = array_keys($var) === range(0, count($var) - 1); |
1761 | 1761 | $r = []; |
1762 | 1762 | foreach ($var as $key => $value) { |
1763 | 1763 | $r[] = "$indent " |
1764 | - . ($indexed ? '' : $this->psr2VarExport($key) . ' => ') |
|
1764 | + . ($indexed ? '' : $this->psr2VarExport($key).' => ') |
|
1765 | 1765 | . $this->psr2VarExport($value, "$indent "); |
1766 | 1766 | } |
1767 | - return "[\n" . implode(",\n", $r) . "\n" . $indent . ']'; |
|
1767 | + return "[\n".implode(",\n", $r)."\n".$indent.']'; |
|
1768 | 1768 | } |
1769 | 1769 | return var_export($var, true); |
1770 | 1770 | } |