@@ -44,8 +44,8 @@ |
||
| 44 | 44 | { |
| 45 | 45 | if ($this->cacheKey === null) { |
| 46 | 46 | $this->cacheKey = new CacheKey( |
| 47 | - function () { return $this->cacheNamespace(); }, |
|
| 48 | - $key ?? function () { return $this->cacheKey(); }, |
|
| 47 | + function() { return $this->cacheNamespace(); }, |
|
| 48 | + $key ?? function() { return $this->cacheKey(); }, |
|
| 49 | 49 | $lifetime |
| 50 | 50 | ); |
| 51 | 51 | |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | $count = 0; |
| 109 | 109 | |
| 110 | 110 | foreach ($this->execute() as $result) { |
| 111 | - $count += (int)$result['aggregate']; |
|
| 111 | + $count += (int) $result['aggregate']; |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | $this->compilerState->invalidate(['columns', 'orders']); |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | #[ReadOperation] |
| 124 | 124 | public function count($column = null) |
| 125 | 125 | { |
| 126 | - return (int)array_sum($this->aggregate(__FUNCTION__, $column)); |
|
| 126 | + return (int) array_sum($this->aggregate(__FUNCTION__, $column)); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | /** |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | { |
| 135 | 135 | $numbers = $this->aggregate(__FUNCTION__, $column); |
| 136 | 136 | |
| 137 | - return array_sum($numbers)/count($numbers); |
|
| 137 | + return array_sum($numbers) / count($numbers); |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | /** |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | #[ReadOperation] |
| 144 | 144 | public function min($column = null) |
| 145 | 145 | { |
| 146 | - return (float)min($this->aggregate(__FUNCTION__, $column)); |
|
| 146 | + return (float) min($this->aggregate(__FUNCTION__, $column)); |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | /** |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | #[ReadOperation] |
| 153 | 153 | public function max($column = null) |
| 154 | 154 | { |
| 155 | - return (float)max($this->aggregate(__FUNCTION__, $column)); |
|
| 155 | + return (float) max($this->aggregate(__FUNCTION__, $column)); |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | /** |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | #[ReadOperation] |
| 162 | 162 | public function sum($column = null) |
| 163 | 163 | { |
| 164 | - return (float)array_sum($this->aggregate(__FUNCTION__, $column)); |
|
| 164 | + return (float) array_sum($this->aggregate(__FUNCTION__, $column)); |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | /** |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | #[WriteOperation] |
| 154 | 154 | public function saveAll($relations = []) |
| 155 | 155 | { |
| 156 | - return $this->relation->saveAll($this->owner, (array)$relations); |
|
| 156 | + return $this->relation->saveAll($this->owner, (array) $relations); |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | /** |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | #[WriteOperation] |
| 168 | 168 | public function deleteAll($relations = []) |
| 169 | 169 | { |
| 170 | - return $this->relation->deleteAll($this->owner, (array)$relations); |
|
| 170 | + return $this->relation->deleteAll($this->owner, (array) $relations); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | /** |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | */ |
| 143 | 143 | public function ignore($flag = true) |
| 144 | 144 | { |
| 145 | - $this->statements['ignore'] = (bool)$flag; |
|
| 145 | + $this->statements['ignore'] = (bool) $flag; |
|
| 146 | 146 | |
| 147 | 147 | return $this; |
| 148 | 148 | } |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | $this->statements['offset'] = null; |
| 267 | 267 | $this->statements['aggregate'] = ['pagination', $this->getPaginationColumns($columns)]; |
| 268 | 268 | |
| 269 | - $count = (int)$this->execute()[0]['aggregate']; |
|
| 269 | + $count = (int) $this->execute()[0]['aggregate']; |
|
| 270 | 270 | |
| 271 | 271 | $this->compilerState->invalidate(['columns', 'orders']); |
| 272 | 272 | $this->statements = $statements; |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | #[ReadOperation] |
| 312 | 312 | public function count($column = null) |
| 313 | 313 | { |
| 314 | - return (int)$this->aggregate(__FUNCTION__, $column); |
|
| 314 | + return (int) $this->aggregate(__FUNCTION__, $column); |
|
| 315 | 315 | } |
| 316 | 316 | |
| 317 | 317 | /** |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | #[ReadOperation] |
| 321 | 321 | public function avg($column = null) |
| 322 | 322 | { |
| 323 | - return (float)$this->aggregate(__FUNCTION__, $column); |
|
| 323 | + return (float) $this->aggregate(__FUNCTION__, $column); |
|
| 324 | 324 | } |
| 325 | 325 | |
| 326 | 326 | /** |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | #[ReadOperation] |
| 330 | 330 | public function min($column = null) |
| 331 | 331 | { |
| 332 | - return (float)$this->aggregate(__FUNCTION__, $column); |
|
| 332 | + return (float) $this->aggregate(__FUNCTION__, $column); |
|
| 333 | 333 | } |
| 334 | 334 | |
| 335 | 335 | /** |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | #[ReadOperation] |
| 339 | 339 | public function max($column = null) |
| 340 | 340 | { |
| 341 | - return (float)$this->aggregate(__FUNCTION__, $column); |
|
| 341 | + return (float) $this->aggregate(__FUNCTION__, $column); |
|
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | /** |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | #[ReadOperation] |
| 348 | 348 | public function sum($column = null) |
| 349 | 349 | { |
| 350 | - return (float)$this->aggregate(__FUNCTION__, $column); |
|
| 350 | + return (float) $this->aggregate(__FUNCTION__, $column); |
|
| 351 | 351 | } |
| 352 | 352 | |
| 353 | 353 | /** |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | { |
| 378 | 378 | $this->compilerState->invalidate('columns'); |
| 379 | 379 | |
| 380 | - $this->statements['distinct'] = (bool)$flag; |
|
| 380 | + $this->statements['distinct'] = (bool) $flag; |
|
| 381 | 381 | |
| 382 | 382 | return $this; |
| 383 | 383 | } |
@@ -562,7 +562,7 @@ discard block |
||
| 562 | 562 | # build a regular expression for each parameter |
| 563 | 563 | foreach ($values as $key => $value) { |
| 564 | 564 | if (is_string($key)) { |
| 565 | - $keys[] = '/:' . $key . '/'; |
|
| 565 | + $keys[] = '/:'.$key.'/'; |
|
| 566 | 566 | } else { |
| 567 | 567 | $keys[] = '/[?]/'; |
| 568 | 568 | } |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | #[ReadOperation] |
| 69 | 69 | public function load($relations) |
| 70 | 70 | { |
| 71 | - foreach (Relation::sanitizeRelations((array)$relations) as $relationName => $meta) { |
|
| 71 | + foreach (Relation::sanitizeRelations((array) $relations) as $relationName => $meta) { |
|
| 72 | 72 | $this->repository->relation($relationName)->load( |
| 73 | 73 | EntityIndexer::fromArray($this->repository->mapper(), $this->storage->all()), |
| 74 | 74 | $meta['relations'], |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | #[WriteOperation] |
| 134 | 134 | public function delete() |
| 135 | 135 | { |
| 136 | - $this->repository->transaction(function (RepositoryInterface $repository) { |
|
| 136 | + $this->repository->transaction(function(RepositoryInterface $repository) { |
|
| 137 | 137 | $writer = new BufferedWriter($repository); |
| 138 | 138 | |
| 139 | 139 | foreach ($this as $entity) { |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | #[WriteOperation] |
| 156 | 156 | public function save() |
| 157 | 157 | { |
| 158 | - $this->repository->transaction(function (RepositoryInterface $repository) { |
|
| 158 | + $this->repository->transaction(function(RepositoryInterface $repository) { |
|
| 159 | 159 | foreach ($this as $entity) { |
| 160 | 160 | $repository->save($entity); |
| 161 | 161 | } |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | #[WriteOperation] |
| 177 | 177 | public function saveAll($relations) |
| 178 | 178 | { |
| 179 | - $relations = Relation::sanitizeRelations((array)$relations); |
|
| 179 | + $relations = Relation::sanitizeRelations((array) $relations); |
|
| 180 | 180 | |
| 181 | 181 | return $this->repository->transaction(function(RepositoryInterface $repository) use($relations) { |
| 182 | 182 | $nb = 0; |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | #[WriteOperation] |
| 206 | 206 | public function deleteAll($relations) |
| 207 | 207 | { |
| 208 | - $relations = Relation::sanitizeRelations((array)$relations); |
|
| 208 | + $relations = Relation::sanitizeRelations((array) $relations); |
|
| 209 | 209 | |
| 210 | 210 | return $this->repository->transaction(function(RepositoryInterface $repository) use($relations) { |
| 211 | 211 | $nb = 0; |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | #[ReadOperation] |
| 308 | 308 | public function loadRelations($entity, $relations) |
| 309 | 309 | { |
| 310 | - foreach (Relation::sanitizeRelations((array)$relations) as $relationName => $meta) { |
|
| 310 | + foreach (Relation::sanitizeRelations((array) $relations) as $relationName => $meta) { |
|
| 311 | 311 | $this->relation($relationName)->loadIfNotLoaded( |
| 312 | 312 | new SingleEntityIndexer($this->mapper, $entity), |
| 313 | 313 | $meta['relations'], |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | #[ReadOperation] |
| 331 | 331 | public function reloadRelations($entity, $relations) |
| 332 | 332 | { |
| 333 | - foreach (Relation::sanitizeRelations((array)$relations) as $relationName => $meta) { |
|
| 333 | + foreach (Relation::sanitizeRelations((array) $relations) as $relationName => $meta) { |
|
| 334 | 334 | $this->relation($relationName)->load( |
| 335 | 335 | new SingleEntityIndexer($this->mapper, $entity), |
| 336 | 336 | $meta['relations'], |
@@ -376,12 +376,12 @@ discard block |
||
| 376 | 376 | #[WriteOperation] |
| 377 | 377 | public function saveAll($entity, $relations) |
| 378 | 378 | { |
| 379 | - $relations = Relation::sanitizeRelations((array)$relations); |
|
| 379 | + $relations = Relation::sanitizeRelations((array) $relations); |
|
| 380 | 380 | |
| 381 | 381 | return $this->transaction(function() use($entity, $relations) { |
| 382 | 382 | $nb = $this->save($entity); |
| 383 | 383 | |
| 384 | - foreach ((array)$relations as $relationName => $info) { |
|
| 384 | + foreach ((array) $relations as $relationName => $info) { |
|
| 385 | 385 | $nb += $this->relation($relationName)->saveAll($entity, $info['relations']); |
| 386 | 386 | } |
| 387 | 387 | |
@@ -401,12 +401,12 @@ discard block |
||
| 401 | 401 | #[WriteOperation] |
| 402 | 402 | public function deleteAll($entity, $relations) |
| 403 | 403 | { |
| 404 | - $relations = Relation::sanitizeRelations((array)$relations); |
|
| 404 | + $relations = Relation::sanitizeRelations((array) $relations); |
|
| 405 | 405 | |
| 406 | 406 | return $this->transaction(function() use($entity, $relations) { |
| 407 | 407 | $nb = $this->delete($entity); |
| 408 | 408 | |
| 409 | - foreach ((array)$relations as $relationName => $info) { |
|
| 409 | + foreach ((array) $relations as $relationName => $info) { |
|
| 410 | 410 | $nb += $this->relation($relationName)->deleteAll($entity, $info['relations']); |
| 411 | 411 | } |
| 412 | 412 | |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | foreach ($query->statements['tables'] as $table) { |
| 187 | 187 | return $query->state()->compiled = 'UPDATE ' |
| 188 | 188 | . $this->quoteIdentifier($query, $table['table']) |
| 189 | - . ' SET ' . implode(', ', $values) |
|
| 189 | + . ' SET '.implode(', ', $values) |
|
| 190 | 190 | . $this->compileWhere($query) |
| 191 | 191 | ; |
| 192 | 192 | } |
@@ -524,7 +524,7 @@ discard block |
||
| 524 | 524 | $from['sql'] = $this->quoteIdentifier($query, $databasePrefix.$from['table']); |
| 525 | 525 | $compiled[$from['table']] = $from; |
| 526 | 526 | } else { |
| 527 | - $from['sql'] = $this->quoteIdentifier($query, $databasePrefix.$from['table']) . ' ' . $this->quoteIdentifier($query, $from['alias']); |
|
| 527 | + $from['sql'] = $this->quoteIdentifier($query, $databasePrefix.$from['table']).' '.$this->quoteIdentifier($query, $from['alias']); |
|
| 528 | 528 | $compiled[$from['alias']] = $from; |
| 529 | 529 | } |
| 530 | 530 | } |
@@ -697,7 +697,7 @@ discard block |
||
| 697 | 697 | if (is_array($value)) { |
| 698 | 698 | return $this->compileIntoExpression($query, $value, $column, 'REGEXP', $converted); |
| 699 | 699 | } |
| 700 | - return $this->quoteIdentifier($query, $column).' REGEXP '.$this->compileExpressionValue($query, (string)$value, $converted); |
|
| 700 | + return $this->quoteIdentifier($query, $column).' REGEXP '.$this->compileExpressionValue($query, (string) $value, $converted); |
|
| 701 | 701 | |
| 702 | 702 | // LIKE |
| 703 | 703 | case ':like': |
@@ -770,7 +770,7 @@ discard block |
||
| 770 | 770 | |
| 771 | 771 | // Unsupported operator |
| 772 | 772 | default: |
| 773 | - throw new UnexpectedValueException("Unsupported operator '" . $operator . "' in WHERE clause"); |
|
| 773 | + throw new UnexpectedValueException("Unsupported operator '".$operator."' in WHERE clause"); |
|
| 774 | 774 | } |
| 775 | 775 | } |
| 776 | 776 | |
@@ -858,7 +858,7 @@ discard block |
||
| 858 | 858 | $sql = '('.$this->compileSelect($query).')'; |
| 859 | 859 | |
| 860 | 860 | if ($alias) { |
| 861 | - $sql = $sql . ' as ' . $this->quoteIdentifier($clause, $alias); |
|
| 861 | + $sql = $sql.' as '.$this->quoteIdentifier($clause, $alias); |
|
| 862 | 862 | } |
| 863 | 863 | |
| 864 | 864 | $this->addQueryBindings($clause, $query); |
@@ -1016,12 +1016,12 @@ discard block |
||
| 1016 | 1016 | if ($lock !== null && !$query->statements['aggregate']) { |
| 1017 | 1017 | // Lock for update |
| 1018 | 1018 | if ($lock === LockMode::PESSIMISTIC_WRITE) { |
| 1019 | - return ' ' . $this->platform()->grammar()->getWriteLockSQL(); |
|
| 1019 | + return ' '.$this->platform()->grammar()->getWriteLockSQL(); |
|
| 1020 | 1020 | } |
| 1021 | 1021 | |
| 1022 | 1022 | // Shared Lock: other process can read the row but not update it. |
| 1023 | 1023 | if ($lock === LockMode::PESSIMISTIC_READ) { |
| 1024 | - return ' ' . $this->platform()->grammar()->getReadLockSQL(); |
|
| 1024 | + return ' '.$this->platform()->grammar()->getReadLockSQL(); |
|
| 1025 | 1025 | } |
| 1026 | 1026 | } |
| 1027 | 1027 | |
@@ -114,7 +114,7 @@ |
||
| 114 | 114 | private function getConnectionParameters(string $connectionName): array |
| 115 | 115 | { |
| 116 | 116 | if (!isset($this->parametersMap[$connectionName])) { |
| 117 | - throw new DBALException('Connection name "' . $connectionName . '" is not set'); |
|
| 117 | + throw new DBALException('Connection name "'.$connectionName.'" is not set'); |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | $parameters = $this->parametersMap[$connectionName]; |
@@ -15,6 +15,6 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | public function __construct(string $entity, string $field) |
| 17 | 17 | { |
| 18 | - parent::__construct('The field "' . $field . '" is not declared for the entity ' . $entity); |
|
| 18 | + parent::__construct('The field "'.$field.'" is not declared for the entity '.$entity); |
|
| 19 | 19 | } |
| 20 | 20 | } |