@@ -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'])); |
@@ -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 | } |
@@ -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); |
@@ -89,11 +89,11 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | // Remove all beans and daos from junction tables |
| 91 | 91 | $junctionTables = $this->configuration->getSchemaAnalyzer()->detectJunctionTables(true); |
| 92 | - $junctionTableNames = array_map(function (Table $table) { |
|
| 92 | + $junctionTableNames = array_map(function(Table $table) { |
|
| 93 | 93 | return $table->getName(); |
| 94 | 94 | }, $junctionTables); |
| 95 | 95 | |
| 96 | - $tableList = array_filter($tableList, function (Table $table) use ($junctionTableNames) { |
|
| 96 | + $tableList = array_filter($tableList, function(Table $table) use ($junctionTableNames) { |
|
| 97 | 97 | return !in_array($table->getName(), $junctionTableNames, true); |
| 98 | 98 | }); |
| 99 | 99 | |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | $fileContent = $this->psr2Fix($fileContent); |
| 175 | 175 | // Add the declare strict-types directive |
| 176 | 176 | $commentEnd = strpos($fileContent, ' */') + 3; |
| 177 | - $fileContent = substr($fileContent, 0, $commentEnd) . "\n\ndeclare(strict_types=1);" . substr($fileContent, $commentEnd + 1); |
|
| 177 | + $fileContent = substr($fileContent, 0, $commentEnd)."\n\ndeclare(strict_types=1);".substr($fileContent, $commentEnd + 1); |
|
| 178 | 178 | |
| 179 | 179 | $this->dumpFile($possibleBaseFileName, $fileContent); |
| 180 | 180 | |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | $fileContent = $this->psr2Fix($fileContent); |
| 237 | 237 | // Add the declare strict-types directive |
| 238 | 238 | $commentEnd = strpos($fileContent, ' */') + 3; |
| 239 | - $fileContent = substr($fileContent, 0, $commentEnd) . "\n\ndeclare(strict_types=1);" . substr($fileContent, $commentEnd + 1); |
|
| 239 | + $fileContent = substr($fileContent, 0, $commentEnd)."\n\ndeclare(strict_types=1);".substr($fileContent, $commentEnd + 1); |
|
| 240 | 240 | |
| 241 | 241 | $this->dumpFile($possibleBaseFileName, $fileContent); |
| 242 | 242 | |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | private function psr2Fix(string $content): string |
| 275 | 275 | { |
| 276 | 276 | // Removes the extra blank line at the end (before: `\n\n`, after: `\n`) |
| 277 | - return rtrim($content, PHP_EOL) . PHP_EOL; |
|
| 277 | + return rtrim($content, PHP_EOL).PHP_EOL; |
|
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | /** |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | $resultIteratorClassName = $beanDescriptor->getResultIteratorClassName(); |
| 286 | 286 | $resultIteratorBaseClassName = $beanDescriptor->getBaseResultIteratorClassName(); |
| 287 | 287 | $resultIteratorNamespace = $this->configuration->getResultIteratorNamespace(); |
| 288 | - $resultIteratorBaseNamespace = $resultIteratorNamespace . '\\Generated'; |
|
| 288 | + $resultIteratorBaseNamespace = $resultIteratorNamespace.'\\Generated'; |
|
| 289 | 289 | $beanClassWithoutNameSpace = $beanDescriptor->getBeanClassName(); |
| 290 | 290 | $file = $beanDescriptor->generateResultIteratorPhpCode(); |
| 291 | 291 | if ($file === null) { |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | |
| 295 | 295 | $fileContent = $this->psr2Fix($file->generate()); |
| 296 | 296 | $commentEnd = strpos($fileContent, ' */') + 3; |
| 297 | - $fileContent = substr($fileContent, 0, $commentEnd) . "\n\ndeclare(strict_types=1);" . substr($fileContent, $commentEnd + 1); |
|
| 297 | + $fileContent = substr($fileContent, 0, $commentEnd)."\n\ndeclare(strict_types=1);".substr($fileContent, $commentEnd + 1); |
|
| 298 | 298 | |
| 299 | 299 | $baseResultIteratorFilePath = $this->configuration->getPathFinder()->getPath($resultIteratorBaseNamespace.'\\'.$resultIteratorBaseClassName)->getPathname(); |
| 300 | 300 | $this->dumpFile($baseResultIteratorFilePath, $fileContent); |
@@ -359,7 +359,7 @@ discard block |
||
| 359 | 359 | |
| 360 | 360 | $constructorMethod = new MethodGenerator( |
| 361 | 361 | '__construct', |
| 362 | - [ new ParameterGenerator('container', ContainerInterface::class) ], |
|
| 362 | + [new ParameterGenerator('container', ContainerInterface::class)], |
|
| 363 | 363 | MethodGenerator::FLAG_PUBLIC, |
| 364 | 364 | '$this->container = $container;' |
| 365 | 365 | ); |
@@ -375,7 +375,7 @@ discard block |
||
| 375 | 375 | |
| 376 | 376 | $daoInstanceProperty = new PropertyGenerator($daoInstanceName); |
| 377 | 377 | $daoInstanceProperty->setVisibility(AbstractMemberGenerator::VISIBILITY_PRIVATE); |
| 378 | - $daoInstanceProperty->setDocBlock(new DocBlockGenerator(null, null, [new VarTag(null, ['\\' . $daoNamespace . '\\' . $daoClassName, 'null'])])); |
|
| 378 | + $daoInstanceProperty->setDocBlock(new DocBlockGenerator(null, null, [new VarTag(null, ['\\'.$daoNamespace.'\\'.$daoClassName, 'null'])])); |
|
| 379 | 379 | $class->addPropertyFromGenerator($daoInstanceProperty); |
| 380 | 380 | |
| 381 | 381 | $fullClassNameVarExport = var_export($daoNamespace.'\\'.$daoClassName, true); |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | BODY; |
| 389 | 389 | |
| 390 | 390 | $getterMethod = new MethodGenerator( |
| 391 | - 'get' . $daoClassName, |
|
| 391 | + 'get'.$daoClassName, |
|
| 392 | 392 | [], |
| 393 | 393 | MethodGenerator::FLAG_PUBLIC, |
| 394 | 394 | $getterBody |
@@ -400,10 +400,10 @@ discard block |
||
| 400 | 400 | } |
| 401 | 401 | |
| 402 | 402 | $setterMethod = new MethodGenerator( |
| 403 | - 'set' . $daoClassName, |
|
| 404 | - [new ParameterGenerator($daoInstanceName, '\\' . $daoNamespace . '\\' . $daoClassName)], |
|
| 403 | + 'set'.$daoClassName, |
|
| 404 | + [new ParameterGenerator($daoInstanceName, '\\'.$daoNamespace.'\\'.$daoClassName)], |
|
| 405 | 405 | MethodGenerator::FLAG_PUBLIC, |
| 406 | - '$this->' . $daoInstanceName . ' = $' . $daoInstanceName . ';' |
|
| 406 | + '$this->'.$daoInstanceName.' = $'.$daoInstanceName.';' |
|
| 407 | 407 | ); |
| 408 | 408 | $setterMethod->setReturnType('void'); |
| 409 | 409 | $setterMethod = $this->configuration->getCodeGeneratorListener()->onDaoFactorySetterGenerated($setterMethod, $beanDescriptor, $this->configuration, $class); |
@@ -423,7 +423,7 @@ discard block |
||
| 423 | 423 | $fileContent = $this->psr2Fix($fileContent); |
| 424 | 424 | // Add the declare strict-types directive |
| 425 | 425 | $commentEnd = strpos($fileContent, ' */') + 3; |
| 426 | - $fileContent = substr($fileContent, 0, $commentEnd) . "\n\ndeclare(strict_types=1);" . substr($fileContent, $commentEnd + 1); |
|
| 426 | + $fileContent = substr($fileContent, 0, $commentEnd)."\n\ndeclare(strict_types=1);".substr($fileContent, $commentEnd + 1); |
|
| 427 | 427 | |
| 428 | 428 | $this->dumpFile($possibleFileName, $fileContent); |
| 429 | 429 | } |
@@ -530,7 +530,7 @@ discard block |
||
| 530 | 530 | $map = [ |
| 531 | 531 | Type::TARRAY => 'array', |
| 532 | 532 | Type::SIMPLE_ARRAY => 'array', |
| 533 | - 'json' => 'array', // 'json' is supported from Doctrine DBAL 2.6 only. |
|
| 533 | + 'json' => 'array', // 'json' is supported from Doctrine DBAL 2.6 only. |
|
| 534 | 534 | Type::JSON_ARRAY => 'array', |
| 535 | 535 | Type::BIGINT => 'string', |
| 536 | 536 | Type::BOOLEAN => 'bool', |
@@ -19,12 +19,12 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | private const LEVELS = array( |
| 21 | 21 | LogLevel::EMERGENCY, // 0 |
| 22 | - LogLevel::ALERT, // 1 |
|
| 23 | - LogLevel::CRITICAL, // 2 |
|
| 24 | - LogLevel::ERROR, // 3 |
|
| 25 | - LogLevel::WARNING, // 4 |
|
| 26 | - LogLevel::NOTICE, // 5 |
|
| 27 | - LogLevel::INFO, // 6 |
|
| 22 | + LogLevel::ALERT, // 1 |
|
| 23 | + LogLevel::CRITICAL, // 2 |
|
| 24 | + LogLevel::ERROR, // 3 |
|
| 25 | + LogLevel::WARNING, // 4 |
|
| 26 | + LogLevel::NOTICE, // 5 |
|
| 27 | + LogLevel::INFO, // 6 |
|
| 28 | 28 | LogLevel::DEBUG // 7 |
| 29 | 29 | ); |
| 30 | 30 | |
@@ -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'; |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | */ |
| 46 | 46 | public function __construct(string $targetTable, string $pivotTable, array $joinForeignKeys, array $joinLocalKeys, array $whereKeys, string $resultIteratorClass) |
| 47 | 47 | { |
| 48 | - assert(is_a($resultIteratorClass, ResultIterator::class, true), new TDBMInvalidArgumentException('$resultIteratorClass should be a `'. ResultIterator::class. '`. `' . $resultIteratorClass . '` provided.')); |
|
| 48 | + assert(is_a($resultIteratorClass, ResultIterator::class, true), new TDBMInvalidArgumentException('$resultIteratorClass should be a `'.ResultIterator::class.'`. `'.$resultIteratorClass.'` provided.')); |
|
| 49 | 49 | $this->targetTable = $targetTable; |
| 50 | 50 | $this->pivotTable = $pivotTable; |
| 51 | 51 | $this->joinForeignKeys = $joinForeignKeys; |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | public static function generateModelKey(ForeignKeyConstraint $remoteFk, ForeignKeyConstraint $localFk): string |
| 58 | 58 | { |
| 59 | - return $remoteFk->getLocalTableName() . "." . implode("__", $localFk->getUnquotedLocalColumns()); |
|
| 59 | + return $remoteFk->getLocalTableName().".".implode("__", $localFk->getUnquotedLocalColumns()); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | public function getPivotName(): string |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | $join[] = sprintf('%s.%s = %s.%s', $mainTable, $column, $pivotTable, $this->joinLocalKeys[$key]); |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - return $mainTable . ' JOIN ' . $pivotTable . ' ON ' . implode(' AND ', $join); |
|
| 82 | + return $mainTable.' JOIN '.$pivotTable.' ON '.implode(' AND ', $join); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | public function getPivotWhere(): string |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | { |
| 100 | 100 | $params = []; |
| 101 | 101 | foreach ($primaryKeys as $key => $primaryKeyValue) { |
| 102 | - $params['param' . $key] = $primaryKeyValue; |
|
| 102 | + $params['param'.$key] = $primaryKeyValue; |
|
| 103 | 103 | } |
| 104 | 104 | return $params; |
| 105 | 105 | } |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | */ |
| 94 | 94 | public function getPhpType(): string |
| 95 | 95 | { |
| 96 | - return '\\' . $this->beanNamespace . '\\' . $this->getClassName(); |
|
| 96 | + return '\\'.$this->beanNamespace.'\\'.$this->getClassName(); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | /** |
@@ -168,17 +168,17 @@ discard block |
||
| 168 | 168 | $referencedResultIteratorName = $this->namingStrategy->getResultIteratorClassName($foreignTableName); |
| 169 | 169 | |
| 170 | 170 | $getter = new MethodGenerator($getterName); |
| 171 | - $getter->setDocBlock(new DocBlockGenerator('Returns the ' . $referencedBeanName . ' object bound to this object via the ' . implode(' and ', $this->foreignKey->getUnquotedLocalColumns()) . ' column.')); |
|
| 171 | + $getter->setDocBlock(new DocBlockGenerator('Returns the '.$referencedBeanName.' object bound to this object via the '.implode(' and ', $this->foreignKey->getUnquotedLocalColumns()).' column.')); |
|
| 172 | 172 | |
| 173 | - $getter->setReturnType(($isNullable ? '?' : '') . $this->beanNamespace . '\\' . $referencedBeanName); |
|
| 173 | + $getter->setReturnType(($isNullable ? '?' : '').$this->beanNamespace.'\\'.$referencedBeanName); |
|
| 174 | 174 | $tdbmFk = ForeignKey::createFromFk($this->foreignKey); |
| 175 | 175 | |
| 176 | 176 | $getter->setBody(sprintf( |
| 177 | 177 | 'return $this->getRef(%s, %s, %s, %s);', |
| 178 | 178 | var_export($tdbmFk->getCacheKey(), true), |
| 179 | 179 | var_export($tableName, true), |
| 180 | - '\\' . $this->beanNamespace . '\\' . $referencedBeanName . '::class', |
|
| 181 | - '\\' . $this->resultIteratorNamespace . '\\' . $referencedResultIteratorName . '::class' |
|
| 180 | + '\\'.$this->beanNamespace.'\\'.$referencedBeanName.'::class', |
|
| 181 | + '\\'.$this->resultIteratorNamespace.'\\'.$referencedResultIteratorName.'::class' |
|
| 182 | 182 | )); |
| 183 | 183 | |
| 184 | 184 | if ($this->isGetterProtected()) { |
@@ -187,9 +187,9 @@ discard block |
||
| 187 | 187 | |
| 188 | 188 | if (!$this->isReadOnly()) { |
| 189 | 189 | $setter = new MethodGenerator($setterName); |
| 190 | - $setter->setDocBlock(new DocBlockGenerator('The setter for the ' . $referencedBeanName . ' object bound to this object via the ' . implode(' and ', $this->foreignKey->getUnquotedLocalColumns()) . ' column.')); |
|
| 190 | + $setter->setDocBlock(new DocBlockGenerator('The setter for the '.$referencedBeanName.' object bound to this object via the '.implode(' and ', $this->foreignKey->getUnquotedLocalColumns()).' column.')); |
|
| 191 | 191 | |
| 192 | - $setter->setParameter(new ParameterGenerator('object', ($isNullable ? '?' : '') . $this->beanNamespace . '\\' . $referencedBeanName)); |
|
| 192 | + $setter->setParameter(new ParameterGenerator('object', ($isNullable ? '?' : '').$this->beanNamespace.'\\'.$referencedBeanName)); |
|
| 193 | 193 | |
| 194 | 194 | $setter->setReturnType('void'); |
| 195 | 195 | |
@@ -198,8 +198,8 @@ discard block |
||
| 198 | 198 | var_export($tdbmFk->getCacheKey(), true), |
| 199 | 199 | '$object', |
| 200 | 200 | var_export($tableName, true), |
| 201 | - '\\' . $this->beanNamespace . '\\' . $referencedBeanName . '::class', |
|
| 202 | - '\\' . $this->resultIteratorNamespace . '\\' . $referencedResultIteratorName . '::class' |
|
| 201 | + '\\'.$this->beanNamespace.'\\'.$referencedBeanName.'::class', |
|
| 202 | + '\\'.$this->resultIteratorNamespace.'\\'.$referencedResultIteratorName.'::class' |
|
| 203 | 203 | )); |
| 204 | 204 | |
| 205 | 205 | if ($this->isSetterProtected()) { |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | /** @var Annotation\JsonFormat|null $jsonFormat */ |
| 240 | 240 | $jsonFormat = $this->findAnnotation(Annotation\JsonFormat::class); |
| 241 | 241 | if ($jsonFormat !== null) { |
| 242 | - $method = $jsonFormat->method ?? 'get' . ucfirst($jsonFormat->property); |
|
| 242 | + $method = $jsonFormat->method ?? 'get'.ucfirst($jsonFormat->property); |
|
| 243 | 243 | $format = "$method()"; |
| 244 | 244 | } else { |
| 245 | 245 | $stopRecursion = $this->findAnnotation(Annotation\JsonRecursive::class) ? '' : 'true'; |
@@ -295,10 +295,10 @@ discard block |
||
| 295 | 295 | } elseif ($descriptor instanceof ScalarBeanPropertyDescriptor) { |
| 296 | 296 | $rows[] = "'$indexName' => $propertyAccess->$columnGetterName()"; |
| 297 | 297 | } else { |
| 298 | - throw new TDBMException('PropertyDescriptor of class `' . get_class($descriptor) . '` cannot be serialized.'); |
|
| 298 | + throw new TDBMException('PropertyDescriptor of class `'.get_class($descriptor).'` cannot be serialized.'); |
|
| 299 | 299 | } |
| 300 | 300 | } |
| 301 | - return '[' . implode(', ', $rows) . ']'; |
|
| 301 | + return '['.implode(', ', $rows).']'; |
|
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | private function getBeanPropertyDescriptor(string $column): AbstractBeanPropertyDescriptor |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | return $descriptor; |
| 312 | 312 | } |
| 313 | 313 | } |
| 314 | - throw new TDBMException('PropertyDescriptor for `'.$this->table->getName().'`.`' . $column . '` not found in `' . $this->foreignBeanDescriptor->getTable()->getName() . '`'); |
|
| 314 | + throw new TDBMException('PropertyDescriptor for `'.$this->table->getName().'`.`'.$column.'` not found in `'.$this->foreignBeanDescriptor->getTable()->getName().'`'); |
|
| 315 | 315 | } |
| 316 | 316 | |
| 317 | 317 | /** |