@@ -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); |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | $this->getArrayInlineCode($this->remoteFk->getUnquotedForeignColumns()), |
185 | 185 | $this->getArrayInlineCode($this->remoteFk->getUnquotedLocalColumns()), |
186 | 186 | $this->getArrayInlineCode($this->localFk->getUnquotedLocalColumns()), |
187 | - '\\' . $this->resultIteratorNamespace . '\\' . $this->getResultIteratorClassName() . '::class' |
|
187 | + '\\'.$this->resultIteratorNamespace.'\\'.$this->getResultIteratorClassName().'::class' |
|
188 | 188 | ); |
189 | 189 | } |
190 | 190 | |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | |
227 | 227 | $getter = new MethodGenerator($this->getName()); |
228 | 228 | $getterDocBlock = new DocBlockGenerator(sprintf('Returns the list of %s associated to this bean via the %s pivot table.', $remoteBeanName, $this->pivotTable->getName())); |
229 | - $getterDocBlock->setTag(new ReturnTag([ $fqcnRemoteBeanName.'[]' ])); |
|
229 | + $getterDocBlock->setTag(new ReturnTag([$fqcnRemoteBeanName.'[]'])); |
|
230 | 230 | $getterDocBlock->setWordWrap(false); |
231 | 231 | $getter->setDocBlock($getterDocBlock); |
232 | 232 | $getter->setReturnType('array'); |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | |
236 | 236 | $adder = new MethodGenerator('add'.$singularName); |
237 | 237 | $adderDocBlock = new DocBlockGenerator(sprintf('Adds a relationship with %s associated to this bean via the %s pivot table.', $remoteBeanName, $this->pivotTable->getName())); |
238 | - $adderDocBlock->setTag(new ParamTag($variableName, [ $fqcnRemoteBeanName ])); |
|
238 | + $adderDocBlock->setTag(new ParamTag($variableName, [$fqcnRemoteBeanName])); |
|
239 | 239 | $adderDocBlock->setWordWrap(false); |
240 | 240 | $adder->setDocBlock($adderDocBlock); |
241 | 241 | $adder->setReturnType('void'); |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | |
245 | 245 | $remover = new MethodGenerator('remove'.$singularName); |
246 | 246 | $removerDocBlock = new DocBlockGenerator(sprintf('Deletes the relationship with %s associated to this bean via the %s pivot table.', $remoteBeanName, $this->pivotTable->getName())); |
247 | - $removerDocBlock->setTag(new ParamTag($variableName, [ $fqcnRemoteBeanName ])); |
|
247 | + $removerDocBlock->setTag(new ParamTag($variableName, [$fqcnRemoteBeanName])); |
|
248 | 248 | $removerDocBlock->setWordWrap(false); |
249 | 249 | $remover->setDocBlock($removerDocBlock); |
250 | 250 | $remover->setReturnType('void'); |
@@ -253,8 +253,8 @@ discard block |
||
253 | 253 | |
254 | 254 | $has = new MethodGenerator('has'.$singularName); |
255 | 255 | $hasDocBlock = new DocBlockGenerator(sprintf('Returns whether this bean is associated with %s via the %s pivot table.', $remoteBeanName, $this->pivotTable->getName())); |
256 | - $hasDocBlock->setTag(new ParamTag($variableName, [ $fqcnRemoteBeanName ])); |
|
257 | - $hasDocBlock->setTag(new ReturnTag([ 'bool' ])); |
|
256 | + $hasDocBlock->setTag(new ParamTag($variableName, [$fqcnRemoteBeanName])); |
|
257 | + $hasDocBlock->setTag(new ReturnTag(['bool'])); |
|
258 | 258 | $hasDocBlock->setWordWrap(false); |
259 | 259 | $has->setDocBlock($hasDocBlock); |
260 | 260 | $has->setReturnType('bool'); |
@@ -264,15 +264,15 @@ discard block |
||
264 | 264 | $setter = new MethodGenerator('set'.$pluralName); |
265 | 265 | $setterDocBlock = new DocBlockGenerator(sprintf('Sets all relationships with %s associated to this bean via the %s pivot table. |
266 | 266 | Exiting relationships will be removed and replaced by the provided relationships.', $remoteBeanName, $this->pivotTable->getName())); |
267 | - $setterDocBlock->setTag(new ParamTag($pluralVariableName, [ $fqcnRemoteBeanName.'[]' ])); |
|
268 | - $setterDocBlock->setTag(new ReturnTag([ 'void' ])); |
|
267 | + $setterDocBlock->setTag(new ParamTag($pluralVariableName, [$fqcnRemoteBeanName.'[]'])); |
|
268 | + $setterDocBlock->setTag(new ReturnTag(['void'])); |
|
269 | 269 | $setterDocBlock->setWordWrap(false); |
270 | 270 | $setter->setDocBlock($setterDocBlock); |
271 | 271 | $setter->setReturnType('void'); |
272 | 272 | $setter->setParameter(new ParameterGenerator($pluralVariableName, 'array')); |
273 | 273 | $setter->setBody(sprintf('$this->setRelationships(%s, $%s);', $pathKey, $pluralVariableName)); |
274 | 274 | |
275 | - return [ $getter, $adder, $remover, $has, $setter ]; |
|
275 | + return [$getter, $adder, $remover, $has, $setter]; |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | /** |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | /** @var Annotation\JsonFormat|null $jsonFormat */ |
302 | 302 | $jsonFormat = $this->findRemoteAnnotation(Annotation\JsonFormat::class); |
303 | 303 | if ($jsonFormat !== null) { |
304 | - $method = $jsonFormat->method ?? 'get' . ucfirst($jsonFormat->property); |
|
304 | + $method = $jsonFormat->method ?? 'get'.ucfirst($jsonFormat->property); |
|
305 | 305 | $format = "$method()"; |
306 | 306 | } else { |
307 | 307 | $stopRecursion = $this->findRemoteAnnotation(Annotation\JsonRecursive::class) ? '' : 'true'; |