@@ -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 |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | public static function generateModelKey(ForeignKeyConstraint $remoteFk, ForeignKeyConstraint $localFk): string |
| 50 | 50 | { |
| 51 | - return $remoteFk->getLocalTableName() . "." . implode("__", $localFk->getUnquotedLocalColumns()); |
|
| 51 | + return $remoteFk->getLocalTableName().".".implode("__", $localFk->getUnquotedLocalColumns()); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | public function getPivotName(): string |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | $join[] = sprintf('%s.%s = %s.%s', $mainTable, $column, $pivotTable, $this->joinLocalKeys[$key]); |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - return $mainTable . ' JOIN ' . $pivotTable . ' ON ' . implode(' AND ', $join); |
|
| 74 | + return $mainTable.' JOIN '.$pivotTable.' ON '.implode(' AND ', $join); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | public function getPivotWhere(): string |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | { |
| 92 | 92 | $params = []; |
| 93 | 93 | foreach ($primaryKeys as $key => $primaryKeyValue) { |
| 94 | - $params['param' . $key] = $primaryKeyValue; |
|
| 94 | + $params['param'.$key] = $primaryKeyValue; |
|
| 95 | 95 | } |
| 96 | 96 | return $params; |
| 97 | 97 | } |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | */ |
| 88 | 88 | public function getPhpType(): string |
| 89 | 89 | { |
| 90 | - return '\\' . $this->beanNamespace . '\\' . $this->getClassName(); |
|
| 90 | + return '\\'.$this->beanNamespace.'\\'.$this->getClassName(); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | /** |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | $referencedBeanName = $this->namingStrategy->getBeanClassName($this->foreignKey->getForeignTableName()); |
| 161 | 161 | |
| 162 | 162 | $getter = new MethodGenerator($getterName); |
| 163 | - $getter->setDocBlock(new DocBlockGenerator('Returns the ' . $referencedBeanName . ' object bound to this object via the ' . implode(' and ', $this->foreignKey->getUnquotedLocalColumns()) . ' column.')); |
|
| 163 | + $getter->setDocBlock(new DocBlockGenerator('Returns the '.$referencedBeanName.' object bound to this object via the '.implode(' and ', $this->foreignKey->getUnquotedLocalColumns()).' column.')); |
|
| 164 | 164 | |
| 165 | 165 | /*$types = [ $referencedBeanName ]; |
| 166 | 166 | if ($isNullable) { |
@@ -168,10 +168,10 @@ discard block |
||
| 168 | 168 | } |
| 169 | 169 | $getter->getDocBlock()->setTag(new ReturnTag($types));*/ |
| 170 | 170 | |
| 171 | - $getter->setReturnType(($isNullable ? '?' : '') . $this->beanNamespace . '\\' . $referencedBeanName); |
|
| 171 | + $getter->setReturnType(($isNullable ? '?' : '').$this->beanNamespace.'\\'.$referencedBeanName); |
|
| 172 | 172 | $tdbmFk = ForeignKey::createFromFk($this->foreignKey); |
| 173 | 173 | |
| 174 | - $getter->setBody('return $this->getRef(' . var_export($tdbmFk->getCacheKey(), true) . ', ' . var_export($tableName, true) . ');'); |
|
| 174 | + $getter->setBody('return $this->getRef('.var_export($tdbmFk->getCacheKey(), true).', '.var_export($tableName, true).');'); |
|
| 175 | 175 | |
| 176 | 176 | if ($this->isGetterProtected()) { |
| 177 | 177 | $getter->setVisibility(AbstractMemberGenerator::VISIBILITY_PROTECTED); |
@@ -179,13 +179,13 @@ discard block |
||
| 179 | 179 | |
| 180 | 180 | if (!$this->isReadOnly()) { |
| 181 | 181 | $setter = new MethodGenerator($setterName); |
| 182 | - $setter->setDocBlock(new DocBlockGenerator('The setter for the ' . $referencedBeanName . ' object bound to this object via the ' . implode(' and ', $this->foreignKey->getUnquotedLocalColumns()) . ' column.')); |
|
| 182 | + $setter->setDocBlock(new DocBlockGenerator('The setter for the '.$referencedBeanName.' object bound to this object via the '.implode(' and ', $this->foreignKey->getUnquotedLocalColumns()).' column.')); |
|
| 183 | 183 | |
| 184 | - $setter->setParameter(new ParameterGenerator('object', ($isNullable ? '?' : '') . $this->beanNamespace . '\\' . $referencedBeanName)); |
|
| 184 | + $setter->setParameter(new ParameterGenerator('object', ($isNullable ? '?' : '').$this->beanNamespace.'\\'.$referencedBeanName)); |
|
| 185 | 185 | |
| 186 | 186 | $setter->setReturnType('void'); |
| 187 | 187 | |
| 188 | - $setter->setBody('$this->setRef(' . var_export($tdbmFk->getCacheKey(), true) . ', $object, ' . var_export($tableName, true) . ');'); |
|
| 188 | + $setter->setBody('$this->setRef('.var_export($tdbmFk->getCacheKey(), true).', $object, '.var_export($tableName, true).');'); |
|
| 189 | 189 | |
| 190 | 190 | if ($this->isSetterProtected()) { |
| 191 | 191 | $setter->setVisibility(AbstractMemberGenerator::VISIBILITY_PROTECTED); |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | /** @var Annotation\JsonFormat|null $jsonFormat */ |
| 225 | 225 | $jsonFormat = $this->findAnnotation(Annotation\JsonFormat::class); |
| 226 | 226 | if ($jsonFormat !== null) { |
| 227 | - $method = $jsonFormat->method ?? 'get' . ucfirst($jsonFormat->property); |
|
| 227 | + $method = $jsonFormat->method ?? 'get'.ucfirst($jsonFormat->property); |
|
| 228 | 228 | $format = "$method()"; |
| 229 | 229 | } else { |
| 230 | 230 | $stopRecursion = $this->findAnnotation(Annotation\JsonRecursive::class) ? '' : 'true'; |
@@ -280,10 +280,10 @@ discard block |
||
| 280 | 280 | } elseif ($descriptor instanceof ScalarBeanPropertyDescriptor) { |
| 281 | 281 | $rows[] = "'$indexName' => $propertyAccess->$columnGetterName()"; |
| 282 | 282 | } else { |
| 283 | - throw new TDBMException('PropertyDescriptor of class `' . get_class($descriptor) . '` cannot be serialized.'); |
|
| 283 | + throw new TDBMException('PropertyDescriptor of class `'.get_class($descriptor).'` cannot be serialized.'); |
|
| 284 | 284 | } |
| 285 | 285 | } |
| 286 | - return '[' . implode(', ', $rows) . ']'; |
|
| 286 | + return '['.implode(', ', $rows).']'; |
|
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | private function getBeanPropertyDescriptor(string $column): AbstractBeanPropertyDescriptor |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | foreach ($this->foreignBeanDescriptor->getBeanPropertyDescriptors() as $descriptor) { |
| 292 | 292 | fwrite(STDERR, $descriptor->getTable()->getName()); |
| 293 | 293 | if ($descriptor instanceof ScalarBeanPropertyDescriptor) { |
| 294 | - fwrite(STDERR, $descriptor->getColumnName() . PHP_EOL); |
|
| 294 | + fwrite(STDERR, $descriptor->getColumnName().PHP_EOL); |
|
| 295 | 295 | } elseif ($descriptor instanceof ObjectBeanPropertyDescriptor) { |
| 296 | 296 | fwrite(STDERR, print_r($descriptor->getForeignKey()->getLocalColumns(), true)); |
| 297 | 297 | } |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | return $descriptor; |
| 303 | 303 | } |
| 304 | 304 | } |
| 305 | - throw new TDBMException('PropertyDescriptor for `'.$this->table->getName().'`.`' . $column . '` not found in `' . $this->foreignBeanDescriptor->getTable()->getName() . '`'); |
|
| 305 | + throw new TDBMException('PropertyDescriptor for `'.$this->table->getName().'`.`'.$column.'` not found in `'.$this->foreignBeanDescriptor->getTable()->getName().'`'); |
|
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | /** |