@@ -49,7 +49,7 @@ |
||
49 | 49 | |
50 | 50 | $fromLock = (bool) $input->getOption('from-lock'); |
51 | 51 | |
52 | - $loggers = [ new ConsoleLogger($output) ]; |
|
52 | + $loggers = [new ConsoleLogger($output)]; |
|
53 | 53 | |
54 | 54 | $logger = $alteredConf->getLogger(); |
55 | 55 | if ($logger) { |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | */ |
79 | 79 | public static function createResultIterator(ResultIterator $parentResult, string $magicSql, array $parameters, int $limit, int $offset, array $columnDescriptors, ObjectStorageInterface $objectStorage, ?string $className, TDBMService $tdbmService, MagicQuery $magicQuery, int $mode, LoggerInterface $logger): self |
80 | 80 | { |
81 | - $iterator = new self(); |
|
81 | + $iterator = new self(); |
|
82 | 82 | $iterator->parentResult = $parentResult; |
83 | 83 | $iterator->magicSql = $magicSql; |
84 | 84 | $iterator->objectStorage = $objectStorage; |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | */ |
278 | 278 | public function jsonSerialize() |
279 | 279 | { |
280 | - return array_map(function (AbstractTDBMObject $item) { |
|
280 | + return array_map(function(AbstractTDBMObject $item) { |
|
281 | 281 | return $item->jsonSerialize(); |
282 | 282 | }, $this->toArray()); |
283 | 283 | } |
@@ -78,7 +78,7 @@ |
||
78 | 78 | */ |
79 | 79 | public static function createInnerResultIterator(string $magicSql, array $parameters, ?int $limit, ?int $offset, array $columnDescriptors, ObjectStorageInterface $objectStorage, ?string $className, TDBMService $tdbmService, MagicQuery $magicQuery, LoggerInterface $logger): self |
80 | 80 | { |
81 | - $iterator = new static(); |
|
81 | + $iterator = new static(); |
|
82 | 82 | $iterator->magicSql = $magicSql; |
83 | 83 | $iterator->objectStorage = $objectStorage; |
84 | 84 | $iterator->className = $className; |
@@ -8,7 +8,7 @@ |
||
8 | 8 | { |
9 | 9 | public static function getValidVariableName(string $variableName): string |
10 | 10 | { |
11 | - $valid = preg_replace_callback('/^(\d+)/', static function (array $match) { |
|
11 | + $valid = preg_replace_callback('/^(\d+)/', static function(array $match) { |
|
12 | 12 | $f = new \NumberFormatter('en', \NumberFormatter::SPELLOUT); |
13 | 13 | $number = $f->format((int) $match[0]); |
14 | 14 | return preg_replace('/[^a-z]+/i', '_', $number); |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | $alias = AbstractQueryFactory::getColumnAlias($tableName, $columnName); |
216 | 216 | $astColumn = [ |
217 | 217 | 'expr_type' => 'colref', |
218 | - 'base_expr' => $connection->quoteIdentifier($tableName) . '.' . $connection->quoteIdentifier($columnName), |
|
218 | + 'base_expr' => $connection->quoteIdentifier($tableName).'.'.$connection->quoteIdentifier($columnName), |
|
219 | 219 | 'no_quotes' => [ |
220 | 220 | 'delim' => '.', |
221 | 221 | 'parts' => [ |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | return $this->generateWrappedSqlCount($parsedSql); |
304 | 304 | } |
305 | 305 | |
306 | - $countSubExpr = array_map(function (array $item) { |
|
306 | + $countSubExpr = array_map(function(array $item) { |
|
307 | 307 | unset($item['alias']); |
308 | 308 | return $item; |
309 | 309 | }, $parsedSql['SELECT']); |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | $item['delim'] = ','; |
381 | 381 | $innerColumns[] = $item; |
382 | 382 | } |
383 | - $innerColumns[count($innerColumns)-1]['delim'] = false; |
|
383 | + $innerColumns[count($innerColumns) - 1]['delim'] = false; |
|
384 | 384 | $parsedSql['SELECT'] = $innerColumns; |
385 | 385 | |
386 | 386 | $parsedSql = [ |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | $schemaLockFileDumper = new SchemaLockFileDumper($this->tdbmService->getConnection(), new ArrayCache(), Configuration::getDefaultLockFilePath()); |
111 | 111 | $tdbmSchemaAnalyzer = new TDBMSchemaAnalyzer($this->tdbmService->getConnection(), new ArrayCache(), $schemaAnalyzer, $schemaLockFileDumper); |
112 | 112 | $this->tdbmDaoGenerator = new TDBMDaoGenerator($this->getConfiguration(), $tdbmSchemaAnalyzer); |
113 | - $this->rootPath = __DIR__ . '/../'; |
|
113 | + $this->rootPath = __DIR__.'/../'; |
|
114 | 114 | //$this->tdbmDaoGenerator->setComposerFile($this->rootPath.'composer.json'); |
115 | 115 | } |
116 | 116 | |
@@ -132,10 +132,10 @@ discard block |
||
132 | 132 | public function testDaoGeneration(): void |
133 | 133 | { |
134 | 134 | // Remove all previously generated files. |
135 | - $this->recursiveDelete($this->rootPath . 'src/Test/Dao/'); |
|
136 | - mkdir($this->rootPath . 'src/Test/Dao/Generated', 0755, true); |
|
135 | + $this->recursiveDelete($this->rootPath.'src/Test/Dao/'); |
|
136 | + mkdir($this->rootPath.'src/Test/Dao/Generated', 0755, true); |
|
137 | 137 | // Let's generate a dummy file to see it is indeed removed. |
138 | - $dummyFile = $this->rootPath . 'src/Test/Dao/Generated/foobar.php'; |
|
138 | + $dummyFile = $this->rootPath.'src/Test/Dao/Generated/foobar.php'; |
|
139 | 139 | touch($dummyFile); |
140 | 140 | $this->assertFileExists($dummyFile); |
141 | 141 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | |
155 | 155 | // Let's require all files to check they are valid PHP! |
156 | 156 | // Test the daoFactory |
157 | - require_once $this->rootPath . 'src/Test/Dao/Generated/DaoFactory.php'; |
|
157 | + require_once $this->rootPath.'src/Test/Dao/Generated/DaoFactory.php'; |
|
158 | 158 | // Test the others |
159 | 159 | |
160 | 160 | $beanDescriptors = $this->getDummyGeneratorListener()->getBeanDescriptors(); |
@@ -164,10 +164,10 @@ discard block |
||
164 | 164 | $daoBaseName = $beanDescriptor->getBaseDaoClassName(); |
165 | 165 | $beanName = $beanDescriptor->getBeanClassName(); |
166 | 166 | $baseBeanName = $beanDescriptor->getBaseBeanClassName(); |
167 | - require_once $this->rootPath . 'src/Test/Dao/Bean/Generated/' . $baseBeanName . '.php'; |
|
168 | - require_once $this->rootPath . 'src/Test/Dao/Bean/' . $beanName . '.php'; |
|
169 | - require_once $this->rootPath . 'src/Test/Dao/Generated/' . $daoBaseName . '.php'; |
|
170 | - require_once $this->rootPath . 'src/Test/Dao/' . $daoName . '.php'; |
|
167 | + require_once $this->rootPath.'src/Test/Dao/Bean/Generated/'.$baseBeanName.'.php'; |
|
168 | + require_once $this->rootPath.'src/Test/Dao/Bean/'.$beanName.'.php'; |
|
169 | + require_once $this->rootPath.'src/Test/Dao/Generated/'.$daoBaseName.'.php'; |
|
170 | + require_once $this->rootPath.'src/Test/Dao/'.$daoName.'.php'; |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | // Check that pivot tables do not generate DAOs or beans. |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | $schemaLockFileDumper = new SchemaLockFileDumper($this->tdbmService->getConnection(), new ArrayCache(), Configuration::getDefaultLockFilePath()); |
184 | 184 | $tdbmSchemaAnalyzer = new TDBMSchemaAnalyzer($this->tdbmService->getConnection(), new ArrayCache(), $schemaAnalyzer, $schemaLockFileDumper); |
185 | 185 | $tdbmDaoGenerator = new TDBMDaoGenerator($configuration, $tdbmSchemaAnalyzer); |
186 | - $this->rootPath = __DIR__ . '/../../../../'; |
|
186 | + $this->rootPath = __DIR__.'/../../../../'; |
|
187 | 187 | //$tdbmDaoGenerator->setComposerFile($this->rootPath.'composer.json'); |
188 | 188 | |
189 | 189 | $this->expectException(NoPathFoundException::class); |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | if (is_file($str)) { |
202 | 202 | return @unlink($str); |
203 | 203 | } elseif (is_dir($str)) { |
204 | - $scan = glob(rtrim($str, '/') . '/*'); |
|
204 | + $scan = glob(rtrim($str, '/').'/*'); |
|
205 | 205 | foreach ($scan as $index => $path) { |
206 | 206 | $this->recursiveDelete($path); |
207 | 207 | } |
@@ -2037,7 +2037,7 @@ discard block |
||
2037 | 2037 | |
2038 | 2038 | $artists = new ArtistDao($this->tdbmService); |
2039 | 2039 | $pinkFloyd = $artists->getById(1); |
2040 | - $animals = $pinkFloyd->getAlbums()[0]; |
|
2040 | + $animals = $pinkFloyd->getAlbums()[0]; |
|
2041 | 2041 | $json = $pinkFloyd->jsonSerialize(); |
2042 | 2042 | // Collection name properly handled ('discography' instead of default 'albums') |
2043 | 2043 | 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 |
@@ -35,7 +35,7 @@ |
||
35 | 35 | */ |
36 | 36 | public static function missPrimaryKeyRecord(string $tableName, array $primaryKeys, string $className, Exception $previous) : self |
37 | 37 | { |
38 | - $primaryKeysStringified = implode(' and ', array_map(function ($key, $value) { |
|
38 | + $primaryKeysStringified = implode(' and ', array_map(function($key, $value) { |
|
39 | 39 | return "'".$key."' = ".$value; |
40 | 40 | }, array_keys($primaryKeys), $primaryKeys)); |
41 | 41 | $exception = new self("No result found for query on table '".$tableName."' for ".$primaryKeysStringified, 0, $previous); |
@@ -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)) { |