@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | 'time', |
164 | 164 | 'time_immutable', |
165 | 165 | ], true)) { |
166 | - if ($default !== null && in_array(strtoupper($default), ['CURRENT_TIMESTAMP' /* MySQL */, 'NOW()' /* PostgreSQL */, 'SYSDATE' /* Oracle */ , 'CURRENT_TIMESTAMP()' /* MariaDB 10.3 */], true)) { |
|
166 | + if ($default !== null && in_array(strtoupper($default), ['CURRENT_TIMESTAMP' /* MySQL */, 'NOW()' /* PostgreSQL */, 'SYSDATE' /* Oracle */, 'CURRENT_TIMESTAMP()' /* MariaDB 10.3 */], true)) { |
|
167 | 167 | $defaultCode = 'new \DateTimeImmutable()'; |
168 | 168 | } else { |
169 | 169 | throw new TDBMException('Unable to set default value for date in "'.$this->table->getName().'.'.$this->column->getName().'". Database passed this default value: "'.$default.'"'); |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | case 'v4': |
188 | 188 | return 'Uuid::uuid4()->toString()'; |
189 | 189 | default: |
190 | - throw new TDBMException('@UUID annotation accepts either "v1" or "v4" parameter. Unexpected parameter: ' . $comment); |
|
190 | + throw new TDBMException('@UUID annotation accepts either "v1" or "v4" parameter. Unexpected parameter: '.$comment); |
|
191 | 191 | } |
192 | 192 | } |
193 | 193 | |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | $resourceTypeCheck = sprintf($resourceTypeCheck, $checkNullable, $variableName, $variableName); |
236 | 236 | } |
237 | 237 | |
238 | - $types = [ $normalizedType ]; |
|
238 | + $types = [$normalizedType]; |
|
239 | 239 | if ($isNullable) { |
240 | 240 | $types[] = 'null'; |
241 | 241 | } |
@@ -338,11 +338,11 @@ discard block |
||
338 | 338 | break; |
339 | 339 | } |
340 | 340 | } |
341 | - $args = array_map(function ($v) { |
|
341 | + $args = array_map(function($v) { |
|
342 | 342 | return var_export($v, true); |
343 | 343 | }, $args); |
344 | - $args = empty($args) ? '' : ', ' . implode(', ', $args); |
|
345 | - $unit = $jsonFormat->unit ? ' . ' . var_export($jsonFormat->unit, true) : ''; |
|
344 | + $args = empty($args) ? '' : ', '.implode(', ', $args); |
|
345 | + $unit = $jsonFormat->unit ? ' . '.var_export($jsonFormat->unit, true) : ''; |
|
346 | 346 | if ($this->column->getNotnull()) { |
347 | 347 | return "\$array['$index'] = number_format(\$this->$getter()$args)$unit;"; |
348 | 348 | } else { |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | */ |
259 | 259 | protected function setRef(string $foreignKeyName, ?AbstractTDBMObject $bean, string $tableName, string $className, string $resultIteratorClass): void |
260 | 260 | { |
261 | - assert($bean === null || is_a($bean, $className), new TDBMInvalidArgumentException('$bean should be `null` or `' . $className . '`. `' . ($bean === null ? 'null' : get_class($bean)) . '` provided.')); |
|
261 | + assert($bean === null || is_a($bean, $className), new TDBMInvalidArgumentException('$bean should be `null` or `'.$className.'`. `'.($bean === null ? 'null' : get_class($bean)).'` provided.')); |
|
262 | 262 | |
263 | 263 | if (!isset($this->dbRows[$tableName])) { |
264 | 264 | $this->registerTable($tableName); |
@@ -522,7 +522,7 @@ discard block |
||
522 | 522 | */ |
523 | 523 | protected function retrieveManyToOneRelationshipsStorage(string $tableName, string $foreignKeyName, array $searchFilter, ?string $orderString, string $resultIteratorClass): AlterableResultIterator |
524 | 524 | { |
525 | - assert(is_a($resultIteratorClass, ResultIterator::class, true), new TDBMInvalidArgumentException('$resultIteratorClass should be a `'. ResultIterator::class. '`. `' . $resultIteratorClass . '` provided.')); |
|
525 | + assert(is_a($resultIteratorClass, ResultIterator::class, true), new TDBMInvalidArgumentException('$resultIteratorClass should be a `'.ResultIterator::class.'`. `'.$resultIteratorClass.'` provided.')); |
|
526 | 526 | $key = $tableName.'___'.$foreignKeyName; |
527 | 527 | $alterableResultIterator = $this->getManyToOneAlterableResultIterator($tableName, $foreignKeyName); |
528 | 528 | if ($this->status === TDBMObjectStateEnum::STATE_DETACHED || $this->status === TDBMObjectStateEnum::STATE_NEW || (isset($this->manyToOneRelationships[$key]) && $this->manyToOneRelationships[$key]->getUnderlyingResultIterator() !== null)) { |
@@ -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); |
@@ -137,7 +137,7 @@ |
||
137 | 137 | if ($this->fetchStarted && $this->tdbmService->getConnection()->getDatabasePlatform() instanceof MySqlPlatform) { |
138 | 138 | // Optimisation: we don't need a separate "count" SQL request in MySQL. |
139 | 139 | assert($this->statement instanceof Statement || $this->statement instanceof Result); |
140 | - $this->count = (int)$this->statement->rowCount(); |
|
140 | + $this->count = (int) $this->statement->rowCount(); |
|
141 | 141 | return $this->count; |
142 | 142 | } |
143 | 143 | return $this->getRowCountViaSqlQuery(); |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | // Let's add the ORDER BY if any |
143 | 143 | if (isset($parsedSql['0']['ORDER'])) { |
144 | 144 | $orderByBuilder = new OrderByBuilder(); |
145 | - $processedSql .= " " . $orderByBuilder->build($parsedSql['0']['ORDER']); |
|
145 | + $processedSql .= " ".$orderByBuilder->build($parsedSql['0']['ORDER']); |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | return [$processedSql, $sqlCount ?? $processedSqlCount, $columnDescriptors]; |
@@ -155,8 +155,8 @@ discard block |
||
155 | 155 | { |
156 | 156 | $selectBuilder = new SelectStatementBuilder(); |
157 | 157 | |
158 | - return implode(' UNION ', array_map(function ($clause) use ($selectBuilder) { |
|
159 | - return '(' . $selectBuilder->build($clause) . ')'; |
|
158 | + return implode(' UNION ', array_map(function($clause) use ($selectBuilder) { |
|
159 | + return '('.$selectBuilder->build($clause).')'; |
|
160 | 160 | }, $parsed['UNION'])); |
161 | 161 | } |
162 | 162 | |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | $alias = AbstractQueryFactory::getColumnAlias($tableName, $columnName); |
239 | 239 | $astColumn = [ |
240 | 240 | 'expr_type' => 'colref', |
241 | - 'base_expr' => $connection->quoteIdentifier($tableName) . '.' . $connection->quoteIdentifier($columnName), |
|
241 | + 'base_expr' => $connection->quoteIdentifier($tableName).'.'.$connection->quoteIdentifier($columnName), |
|
242 | 242 | 'no_quotes' => [ |
243 | 243 | 'delim' => '.', |
244 | 244 | 'parts' => [ |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | return $this->generateWrappedSqlCount($parsedSql); |
327 | 327 | } |
328 | 328 | |
329 | - $countSubExpr = array_map(function (array $item) { |
|
329 | + $countSubExpr = array_map(function(array $item) { |
|
330 | 330 | unset($item['alias']); |
331 | 331 | return $item; |
332 | 332 | }, $parsedSql['SELECT']); |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | $item['delim'] = ','; |
404 | 404 | $innerColumns[] = $item; |
405 | 405 | } |
406 | - $innerColumns[count($innerColumns)-1]['delim'] = false; |
|
406 | + $innerColumns[count($innerColumns) - 1]['delim'] = false; |
|
407 | 407 | $parsedSql['SELECT'] = $innerColumns; |
408 | 408 | |
409 | 409 | $parsedSql = [ |