@@ -76,7 +76,7 @@ |
||
76 | 76 | if ($index->isUnique()) { |
77 | 77 | return 'findOneBy'.implode('And', $methodNameComponent); |
78 | 78 | } else { |
79 | - return 'findBy' . implode('And', $methodNameComponent); |
|
79 | + return 'findBy'.implode('And', $methodNameComponent); |
|
80 | 80 | } |
81 | 81 | } |
82 | 82 | } |
@@ -6,7 +6,7 @@ |
||
6 | 6 | { |
7 | 7 | public static function getValidVariableName(string $variableName): string |
8 | 8 | { |
9 | - return preg_replace_callback('/^(\d+)/', static function (array $match) { |
|
9 | + return preg_replace_callback('/^(\d+)/', static function(array $match) { |
|
10 | 10 | $f = new \NumberFormatter('en', \NumberFormatter::SPELLOUT); |
11 | 11 | $number = $f->format((int) $match[0]); |
12 | 12 | return preg_replace('/[^a-z]+/i', '_', $number); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | // Let's compute the COUNT. |
51 | 51 | $pkColumnNames = $this->tdbmService->getPrimaryKeyColumns($this->mainTable); |
52 | - $pkColumnNames = array_map(function ($pkColumn) use ($mySqlPlatform) { |
|
52 | + $pkColumnNames = array_map(function($pkColumn) use ($mySqlPlatform) { |
|
53 | 53 | return $mySqlPlatform->quoteIdentifier($this->mainTable).'.'.$mySqlPlatform->quoteIdentifier($pkColumn); |
54 | 54 | }, $pkColumnNames); |
55 | 55 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | */ |
114 | 114 | private function getParentRelationshipForeignKeys(string $tableName): array |
115 | 115 | { |
116 | - return $this->fromCache($this->cachePrefix.'_parentrelationshipfks_'.$tableName, function () use ($tableName) { |
|
116 | + return $this->fromCache($this->cachePrefix.'_parentrelationshipfks_'.$tableName, function() use ($tableName) { |
|
117 | 117 | return $this->getParentRelationshipForeignKeysWithoutCache($tableName); |
118 | 118 | }); |
119 | 119 | } |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | */ |
143 | 143 | private function getChildrenRelationshipForeignKeys(string $tableName) : array |
144 | 144 | { |
145 | - return $this->fromCache($this->cachePrefix.'_childrenrelationshipfks_'.$tableName, function () use ($tableName) { |
|
145 | + return $this->fromCache($this->cachePrefix.'_childrenrelationshipfks_'.$tableName, function() use ($tableName) { |
|
146 | 146 | return $this->getChildrenRelationshipForeignKeysWithoutCache($tableName); |
147 | 147 | }); |
148 | 148 | } |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | $children = $this->schemaAnalyzer->getChildrenRelationships($tableName); |
158 | 158 | |
159 | 159 | if (!empty($children)) { |
160 | - $fksTables = array_map(function (ForeignKeyConstraint $fk) { |
|
160 | + $fksTables = array_map(function(ForeignKeyConstraint $fk) { |
|
161 | 161 | return $this->getChildrenRelationshipForeignKeys($fk->getLocalTableName()); |
162 | 162 | }, $children); |
163 | 163 |
@@ -207,7 +207,7 @@ |
||
207 | 207 | if (strlen($alias) <= 30) { // Older oracle version had a limit of 30 characters for identifiers |
208 | 208 | return $alias; |
209 | 209 | } |
210 | - return substr($columnName, 0, 20) . crc32($tableName.'____'.$columnName); |
|
210 | + return substr($columnName, 0, 20).crc32($tableName.'____'.$columnName); |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | abstract protected function compute(): void; |
@@ -142,7 +142,7 @@ |
||
142 | 142 | public function getIncomingForeignKeys(string $tableName): array |
143 | 143 | { |
144 | 144 | $junctionTables = $this->schemaAnalyzer->detectJunctionTables(true); |
145 | - $junctionTableNames = array_map(function (Table $table) { |
|
145 | + $junctionTableNames = array_map(function(Table $table) { |
|
146 | 146 | return $table->getName(); |
147 | 147 | }, $junctionTables); |
148 | 148 | $childrenRelationships = $this->schemaAnalyzer->getChildrenRelationships($tableName); |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | { |
448 | 448 | $beans = $this->tdbmService->findObjects('person', null, [], 'person.id ASC', [], null, TDBMObject::class); |
449 | 449 | |
450 | - $results = $beans->map(function ($item) { |
|
450 | + $results = $beans->map(function($item) { |
|
451 | 451 | return $item->getProperty('id', 'person'); |
452 | 452 | })->toArray(); |
453 | 453 | |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | // Same test with page |
457 | 457 | $page = $beans->take(0, 2); |
458 | 458 | |
459 | - $results = $page->map(function ($item) { |
|
459 | + $results = $page->map(function($item) { |
|
460 | 460 | return $item->getProperty('id', 'person'); |
461 | 461 | })->toArray(); |
462 | 462 |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | public function testConstructorException1(): void |
29 | 29 | { |
30 | 30 | $this->expectException('TheCodingMachine\TDBM\TDBMException'); |
31 | - $mapIterator = new MapIterator(new \DateTime(), function ($item) { |
|
31 | + $mapIterator = new MapIterator(new \DateTime(), function($item) { |
|
32 | 32 | return $item; |
33 | 33 | }); |
34 | 34 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | public function testConstructorException2(): void |
37 | 37 | { |
38 | 38 | $this->expectException('TheCodingMachine\TDBM\TDBMException'); |
39 | - $mapIterator = new MapIterator(array(1, 2, 3), function () { |
|
39 | + $mapIterator = new MapIterator(array(1, 2, 3), function() { |
|
40 | 40 | return $item; |
41 | 41 | }); |
42 | 42 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | public function testJsonSerialize(): void |
45 | 45 | { |
46 | 46 | $value = array(1, 2, 3); |
47 | - $mapIterator = new MapIterator($value, function ($item) { |
|
47 | + $mapIterator = new MapIterator($value, function($item) { |
|
48 | 48 | return $item; |
49 | 49 | }); |
50 | 50 |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | } |
417 | 417 | } |
418 | 418 | |
419 | - return ['(' . implode(') AND (', $sqlParts) . ')', $parameters, $counter]; |
|
419 | + return ['('.implode(') AND (', $sqlParts).')', $parameters, $counter]; |
|
420 | 420 | } elseif ($filter_bag instanceof AbstractTDBMObject) { |
421 | 421 | $sqlParts = []; |
422 | 422 | $parameters = []; |
@@ -990,7 +990,7 @@ discard block |
||
990 | 990 | |
991 | 991 | return $this->fromCache( |
992 | 992 | $this->cachePrefix.'_linkbetweeninheritedtables_'.implode('__split__', $tables), |
993 | - function () use ($tables) { |
|
993 | + function() use ($tables) { |
|
994 | 994 | return $this->_getLinkBetweenInheritedTablesWithoutCache($tables); |
995 | 995 | } |
996 | 996 | ); |
@@ -1038,7 +1038,7 @@ discard block |
||
1038 | 1038 | */ |
1039 | 1039 | public function _getRelatedTablesByInheritance(string $table): array |
1040 | 1040 | { |
1041 | - return $this->fromCache($this->cachePrefix.'_relatedtables_'.$table, function () use ($table) { |
|
1041 | + return $this->fromCache($this->cachePrefix.'_relatedtables_'.$table, function() use ($table) { |
|
1042 | 1042 | return $this->_getRelatedTablesByInheritanceWithoutCache($table); |
1043 | 1043 | }); |
1044 | 1044 | } |
@@ -1233,7 +1233,7 @@ discard block |
||
1233 | 1233 | try { |
1234 | 1234 | return $this->findObjectOrFail($table, $primaryKeys, [], $additionalTablesFetch, $className); |
1235 | 1235 | } catch (NoBeanFoundException $exception) { |
1236 | - $primaryKeysStringified = implode(' and ', array_map(function ($key, $value) { |
|
1236 | + $primaryKeysStringified = implode(' and ', array_map(function($key, $value) { |
|
1237 | 1237 | return "'".$key."' = ".$value; |
1238 | 1238 | }, array_keys($primaryKeys), $primaryKeys)); |
1239 | 1239 | throw new NoBeanFoundException("No result found for query on table '".$table."' for ".$primaryKeysStringified, 0, $exception); |
@@ -1276,18 +1276,18 @@ discard block |
||
1276 | 1276 | if ($count > 1) { |
1277 | 1277 | $additionalErrorInfos = ''; |
1278 | 1278 | if (is_string($filter) && !empty($parameters)) { |
1279 | - $additionalErrorInfos = ' for filter "' . $filter.'"'; |
|
1279 | + $additionalErrorInfos = ' for filter "'.$filter.'"'; |
|
1280 | 1280 | foreach ($parameters as $fieldName => $parameter) { |
1281 | 1281 | if (is_array($parameter)) { |
1282 | - $value = '(' . implode(',', $parameter) . ')'; |
|
1282 | + $value = '('.implode(',', $parameter).')'; |
|
1283 | 1283 | } else { |
1284 | 1284 | $value = $parameter; |
1285 | 1285 | } |
1286 | - $additionalErrorInfos = str_replace(':' . $fieldName, var_export($value, true), $additionalErrorInfos); |
|
1286 | + $additionalErrorInfos = str_replace(':'.$fieldName, var_export($value, true), $additionalErrorInfos); |
|
1287 | 1287 | } |
1288 | 1288 | } |
1289 | 1289 | $additionalErrorInfos .= '.'; |
1290 | - 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); |
|
1290 | + 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); |
|
1291 | 1291 | } elseif ($count === 0) { |
1292 | 1292 | return null; |
1293 | 1293 | } |
@@ -1456,7 +1456,7 @@ discard block |
||
1456 | 1456 | $table1 = $fks[0]->getForeignTableName(); |
1457 | 1457 | $table2 = $fks[1]->getForeignTableName(); |
1458 | 1458 | |
1459 | - $beanTables = array_map(function (DbRow $dbRow) { |
|
1459 | + $beanTables = array_map(function(DbRow $dbRow) { |
|
1460 | 1460 | return $dbRow->_getDbTableName(); |
1461 | 1461 | }, $bean->_getDbRows()); |
1462 | 1462 |
@@ -262,7 +262,7 @@ |
||
262 | 262 | */ |
263 | 263 | public function jsonSerialize() |
264 | 264 | { |
265 | - return array_map(function (AbstractTDBMObject $item) { |
|
265 | + return array_map(function(AbstractTDBMObject $item) { |
|
266 | 266 | return $item->jsonSerialize(); |
267 | 267 | }, $this->toArray()); |
268 | 268 | } |