@@ -77,7 +77,7 @@ |
||
| 77 | 77 | * |
| 78 | 78 | * @return int|numeric-string |
| 79 | 79 | */ |
| 80 | - public static function exec(string $sql): int|string |
|
| 80 | + public static function exec(string $sql): int | string |
|
| 81 | 81 | { |
| 82 | 82 | return self::getDB()->exec($sql); |
| 83 | 83 | } |
@@ -53,7 +53,7 @@ |
||
| 53 | 53 | * |
| 54 | 54 | * @return int|numeric-string |
| 55 | 55 | */ |
| 56 | - public function exec(string $sql, array $params = []): int|string |
|
| 56 | + public function exec(string $sql, array $params = []): int | string |
|
| 57 | 57 | { |
| 58 | 58 | return $this->connection->executeStatement($sql, $params); |
| 59 | 59 | } |
@@ -6,10 +6,10 @@ |
||
| 6 | 6 | |
| 7 | 7 | return RectorConfig::configure() |
| 8 | 8 | ->withPaths([ |
| 9 | - __DIR__ . '/src', |
|
| 10 | - __DIR__ . '/tests', |
|
| 9 | + __DIR__.'/src', |
|
| 10 | + __DIR__.'/tests', |
|
| 11 | 11 | ]) |
| 12 | 12 | // uncomment to reach your current PHP version |
| 13 | 13 | ->withPhpSets(php83:true) |
| 14 | 14 | ->withAttributesSets() |
| 15 | - ->withPreparedSets(deadCode:true,typeDeclarations:true,codeQuality:true); |
|
| 15 | + ->withPreparedSets(deadCode:true, typeDeclarations:true, codeQuality:true); |
|
@@ -134,9 +134,9 @@ discard block |
||
| 134 | 134 | |
| 135 | 135 | $qb = $this->recordManager->find(strtolower((string) $parts[1])); |
| 136 | 136 | $qb->where($this->getName() . '_id = :id') |
| 137 | - ->setParameter('id', $this->__meta['id'], |
|
| 137 | + ->setParameter('id', $this->__meta['id'], |
|
| 138 | 138 | $this->determineIdType($this->__meta['id']) |
| 139 | - ); |
|
| 139 | + ); |
|
| 140 | 140 | |
| 141 | 141 | $result = $qb->get(); |
| 142 | 142 | |
@@ -155,9 +155,9 @@ discard block |
||
| 155 | 155 | |
| 156 | 156 | $db = $this->recordManager->find($relTable); |
| 157 | 157 | $db->where($this->getName() . '_id = :id') |
| 158 | - ->setParameter('id', $this->__meta['id'], |
|
| 158 | + ->setParameter('id', $this->__meta['id'], |
|
| 159 | 159 | $this->determineIdType($this->__meta['id']) |
| 160 | - ); |
|
| 160 | + ); |
|
| 161 | 161 | |
| 162 | 162 | $relations = $db->get(); |
| 163 | 163 | $relIds = $this->extractRelationIds($relations, $targetTable); |
@@ -168,9 +168,9 @@ discard block |
||
| 168 | 168 | |
| 169 | 169 | $db = $this->recordManager->find($targetTable); |
| 170 | 170 | $db->where('id IN (:ids)') |
| 171 | - ->setParameter('ids', $relIds, |
|
| 171 | + ->setParameter('ids', $relIds, |
|
| 172 | 172 | $this->determineIdsType($relIds) |
| 173 | - ); |
|
| 173 | + ); |
|
| 174 | 174 | |
| 175 | 175 | $result = $db->get(); |
| 176 | 176 | |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | $qb = $this->recordManager->find(strtolower((string) $parts[1])); |
| 136 | - $qb->where($this->getName() . '_id = :id') |
|
| 136 | + $qb->where($this->getName().'_id = :id') |
|
| 137 | 137 | ->setParameter('id', $this->__meta['id'], |
| 138 | 138 | $this->determineIdType($this->__meta['id']) |
| 139 | 139 | ); |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | $relTable = $this->getRelationTable($targetTable); |
| 155 | 155 | |
| 156 | 156 | $db = $this->recordManager->find($relTable); |
| 157 | - $db->where($this->getName() . '_id = :id') |
|
| 157 | + $db->where($this->getName().'_id = :id') |
|
| 158 | 158 | ->setParameter('id', $this->__meta['id'], |
| 159 | 159 | $this->determineIdType($this->__meta['id']) |
| 160 | 160 | ); |
@@ -180,15 +180,15 @@ discard block |
||
| 180 | 180 | |
| 181 | 181 | private function getRelationTable(string $targetTable): string |
| 182 | 182 | { |
| 183 | - return $this->tableManager->tableExists($this->table . '_' . $targetTable) |
|
| 184 | - ? $this->table . '_' . $targetTable |
|
| 185 | - : $targetTable . '_' . $this->table; |
|
| 183 | + return $this->tableManager->tableExists($this->table.'_'.$targetTable) |
|
| 184 | + ? $this->table.'_'.$targetTable |
|
| 185 | + : $targetTable.'_'.$this->table; |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | private function extractRelationIds(Collection $relations, string $targetTable): array |
| 189 | 189 | { |
| 190 | - return $relations->map(function ($relation) use ($targetTable) { |
|
| 191 | - $key = $targetTable . '_id'; |
|
| 190 | + return $relations->map(function($relation) use ($targetTable) { |
|
| 191 | + $key = $targetTable.'_id'; |
|
| 192 | 192 | |
| 193 | 193 | return $relation->$key; |
| 194 | 194 | })->toArray(); |
@@ -215,8 +215,8 @@ discard block |
||
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | // Handle foreign key relations |
| 218 | - if (array_key_exists($key . '_id', $this->__properties['self'])) { |
|
| 219 | - $result = $this->recordManager->getById($key, $this->__properties['self'][$key . '_id']); |
|
| 218 | + if (array_key_exists($key.'_id', $this->__properties['self'])) { |
|
| 219 | + $result = $this->recordManager->getById($key, $this->__properties['self'][$key.'_id']); |
|
| 220 | 220 | $this->set($key, $result); |
| 221 | 221 | |
| 222 | 222 | return $result; |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | * |
| 387 | 387 | * @throws Exception\InvalidModelException |
| 388 | 388 | */ |
| 389 | - private function createCollection(?Collection $collection, array|Collection $models): Collection |
|
| 389 | + private function createCollection(?Collection $collection, array | Collection $models): Collection |
|
| 390 | 390 | { |
| 391 | 391 | if (is_null($collection)) { |
| 392 | 392 | $collection = Collection::fromIterable([]); |
@@ -417,8 +417,8 @@ discard block |
||
| 417 | 417 | |
| 418 | 418 | private function handleModelRelation(string $key, Model $val): void |
| 419 | 419 | { |
| 420 | - if (isset($this->__properties['all'][$key . '_id'])) { |
|
| 421 | - unset($this->__properties['all'][$key . '_id']); |
|
| 420 | + if (isset($this->__properties['all'][$key.'_id'])) { |
|
| 421 | + unset($this->__properties['all'][$key.'_id']); |
|
| 422 | 422 | } |
| 423 | 423 | |
| 424 | 424 | $this->__meta['foreign_models']['oto'] = $this->createCollection( |
@@ -467,7 +467,7 @@ discard block |
||
| 467 | 467 | /** |
| 468 | 468 | * Determines the ParameterType for an ID value |
| 469 | 469 | */ |
| 470 | - private function determineIdType(int|string $id): ParameterType |
|
| 470 | + private function determineIdType(int | string $id): ParameterType |
|
| 471 | 471 | { |
| 472 | 472 | return is_int($id) ? ParameterType::INTEGER : ParameterType::STRING; |
| 473 | 473 | } |