Completed
Push — master ( d2067a...e53545 )
by Ivan
10:33
created
src/driver/mysql/Statement.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
             foreach ($lng as $index) {
78 78
                 if (is_resource($data[$index]) && get_resource_type($data[$index]) === 'stream') {
79 79
                     while (!feof($data[$index])) {
80
-                        $this->statement->send_long_data($index, (string)fread($data[$index], $lds));
80
+                        $this->statement->send_long_data($index, (string) fread($data[$index], $lds));
81 81
                     }
82 82
                 } else {
83 83
                     $data[$index] = str_split($data[$index], $lds);
@@ -97,24 +97,24 @@  discard block
 block discarded – undo
97 97
             $res = false;
98 98
         }
99 99
         if (!$res) {
100
-            if ($log && (int)$this->driver->option('log_errors', 1)) {
100
+            if ($log && (int) $this->driver->option('log_errors', 1)) {
101 101
                 @file_put_contents(
102 102
                     $log,
103
-                    '--' . date('Y-m-d H:i:s') . ' ERROR: ' . $this->statement->error . "\r\n" .
104
-                    $this->sql . "\r\n" .
103
+                    '--'.date('Y-m-d H:i:s').' ERROR: '.$this->statement->error."\r\n".
104
+                    $this->sql."\r\n".
105 105
                     "\r\n",
106 106
                     FILE_APPEND
107 107
                 );
108 108
             }
109
-            throw new DBException('Prepared execute error: ' . $this->statement->error);
109
+            throw new DBException('Prepared execute error: '.$this->statement->error);
110 110
         }
111 111
         if ($log) {
112 112
             $tm = microtime(true) - $tm;
113
-            if ($tm >= (float)$this->driver->option('log_slow', 0)) {
113
+            if ($tm >= (float) $this->driver->option('log_slow', 0)) {
114 114
                 @file_put_contents(
115 115
                     $log,
116
-                    '--' . date('Y-m-d H:i:s') . ' ' . sprintf('%01.6f', $tm) . "s\r\n" .
117
-                    $this->sql . "\r\n" .
116
+                    '--'.date('Y-m-d H:i:s').' '.sprintf('%01.6f', $tm)."s\r\n".
117
+                    $this->sql."\r\n".
118 118
                     "\r\n",
119 119
                     FILE_APPEND
120 120
                 );
Please login to merge, or discard this patch.
src/driver/sqlite/Driver.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
         if ($this->lnk === null) {
39 39
             try {
40 40
                 $this->lnk = new \SQLite3($this->connection['name']);
41
-                $this->lnk->exec('PRAGMA encoding = "'.$this->option('charset', 'utf-8') . '"');
41
+                $this->lnk->exec('PRAGMA encoding = "'.$this->option('charset', 'utf-8').'"');
42 42
             } catch (\Exception $e) {
43 43
                 if ($this->lnk !== null) {
44 44
                     throw new DBException('Connect error: '.$this->lnk->lastErrorMsg());
Please login to merge, or discard this patch.
src/schema/TableColumn.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
             $instance->setNullable($data['nullable']);
43 43
         }
44 44
         if (isset($data['notnull'])) {
45
-            $instance->setNullable(!((int)$data['notnull']));
45
+            $instance->setNullable(!((int) $data['notnull']));
46 46
         }
47 47
         if (isset($data['Default'])) {
48 48
             $instance->setDefault($data['Default']);
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
             $instance->setLength($data['length']);
58 58
         }
59 59
         if ($instance->getBasicType() === 'enum' && strpos($instance->getType(), 'enum(') === 0) {
60
-            $temp = array_map(function ($v) {
60
+            $temp = array_map(function($v) {
61 61
                 return str_replace("''", "'", $v);
62 62
             }, explode("','", substr($instance->getType(), 6, -2)));
63 63
             $instance->setValues($temp);
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
                 $instance->setDefault(null);
87 87
             }
88 88
         }
89
-        if ($instance->getBasicType() === 'text' && isset($data['CHAR_LENGTH']) && (int)$data['CHAR_LENGTH']) {
89
+        if ($instance->getBasicType() === 'text' && isset($data['CHAR_LENGTH']) && (int) $data['CHAR_LENGTH']) {
90 90
             $instance->setLength($data['CHAR_LENGTH']);
91 91
         }
92 92
         return $instance;
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
     }
184 184
     public function getLength(): int
185 185
     {
186
-        return (int)$this->length;
186
+        return (int) $this->length;
187 187
     }
188 188
     public function setLength(int $length): static
189 189
     {
Please login to merge, or discard this patch.
src/schema/TableQueryMapped.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 
20 20
     public function __construct(
21 21
         DBInterface $db,
22
-        Table|string $table,
22
+        Table | string $table,
23 23
         bool $findRelations = false,
24 24
         ?MapperInterface $mapper = null
25 25
     ) {
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
     public function iterator(array $fields = null, array $collectionKey = null): Collection
35 35
     {
36 36
         return Collection::from(parent::iterator($fields, $collectionKey))
37
-            ->map(function ($v) {
37
+            ->map(function($v) {
38 38
                 return $this->mapper->entity($v);
39 39
             })
40 40
             ->values();
Please login to merge, or discard this patch.
src/DB.php 1 patch
Spacing   +27 added lines, -29 removed lines patch added patch discarded remove patch
@@ -74,19 +74,19 @@  discard block
 block discarded – undo
74 74
                 ];
75 75
             }
76 76
         }
77
-        $connection['type'] = isset($temp['scheme']) && strlen((string)$temp['scheme']) ? $temp['scheme'] : null;
78
-        $connection['user'] = isset($temp['user']) && strlen((string)$temp['user']) ? $temp['user'] : null;
79
-        $connection['pass'] = isset($temp['pass']) && strlen((string)$temp['pass']) ? $temp['pass'] : null;
80
-        $connection['host'] = isset($temp['host']) && strlen((string)$temp['host']) ? $temp['host'] : null;
81
-        $connection['name'] = isset($temp['path']) && strlen((string)$temp['path']) ?
82
-            trim((string)$temp['path'], '/') : null;
83
-        $connection['port'] = isset($temp['port']) && (int)$temp['port'] ? (int)$temp['port'] : null;
84
-        if (isset($temp['query']) && strlen((string)$temp['query'])) {
85
-            parse_str((string)$temp['query'], $connection['opts']);
77
+        $connection['type'] = isset($temp['scheme']) && strlen((string) $temp['scheme']) ? $temp['scheme'] : null;
78
+        $connection['user'] = isset($temp['user']) && strlen((string) $temp['user']) ? $temp['user'] : null;
79
+        $connection['pass'] = isset($temp['pass']) && strlen((string) $temp['pass']) ? $temp['pass'] : null;
80
+        $connection['host'] = isset($temp['host']) && strlen((string) $temp['host']) ? $temp['host'] : null;
81
+        $connection['name'] = isset($temp['path']) && strlen((string) $temp['path']) ?
82
+            trim((string) $temp['path'], '/') : null;
83
+        $connection['port'] = isset($temp['port']) && (int) $temp['port'] ? (int) $temp['port'] : null;
84
+        if (isset($temp['query']) && strlen((string) $temp['query'])) {
85
+            parse_str((string) $temp['query'], $connection['opts']);
86 86
         }
87 87
         // create the driver
88 88
         $connection['type'] = $aliases[$connection['type']] ?? $connection['type'];
89
-        $tmp = '\\vakata\\database\\driver\\'.strtolower((string)$connection['type']).'\\Driver';
89
+        $tmp = '\\vakata\\database\\driver\\'.strtolower((string) $connection['type']).'\\Driver';
90 90
         if (!class_exists($tmp)) {
91 91
             throw new DBException('Unknown DB backend');
92 92
         }
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
         $new = '';
125 125
         $par = array_values($par);
126 126
         if (substr_count($sql, '?') === 2 && !is_array($par[0])) {
127
-            $par = [ $par ];
127
+            $par = [$par];
128 128
         }
129 129
         $parts = explode('??', $sql);
130 130
         $index = 0;
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
             $index += count($tmp) - 1;
135 135
             if (isset($par[$index])) {
136 136
                 if (!is_array($par[$index])) {
137
-                    $par[$index] = [ $par[$index] ];
137
+                    $par[$index] = [$par[$index]];
138 138
                 }
139 139
                 $params = $par[$index];
140 140
                 array_splice($par, $index, 1, $params);
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
                 $new .= implode(',', array_fill(0, count($params), '?'));
143 143
             }
144 144
         }
145
-        return [ $new, $par ];
145
+        return [$new, $par];
146 146
     }
147 147
     /**
148 148
      * Run a query (prepare & execute).
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
     ): Collection {
192 192
         $coll = Collection::from($this->query($sql, $par, $buff));
193 193
         if (($keys = $this->driver->option('mode')) && in_array($keys, ['strtoupper', 'strtolower'])) {
194
-            $coll->map(function ($v) use ($keys) {
194
+            $coll->map(function($v) use ($keys) {
195 195
                 $new = [];
196 196
                 foreach ($v as $k => $vv) {
197 197
                     $new[call_user_func($keys, $k)] = $vv;
@@ -200,18 +200,18 @@  discard block
 block discarded – undo
200 200
             });
201 201
         }
202 202
         if ($key !== null) {
203
-            $coll->mapKey(function ($v) use ($key): int|string {
203
+            $coll->mapKey(function($v) use ($key): int | string {
204 204
                 return $v[$key];
205 205
             });
206 206
         }
207 207
         if ($skip) {
208
-            $coll->map(function ($v) use ($key) {
208
+            $coll->map(function($v) use ($key) {
209 209
                 unset($v[$key]);
210 210
                 return $v;
211 211
             });
212 212
         }
213 213
         if ($opti) {
214
-            $coll->map(function ($v) {
214
+            $coll->map(function($v) {
215 215
                 return count($v) === 1 ? current($v) : $v;
216 216
             });
217 217
         }
@@ -328,8 +328,7 @@  discard block
 block discarded – undo
328 328
     public function definition(string $table, bool $detectRelations = true) : Table
329 329
     {
330 330
         return isset($this->schema) ?
331
-            $this->schema->getTable($table) :
332
-            $this->driver->table($table, $detectRelations);
331
+            $this->schema->getTable($table) : $this->driver->table($table, $detectRelations);
333 332
     }
334 333
 
335 334
     public function hasSchema(): bool
@@ -439,11 +438,11 @@  discard block
 block discarded – undo
439 438
      * @param class-string<T>|Table|string $table
440 439
      * @return ($table is class-string ? MapperInterface<T> : MapperInterface<Entity>)
441 440
      */
442
-    public function getMapper(Table|string $table): MapperInterface
441
+    public function getMapper(Table | string $table): MapperInterface
443 442
     {
444 443
         if (is_string($table)) {
445
-            if (isset($this->mappers['::' . $table])) {
446
-                return $this->mappers['::' . $table];
444
+            if (isset($this->mappers['::'.$table])) {
445
+                return $this->mappers['::'.$table];
447 446
             }
448 447
             $table = $this->definition($table);
449 448
         }
@@ -452,14 +451,14 @@  discard block
 block discarded – undo
452 451
         }
453 452
         return $this->mappers[$table->getFullName()] = new Mapper($this, $table);
454 453
     }
455
-    public function setMapper(Table|string $table, MapperInterface $mapper, ?string $class = null): static
454
+    public function setMapper(Table | string $table, MapperInterface $mapper, ?string $class = null): static
456 455
     {
457 456
         if (is_string($table)) {
458 457
             $table = $this->definition($table);
459 458
         }
460 459
         $this->mappers[$table->getFullName()] = $mapper;
461 460
         if (isset($class)) {
462
-            $this->mappers['::' . $class] = $mapper;
461
+            $this->mappers['::'.$class] = $mapper;
463 462
         }
464 463
         return $this;
465 464
     }
@@ -470,11 +469,10 @@  discard block
 block discarded – undo
470 469
     ): TableQueryMapped {
471 470
         return new TableQueryMapped($this, $this->definition($table), $findRelations, $mapper);
472 471
     }
473
-    public function __call(string $method, array $args): TableQuery|TableQueryMapped
472
+    public function __call(string $method, array $args): TableQuery | TableQueryMapped
474 473
     {
475 474
         return ($args[0] ?? false) ?
476
-            $this->tableMapped($method, $args[1] ?? false, $args[2] ?? null) :
477
-            $this->table($method, $args[1] ?? false);
475
+            $this->tableMapped($method, $args[1] ?? false, $args[2] ?? null) : $this->table($method, $args[1] ?? false);
478 476
     }
479 477
     public function findRelation(string $start, string $end): array
480 478
     {
@@ -510,12 +508,12 @@  discard block
 block discarded – undo
510 508
                     $relations[$t] = $w;
511 509
                 }
512 510
                 if (!isset($schema[$name])) {
513
-                    $schema[$name] = [ 'edges' => [] ];
511
+                    $schema[$name] = ['edges' => []];
514 512
                 }
515 513
                 foreach ($relations as $t => $w) {
516 514
                     $schema[$name]['edges'][$t] = $w;
517 515
                     if (!isset($schema[$t])) {
518
-                        $schema[$t] = [ 'edges' => [] ];
516
+                        $schema[$t] = ['edges' => []];
519 517
                     }
520 518
                     $schema[$t]['edges'][$name] = $w;
521 519
                 }
Please login to merge, or discard this patch.
src/schema/MapperInterface.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -58,12 +58,12 @@
 block discarded – undo
58 58
      * @param array|T $entity
59 59
      * @return bool
60 60
      */
61
-    public function deleted(array|object $entity): bool;
61
+    public function deleted(array | object $entity): bool;
62 62
     /**
63 63
      * @param array|T $entity
64 64
      * @return bool
65 65
      */
66
-    public function exists(array|object $entity): bool;
66
+    public function exists(array | object $entity): bool;
67 67
     /**
68 68
      * @return array<int,T>
69 69
      */
Please login to merge, or discard this patch.
src/schema/Table.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -79,10 +79,10 @@  discard block
 block discarded – undo
79 79
      * @param  array|string        $column either a single column name or an array of column names
80 80
      * @return  static
81 81
      */
82
-    public function setPrimaryKey(array|string $column): static
82
+    public function setPrimaryKey(array | string $column): static
83 83
     {
84 84
         if (!is_array($column)) {
85
-            $column = [ $column ];
85
+            $column = [$column];
86 86
         }
87 87
         $this->data['primary'] = array_values($column);
88 88
         return $this;
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
      */
110 110
     public function getFullName(): string
111 111
     {
112
-        return ($this->data['schema'] ? $this->data['schema'] . '.' : '') . $this->data['name'];
112
+        return ($this->data['schema'] ? $this->data['schema'].'.' : '').$this->data['name'];
113 113
     }
114 114
     /**
115 115
      * Get a column definition
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
     public function hasOne(
157 157
         Table $toTable,
158 158
         string $name = null,
159
-        string|array|null $toTableColumn = null,
159
+        string | array | null $toTableColumn = null,
160 160
         string $sql = null,
161 161
         array $par = []
162 162
     ) : static {
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
         }
185 185
 
186 186
         if (!isset($name)) {
187
-            $name = $toTable->getName() . '_' . implode('_', array_keys($keymap));
187
+            $name = $toTable->getName().'_'.implode('_', array_keys($keymap));
188 188
         }
189 189
         $this->addRelation(new TableRelation(
190 190
             $this,
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
     public function hasMany(
212 212
         Table $toTable,
213 213
         string $name = null,
214
-        string|array|null $toTableColumn = null,
214
+        string | array | null $toTableColumn = null,
215 215
         ?string $sql = null,
216 216
         array $par = []
217 217
     ): static {
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
     public function belongsTo(
267 267
         Table $toTable,
268 268
         string $name = null,
269
-        string|array|null $localColumn = null,
269
+        string | array | null $localColumn = null,
270 270
         ?string $sql = null,
271 271
         array $par = []
272 272
     ): static {
@@ -322,8 +322,8 @@  discard block
 block discarded – undo
322 322
         Table $toTable,
323 323
         Table $pivot,
324 324
         ?string $name = null,
325
-        string|array|null $toTableColumn = null,
326
-        string|array|null $localColumn = null
325
+        string | array | null $toTableColumn = null,
326
+        string | array | null $localColumn = null
327 327
     ): static {
328 328
         $pivotColumns = $pivot->getColumns();
329 329
 
Please login to merge, or discard this patch.
src/schema/Mapper.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -539,7 +539,7 @@
 block discarded – undo
539 539
                                         (isset($value) && is_array($value) && !in_array($e, $value, true)) ||
540 540
                                         (($value instanceof Collection) && !$value->contains($e))
541 541
                                     )
542
-                                 ) {
542
+                                    ) {
543 543
                                     $mapper->delete($e, true);
544 544
                                 }
545 545
                             }
Please login to merge, or discard this patch.
Spacing   +20 added lines, -21 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
      * @param class-string<T> $clss
28 28
      * @return void
29 29
      */
30
-    public function __construct(DBInterface $db, string|Table|null $table = '', string $clss = Entity::class)
30
+    public function __construct(DBInterface $db, string | Table | null $table = '', string $clss = Entity::class)
31 31
     {
32 32
         $this->db = $db;
33 33
         if (!$table) {
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
         $temp = [];
64 64
         foreach ($this->table->getPrimaryKey() as $column) {
65 65
             try {
66
-                $temp[(string)$column] = $entity->{$column} ?? null;
66
+                $temp[(string) $column] = $entity->{$column} ?? null;
67 67
                 /** @phpstan-ignore-next-line */
68 68
             } catch (\Throwable $ignore) {
69 69
             }
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 
94 94
         // BEG: ugly hack to get relations changed directly on the object (not hydrated)
95 95
         $hack = [];
96
-        foreach ((array)$entity as $k => $v) {
96
+        foreach ((array) $entity as $k => $v) {
97 97
             $hack[$k[0] === "\0" ? substr($k, strrpos($k, "\0", 1) + 1) : $k] = $v;
98 98
         }
99 99
         $hack = $hack['changed'] ?? [];
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
         foreach ($columns as $column) {
105 105
             try {
106 106
                 if (in_array($column, $fetched) || array_key_exists($column, $hack) || $fetch) {
107
-                    $temp[(string)$column] = $entity->{$column};
107
+                    $temp[(string) $column] = $entity->{$column};
108 108
                 }
109 109
             } catch (\Throwable $ignore) {
110 110
             }
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
         foreach ($relations as $relation) {
115 115
             try {
116 116
                 if (array_key_exists($relation, $fetched) || array_key_exists($relation, $hack) || $fetch) {
117
-                    $temp[(string)$relation] = $entity->{$relation};
117
+                    $temp[(string) $relation] = $entity->{$relation};
118 118
                 }
119 119
             } catch (\Throwable $ignore) {
120 120
             }
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
                         $v = [];
136 136
                     }
137 137
                     if ($v instanceof Entity) {
138
-                        $v = [ $v ];
138
+                        $v = [$v];
139 139
                     }
140 140
                     if (is_array($v)) {
141 141
                         foreach ($v as $kk => $vv) {
@@ -184,10 +184,10 @@  discard block
 block discarded – undo
184 184
         $temp = [];
185 185
         foreach ($this->table->getColumns() as $column) {
186 186
             if (array_key_exists($column, $data)) {
187
-                $temp[(string)$column] = $data[$column];
187
+                $temp[(string) $column] = $data[$column];
188 188
             } else {
189 189
                 if ($empty) {
190
-                    $temp[(string)$column] = null;
190
+                    $temp[(string) $column] = null;
191 191
                 }
192 192
             }
193 193
         }
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
         $lazy = [];
216 216
         foreach ($this->table->getColumns() as $column) {
217 217
             if (!array_key_exists($column, $data)) {
218
-                $lazy[$column] = function ($entity) use ($column) {
218
+                $lazy[$column] = function($entity) use ($column) {
219 219
                     $query = $this->db->table($this->table->getFullName());
220 220
                     foreach ($this->id($entity) as $k => $v) {
221 221
                         $query->filter($k, $v);
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
     {
239 239
         $relations = [];
240 240
         foreach ($this->table->getRelations() as $name => $relation) {
241
-            $relations[$name] = function (
241
+            $relations[$name] = function(
242 242
                 $entity,
243 243
                 bool $queryOnly = false
244 244
             ) use (
@@ -252,10 +252,10 @@  discard block
 block discarded – undo
252 252
                         return $this->objects[spl_object_hash($entity)][4][$name] = null;
253 253
                     }
254 254
                     $value = $relation->many ?
255
-                        Collection::from(array_map(function ($v) use ($mapper) {
255
+                        Collection::from(array_map(function($v) use ($mapper) {
256 256
                             return $mapper->entity($v);
257 257
                         }, $data[$name]))
258
-                            ->filter(function ($v) use ($mapper) {
258
+                            ->filter(function($v) use ($mapper) {
259 259
                                 return !$mapper->deleted($v);
260 260
                             }) :
261 261
                         ($mapper->deleted($data[$name]) ? null : $mapper->entity($data[$name]));
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
                 }
265 265
                 $query = $this->db->tableMapped($relation->table->getFullName());
266 266
                 if ($relation->sql) {
267
-                    $query->where($relation->sql, $relation->par?:[]);
267
+                    $query->where($relation->sql, $relation->par ?: []);
268 268
                 }
269 269
                 if ($relation->pivot) {
270 270
                     $nm = null;
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
                     }
286 286
                     $pk = $this->id($entity);
287 287
                     foreach ($pk as $k => $v) {
288
-                        $query->filter($nm . '.' . $k, $v);
288
+                        $query->filter($nm.'.'.$k, $v);
289 289
                     }
290 290
                 } else {
291 291
                     $temp = $this->toArray($entity, array_keys($relation->keymap));
@@ -297,10 +297,9 @@  discard block
 block discarded – undo
297 297
                     return $query;
298 298
                 }
299 299
                 $value = $relation->many ?
300
-                    $query->iterator() :
301
-                    ($query[0] ?? null);
300
+                    $query->iterator() : ($query[0] ?? null);
302 301
                 if ($value instanceof Collection) {
303
-                    $value->filter(function ($v) use ($mapper) {
302
+                    $value->filter(function($v) use ($mapper) {
304 303
                         return !$mapper->deleted($v);
305 304
                     });
306 305
                 } elseif (isset($value) && $mapper->deleted($value)) {
@@ -320,7 +319,7 @@  discard block
 block discarded – undo
320 319
     {
321 320
         // BEG: ugly hack to get changed columns
322 321
         $hack = [];
323
-        foreach ((array)$entity as $k => $v) {
322
+        foreach ((array) $entity as $k => $v) {
324 323
             $hack[$k[0] === "\0" ? substr($k, strrpos($k, "\0", 1) + 1) : $k] = $v;
325 324
         }
326 325
         $hack = $hack['changed'] ?? [];
@@ -611,7 +610,7 @@  discard block
 block discarded – undo
611 610
             }
612 611
         }
613 612
     }
614
-    public function exists(array|object $entity): bool
613
+    public function exists(array | object $entity): bool
615 614
     {
616 615
         if (is_array($entity)) {
617 616
             $primary = [];
@@ -625,7 +624,7 @@  discard block
 block discarded – undo
625 624
         return isset($this->objects[spl_object_hash($entity)]) &&
626 625
             $this->objects[spl_object_hash($entity)][5] === false;
627 626
     }
628
-    public function deleted(array|object $entity): bool
627
+    public function deleted(array | object $entity): bool
629 628
     {
630 629
         if (is_array($entity)) {
631 630
             $primary = [];
@@ -711,7 +710,7 @@  discard block
 block discarded – undo
711 710
         return array_filter(
712 711
             array_values(
713 712
                 array_map(
714
-                    function ($v) {
713
+                    function($v) {
715 714
                         return $v[5] ? null : ($v[1] ?? null);
716 715
                     },
717 716
                     $this->objects
Please login to merge, or discard this patch.
src/Schema.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
     public function getTable(string $table): Table
32 32
     {
33 33
         if (!$this->hasTable($table)) {
34
-            throw new DBException('Invalid table name: ' . $table);
34
+            throw new DBException('Invalid table name: '.$table);
35 35
         }
36 36
         return $this->tables[$table] ??
37 37
             $this->tables[strtoupper($table)] ??
@@ -64,13 +64,13 @@  discard block
 block discarded – undo
64 64
     
65 65
     public function toArray(): array
66 66
     {
67
-        return array_map(function ($table) {
67
+        return array_map(function($table) {
68 68
             return [
69 69
                 'name' => $table->getName(),
70 70
                 'schema' => $table->getSchema(),
71 71
                 'pkey' => $table->getPrimaryKey(),
72 72
                 'comment' => $table->getComment(),
73
-                'columns' => array_map(function ($column) {
73
+                'columns' => array_map(function($column) {
74 74
                     return [
75 75
                         'name' => $column->getName(),
76 76
                         'type' => $column->getType(),
@@ -81,9 +81,9 @@  discard block
 block discarded – undo
81 81
                         'nullable' => $column->isNullable()
82 82
                     ];
83 83
                 }, $table->getFullColumns()),
84
-                'relations' => array_map(function ($rel) {
84
+                'relations' => array_map(function($rel) {
85 85
                     $relation = clone $rel;
86
-                    $relation = (array)$relation;
86
+                    $relation = (array) $relation;
87 87
                     $relation['table'] = $rel->table->getName();
88 88
                     if ($rel->pivot) {
89 89
                         $relation['pivot'] = $rel->pivot->getName();
Please login to merge, or discard this patch.