@@ -19,12 +19,12 @@ |
||
19 | 19 | */ |
20 | 20 | private static $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 |
@@ -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); |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | $alias = AbstractQueryFactory::getColumnAlias($tableName, $columnName); |
215 | 215 | $astColumn = [ |
216 | 216 | 'expr_type' => 'colref', |
217 | - 'base_expr' => $connection->quoteIdentifier($tableName) . '.' . $connection->quoteIdentifier($columnName), |
|
217 | + 'base_expr' => $connection->quoteIdentifier($tableName).'.'.$connection->quoteIdentifier($columnName), |
|
218 | 218 | 'no_quotes' => [ |
219 | 219 | 'delim' => '.', |
220 | 220 | 'parts' => [ |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | return $this->generateWrappedSqlCount($parsedSql); |
303 | 303 | } |
304 | 304 | |
305 | - $countSubExpr = array_map(function (array $item) { |
|
305 | + $countSubExpr = array_map(function(array $item) { |
|
306 | 306 | unset($item['alias']); |
307 | 307 | return $item; |
308 | 308 | }, $parsedSql['SELECT']); |
@@ -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); |
@@ -106,17 +106,17 @@ discard block |
||
106 | 106 | $schemaAnalyzer = new SchemaAnalyzer($schemaManager); |
107 | 107 | $tdbmSchemaAnalyzer = new TDBMSchemaAnalyzer($this->tdbmService->getConnection(), new ArrayCache(), $schemaAnalyzer); |
108 | 108 | $this->tdbmDaoGenerator = new TDBMDaoGenerator($this->getConfiguration(), $tdbmSchemaAnalyzer); |
109 | - $this->rootPath = __DIR__ . '/../'; |
|
109 | + $this->rootPath = __DIR__.'/../'; |
|
110 | 110 | //$this->tdbmDaoGenerator->setComposerFile($this->rootPath.'composer.json'); |
111 | 111 | } |
112 | 112 | |
113 | 113 | public function testDaoGeneration(): void |
114 | 114 | { |
115 | 115 | // Remove all previously generated files. |
116 | - $this->recursiveDelete($this->rootPath . 'src/Test/Dao/'); |
|
117 | - mkdir($this->rootPath . 'src/Test/Dao/Generated', 0755, true); |
|
116 | + $this->recursiveDelete($this->rootPath.'src/Test/Dao/'); |
|
117 | + mkdir($this->rootPath.'src/Test/Dao/Generated', 0755, true); |
|
118 | 118 | // Let's generate a dummy file to see it is indeed removed. |
119 | - $dummyFile = $this->rootPath . 'src/Test/Dao/Generated/foobar.php'; |
|
119 | + $dummyFile = $this->rootPath.'src/Test/Dao/Generated/foobar.php'; |
|
120 | 120 | touch($dummyFile); |
121 | 121 | $this->assertFileExists($dummyFile); |
122 | 122 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | |
127 | 127 | // Let's require all files to check they are valid PHP! |
128 | 128 | // Test the daoFactory |
129 | - require_once $this->rootPath . 'src/Test/Dao/Generated/DaoFactory.php'; |
|
129 | + require_once $this->rootPath.'src/Test/Dao/Generated/DaoFactory.php'; |
|
130 | 130 | // Test the others |
131 | 131 | |
132 | 132 | $beanDescriptors = $this->getDummyGeneratorListener()->getBeanDescriptors(); |
@@ -136,10 +136,10 @@ discard block |
||
136 | 136 | $daoBaseName = $beanDescriptor->getBaseDaoClassName(); |
137 | 137 | $beanName = $beanDescriptor->getBeanClassName(); |
138 | 138 | $baseBeanName = $beanDescriptor->getBaseBeanClassName(); |
139 | - require_once $this->rootPath . 'src/Test/Dao/Bean/Generated/' . $baseBeanName . '.php'; |
|
140 | - require_once $this->rootPath . 'src/Test/Dao/Bean/' . $beanName . '.php'; |
|
141 | - require_once $this->rootPath . 'src/Test/Dao/Generated/' . $daoBaseName . '.php'; |
|
142 | - require_once $this->rootPath . 'src/Test/Dao/' . $daoName . '.php'; |
|
139 | + require_once $this->rootPath.'src/Test/Dao/Bean/Generated/'.$baseBeanName.'.php'; |
|
140 | + require_once $this->rootPath.'src/Test/Dao/Bean/'.$beanName.'.php'; |
|
141 | + require_once $this->rootPath.'src/Test/Dao/Generated/'.$daoBaseName.'.php'; |
|
142 | + require_once $this->rootPath.'src/Test/Dao/'.$daoName.'.php'; |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | // Check that pivot tables do not generate DAOs or beans. |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | $schemaAnalyzer = new SchemaAnalyzer($schemaManager); |
155 | 155 | $tdbmSchemaAnalyzer = new TDBMSchemaAnalyzer($this->tdbmService->getConnection(), new ArrayCache(), $schemaAnalyzer); |
156 | 156 | $tdbmDaoGenerator = new TDBMDaoGenerator($configuration, $tdbmSchemaAnalyzer); |
157 | - $this->rootPath = __DIR__ . '/../../../../'; |
|
157 | + $this->rootPath = __DIR__.'/../../../../'; |
|
158 | 158 | //$tdbmDaoGenerator->setComposerFile($this->rootPath.'composer.json'); |
159 | 159 | |
160 | 160 | $this->expectException(NoPathFoundException::class); |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | if (is_file($str)) { |
173 | 173 | return @unlink($str); |
174 | 174 | } elseif (is_dir($str)) { |
175 | - $scan = glob(rtrim($str, '/') . '/*'); |
|
175 | + $scan = glob(rtrim($str, '/').'/*'); |
|
176 | 176 | foreach ($scan as $index => $path) { |
177 | 177 | $this->recursiveDelete($path); |
178 | 178 | } |
@@ -1985,7 +1985,7 @@ discard block |
||
1985 | 1985 | { |
1986 | 1986 | $artists = new ArtistDao($this->tdbmService); |
1987 | 1987 | $pinkFloyd = $artists->getById(1); |
1988 | - $animals = $pinkFloyd->getAlbums()[0]; |
|
1988 | + $animals = $pinkFloyd->getAlbums()[0]; |
|
1989 | 1989 | $json = $pinkFloyd->jsonSerialize(); |
1990 | 1990 | // Collection name properly handled ('discography' instead of default 'albums') |
1991 | 1991 | self::assertTrue(isset($json['discography'])); |
@@ -2212,7 +2212,7 @@ discard block |
||
2212 | 2212 | |
2213 | 2213 | public function testMysqlStatementCount(): void |
2214 | 2214 | { |
2215 | - if (! $this->tdbmService->getConnection() instanceof MysqliConnection) { |
|
2215 | + if (!$this->tdbmService->getConnection() instanceof MysqliConnection) { |
|
2216 | 2216 | $this->markTestSkipped('This test only applies for MySQLi driver.'); |
2217 | 2217 | } |
2218 | 2218 | try { |
@@ -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 |