@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | 'time', |
163 | 163 | 'time_immutable', |
164 | 164 | ], true)) { |
165 | - if ($default !== null && in_array(strtoupper($default), ['CURRENT_TIMESTAMP' /* MySQL */, 'NOW()' /* PostgreSQL */, 'SYSDATE' /* Oracle */ , 'CURRENT_TIMESTAMP()' /* MariaDB 10.3 */], true)) { |
|
165 | + if ($default !== null && in_array(strtoupper($default), ['CURRENT_TIMESTAMP' /* MySQL */, 'NOW()' /* PostgreSQL */, 'SYSDATE' /* Oracle */, 'CURRENT_TIMESTAMP()' /* MariaDB 10.3 */], true)) { |
|
166 | 166 | $defaultCode = 'new \DateTimeImmutable()'; |
167 | 167 | } else { |
168 | 168 | throw new TDBMException('Unable to set default value for date in "'.$this->table->getName().'.'.$this->column->getName().'". Database passed this default value: "'.$default.'"'); |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | case 'v4': |
187 | 187 | return 'Uuid::uuid4()->toString()'; |
188 | 188 | default: |
189 | - throw new TDBMException('@UUID annotation accepts either "v1" or "v4" parameter. Unexpected parameter: ' . $comment); |
|
189 | + throw new TDBMException('@UUID annotation accepts either "v1" or "v4" parameter. Unexpected parameter: '.$comment); |
|
190 | 190 | } |
191 | 191 | } |
192 | 192 | |
@@ -234,14 +234,14 @@ discard block |
||
234 | 234 | $resourceTypeCheck = sprintf($resourceTypeCheck, $checkNullable, $variableName, $variableName); |
235 | 235 | } |
236 | 236 | |
237 | - $types = [ $normalizedType ]; |
|
237 | + $types = [$normalizedType]; |
|
238 | 238 | if ($isNullable) { |
239 | 239 | $types[] = 'null'; |
240 | 240 | } |
241 | 241 | |
242 | 242 | $paramType = null; |
243 | 243 | if ($this->isTypeHintable()) { |
244 | - $paramType = ($isNullable?'?':'').$normalizedType; |
|
244 | + $paramType = ($isNullable ? '?' : '').$normalizedType; |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | $getter = new MethodGenerator($columnGetterName); |
@@ -337,11 +337,11 @@ discard block |
||
337 | 337 | break; |
338 | 338 | } |
339 | 339 | } |
340 | - $args = array_map(function ($v) { |
|
340 | + $args = array_map(function($v) { |
|
341 | 341 | return var_export($v, true); |
342 | 342 | }, $args); |
343 | - $args = empty($args) ? '' : ', ' . implode(', ', $args); |
|
344 | - $unit = $jsonFormat->unit ? ' . ' . var_export($jsonFormat->unit, true) : ''; |
|
343 | + $args = empty($args) ? '' : ', '.implode(', ', $args); |
|
344 | + $unit = $jsonFormat->unit ? ' . '.var_export($jsonFormat->unit, true) : ''; |
|
345 | 345 | if ($this->column->getNotnull()) { |
346 | 346 | return "\$array['$index'] = number_format(\$this->$getter()$args)$unit;"; |
347 | 347 | } else { |
@@ -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 | } |
@@ -50,7 +50,7 @@ |
||
50 | 50 | |
51 | 51 | $pkColumnNames = $this->tdbmService->getPrimaryKeyColumns($this->mainTable); |
52 | 52 | $mysqlPlatform = new MySqlPlatform(); |
53 | - $pkColumnNames = array_map(function ($pkColumn) use ($mysqlPlatform) { |
|
53 | + $pkColumnNames = array_map(function($pkColumn) use ($mysqlPlatform) { |
|
54 | 54 | return $mysqlPlatform->quoteIdentifier($this->mainTable).'.'.$mysqlPlatform->quoteIdentifier($pkColumn); |
55 | 55 | }, $pkColumnNames); |
56 | 56 |
@@ -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; |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public static function createResultIterator(QueryFactory $queryFactory, array $parameters, ObjectStorageInterface $objectStorage, ?string $className, TDBMService $tdbmService, MagicQuery $magicQuery, int $mode, LoggerInterface $logger): self |
86 | 86 | { |
87 | - $iterator = new static(); |
|
87 | + $iterator = new static(); |
|
88 | 88 | if ($mode !== TDBMService::MODE_CURSOR && $mode !== TDBMService::MODE_ARRAY) { |
89 | 89 | throw new TDBMException("Unknown fetch mode: '".$mode."'"); |
90 | 90 | } |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | */ |
282 | 282 | public function jsonSerialize($stopRecursion = false) |
283 | 283 | { |
284 | - return array_map(function (AbstractTDBMObject $item) use ($stopRecursion) { |
|
284 | + return array_map(function(AbstractTDBMObject $item) use ($stopRecursion) { |
|
285 | 285 | return $item->jsonSerialize($stopRecursion); |
286 | 286 | }, $this->toArray()); |
287 | 287 | } |
@@ -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); |
@@ -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) { |
@@ -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); |