Completed
Push — master ( be2ee3...343ee8 )
by Ivan
12:14
created
src/driver/mysql/Schema.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -27,8 +27,8 @@  discard block
 block discarded – undo
27 27
             $table = $temp[1];
28 28
         }
29 29
 
30
-        if (isset($tables[$schema . '.' . $table])) {
31
-            return $tables[$schema . '.' . $table];
30
+        if (isset($tables[$schema.'.'.$table])) {
31
+            return $tables[$schema.'.'.$table];
32 32
         }
33 33
 
34 34
         static $comments = [];
@@ -36,10 +36,10 @@  discard block
 block discarded – undo
36 36
             $comments[$schema] = Collection::from(
37 37
                 $this->query(
38 38
                     "SELECT TABLE_NAME, TABLE_COMMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = ?",
39
-                    [ $schema ]
39
+                    [$schema]
40 40
                 )
41 41
             )
42
-            ->mapKey(function (array $v): string {
42
+            ->mapKey(function(array $v): string {
43 43
                 return $v['TABLE_NAME'];
44 44
             })
45 45
             ->pluck('TABLE_COMMENT')
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
                      WHERE
62 62
                         (TABLE_SCHEMA = ? OR REFERENCED_TABLE_SCHEMA = ?) AND
63 63
                         TABLE_NAME IS NOT NULL AND REFERENCED_TABLE_NAME IS NOT NULL",
64
-                    [ $main, $main ]
64
+                    [$main, $main]
65 65
                 )
66 66
             )->toArray();
67 67
             foreach ($col as $row) {
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
                 if ($row['REFERENCED_TABLE_SCHEMA'] !== $main) {
72 72
                     $additional[] = $row['REFERENCED_TABLE_SCHEMA'];
73 73
                 }
74
-                $relationsT[$row['TABLE_SCHEMA'] . '.' . $row['TABLE_NAME']][] = $row;
75
-                $relationsR[$row['REFERENCED_TABLE_SCHEMA'] . '.' . $row['REFERENCED_TABLE_NAME']][] = $row;
74
+                $relationsT[$row['TABLE_SCHEMA'].'.'.$row['TABLE_NAME']][] = $row;
75
+                $relationsR[$row['REFERENCED_TABLE_SCHEMA'].'.'.$row['REFERENCED_TABLE_NAME']][] = $row;
76 76
             }
77 77
             foreach (array_filter(array_unique($additional)) as $s) {
78 78
                 $col = Collection::from(
@@ -84,12 +84,12 @@  discard block
 block discarded – undo
84 84
                         WHERE
85 85
                             TABLE_SCHEMA = ? AND REFERENCED_TABLE_SCHEMA = ? AND
86 86
                             TABLE_NAME IS NOT NULL AND REFERENCED_TABLE_NAME IS NOT NULL",
87
-                        [ $s, $s ]
87
+                        [$s, $s]
88 88
                     )
89 89
                 )->toArray();
90 90
                 foreach ($col as $row) {
91
-                    $relationsT[$row['TABLE_SCHEMA'] . '.' . $row['TABLE_NAME']][] = $row;
92
-                    $relationsR[$row['REFERENCED_TABLE_SCHEMA'] . '.' . $row['REFERENCED_TABLE_NAME']][] = $row;
91
+                    $relationsT[$row['TABLE_SCHEMA'].'.'.$row['TABLE_NAME']][] = $row;
92
+                    $relationsR[$row['REFERENCED_TABLE_SCHEMA'].'.'.$row['REFERENCED_TABLE_NAME']][] = $row;
93 93
                 }
94 94
             }
95 95
         }
@@ -98,14 +98,14 @@  discard block
 block discarded – undo
98 98
         if (!count($columns)) {
99 99
             throw new DBException('Table not found by name');
100 100
         }
101
-        $tables[$schema . '.' . $table] = $definition = (new Table($table, $schema))
101
+        $tables[$schema.'.'.$table] = $definition = (new Table($table, $schema))
102 102
             ->addColumns(
103 103
                 $columns
104 104
                     ->clone()
105
-                    ->mapKey(function (array $v): string {
105
+                    ->mapKey(function(array $v): string {
106 106
                         return $v['Field'];
107 107
                     })
108
-                    ->map(function (array $v): array {
108
+                    ->map(function(array $v): array {
109 109
                         $v['length'] = null;
110 110
                         if (!isset($v['Type'])) {
111 111
                             return $v;
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
                             default:
128 128
                                 if (strpos($type, 'char') !== false && strpos($type, '(') !== false) {
129 129
                                     // extract length from varchar
130
-                                    $v['length'] = (int)explode(')', explode('(', $type)[1])[0];
130
+                                    $v['length'] = (int) explode(')', explode('(', $type)[1])[0];
131 131
                                     $v['length'] = $v['length'] > 0 ? $v['length'] : null;
132 132
                                 }
133 133
                                 break;
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
             ->setPrimaryKey(
140 140
                 $columns
141 141
                     ->clone()
142
-                    ->filter(function (array $v): bool {
142
+                    ->filter(function(array $v): bool {
143 143
                         return $v['Key'] === 'PRI';
144 144
                     })
145 145
                     ->pluck('Field')
@@ -153,8 +153,8 @@  discard block
 block discarded – undo
153 153
             // assuming current table is on the "one" end having "many" records in the referencing table
154 154
             // resulting in a "hasMany" or "manyToMany" relationship (if a pivot table is detected)
155 155
             $relations = [];
156
-            foreach ($relationsR[$schema . '.' . $table] ?? [] as $relation) {
157
-                $relations[$relation['CONSTRAINT_NAME']]['table'] = $relation['TABLE_SCHEMA'] . '.' .
156
+            foreach ($relationsR[$schema.'.'.$table] ?? [] as $relation) {
157
+                $relations[$relation['CONSTRAINT_NAME']]['table'] = $relation['TABLE_SCHEMA'].'.'.
158 158
                     $relation['TABLE_NAME'];
159 159
                 $relations[$relation['CONSTRAINT_NAME']]['keymap'][$relation['REFERENCED_COLUMN_NAME']] =
160 160
                     $relation['COLUMN_NAME'];
@@ -171,10 +171,10 @@  discard block
 block discarded – undo
171 171
                 $usedcol = [];
172 172
                 if (count($columns)) {
173 173
                     foreach (Collection::from($relationsT[$data['table']] ?? [])
174
-                        ->filter(function (array $v) use ($columns): bool {
174
+                        ->filter(function(array $v) use ($columns): bool {
175 175
                             return in_array($v['COLUMN_NAME'], $columns);
176 176
                         })
177
-                        ->map(function (array $v): array {
177
+                        ->map(function(array $v): array {
178 178
                             $new = [];
179 179
                             foreach ($v as $kk => $vv) {
180 180
                                 $new[strtoupper($kk)] = $vv;
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
                             return $new;
183 183
                         }) as $relation
184 184
                     ) {
185
-                        $foreign[$relation['CONSTRAINT_NAME']]['table'] = $relation['REFERENCED_TABLE_SCHEMA'] . '.' .
185
+                        $foreign[$relation['CONSTRAINT_NAME']]['table'] = $relation['REFERENCED_TABLE_SCHEMA'].'.'.
186 186
                             $relation['REFERENCED_TABLE_NAME'];
187 187
                         $foreign[$relation['CONSTRAINT_NAME']]['keymap'][$relation['COLUMN_NAME']] =
188 188
                             $relation['REFERENCED_COLUMN_NAME'];
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
                     $orig = $relname;
200 200
                     $cntr = 1;
201 201
                     while ($definition->hasRelation($relname) || $definition->getName() == $relname) {
202
-                        $relname = $orig . '_' . (++ $cntr);
202
+                        $relname = $orig.'_'.(++$cntr);
203 203
                     }
204 204
                     $definition->addRelation(
205 205
                         new TableRelation(
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
                     $orig = $relname;
221 221
                     $cntr = 1;
222 222
                     while ($definition->hasRelation($relname) || $definition->getName() == $relname) {
223
-                        $relname = $orig . '_' . (++ $cntr);
223
+                        $relname = $orig.'_'.(++$cntr);
224 224
                     }
225 225
                     $definition->addRelation(
226 226
                         new TableRelation(
@@ -236,8 +236,8 @@  discard block
 block discarded – undo
236 236
             // assuming current table is linked to "one" record in the referenced table
237 237
             // resulting in a "belongsTo" relationship
238 238
             $relations = [];
239
-            foreach (Collection::from($relationsT[$schema . '.' . $table] ?? [])
240
-                ->map(function (array $v): array {
239
+            foreach (Collection::from($relationsT[$schema.'.'.$table] ?? [])
240
+                ->map(function(array $v): array {
241 241
                     $new = [];
242 242
                     foreach ($v as $kk => $vv) {
243 243
                         $new[strtoupper($kk)] = $vv;
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
                     return $new;
246 246
                 }) as $relation
247 247
             ) {
248
-                $relations[$relation['CONSTRAINT_NAME']]['table'] = $relation['REFERENCED_TABLE_SCHEMA'] . '.' .
248
+                $relations[$relation['CONSTRAINT_NAME']]['table'] = $relation['REFERENCED_TABLE_SCHEMA'].'.'.
249 249
                     $relation['REFERENCED_TABLE_NAME'];
250 250
                 $relations[$relation['CONSTRAINT_NAME']]['keymap'][$relation['COLUMN_NAME']] =
251 251
                     $relation['REFERENCED_COLUMN_NAME'];
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
                 $orig = $relname;
260 260
                 $cntr = 1;
261 261
                 while ($definition->hasRelation($relname) || $definition->getName() == $relname) {
262
-                    $relname = $orig . '_' . (++ $cntr);
262
+                    $relname = $orig.'_'.(++$cntr);
263 263
                 }
264 264
                 $definition->addRelation(
265 265
                     new TableRelation(
@@ -280,23 +280,23 @@  discard block
 block discarded – undo
280 280
                 "SELECT table_name FROM information_schema.tables where table_schema = ?",
281 281
                 [$this->connection['opts']['schema'] ?? $this->connection['name']]
282 282
             ))
283
-            ->map(function (array $v): array {
283
+            ->map(function(array $v): array {
284 284
                 $new = [];
285 285
                 foreach ($v as $kk => $vv) {
286 286
                     $new[strtoupper($kk)] = $vv;
287 287
                 }
288 288
                 return $new;
289 289
             })
290
-            ->mapKey(function (array $v): string {
290
+            ->mapKey(function(array $v): string {
291 291
                 return strtolower($v['TABLE_NAME']);
292 292
             })
293 293
             ->pluck('TABLE_NAME')
294
-            ->map(function (string $v): Table {
294
+            ->map(function(string $v): Table {
295 295
                 return $this->table($v)->toLowerCase();
296 296
             })
297 297
             ->toArray();
298 298
         foreach (array_keys($tables) as $k) {
299
-            $tables[($this->connection['opts']['schema'] ?? $this->connection['name']) . '.' . $k] = &$tables[$k];
299
+            $tables[($this->connection['opts']['schema'] ?? $this->connection['name']).'.'.$k] = &$tables[$k];
300 300
         }
301 301
         return $tables;
302 302
     }
Please login to merge, or discard this patch.
src/Schema.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -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.
src/driver/postgre/Statement.php 1 patch
Spacing   +12 added lines, -14 removed lines patch added patch discarded remove patch
@@ -23,17 +23,17 @@  discard block
 block discarded – undo
23 23
         if (strpos(strtolower($statement), 'prepare') === 0) {
24 24
             $this->drv->raw($this->statement);
25 25
             if (!isset($this->name)) {
26
-                $this->name = trim((preg_split('(\s+)', trim($this->statement))?:[])[1]??'', '"');
26
+                $this->name = trim((preg_split('(\s+)', trim($this->statement)) ?: [])[1] ?? '', '"');
27 27
             }
28 28
         } elseif ($this->name !== null) {
29 29
             $temp = \pg_prepare($this->driver, $this->name, $this->statement);
30 30
             if (!$temp) {
31 31
                 $log = $this->drv->option('log_file');
32
-                if ($log && (int)$this->drv->option('log_errors', 1)) {
32
+                if ($log && (int) $this->drv->option('log_errors', 1)) {
33 33
                     @file_put_contents(
34 34
                         $log,
35
-                        '--' . date('Y-m-d H:i:s') . ' ERROR PREPARING: ' . \pg_last_error($this->driver) . "\r\n" .
36
-                        $this->statement . "\r\n" .
35
+                        '--'.date('Y-m-d H:i:s').' ERROR PREPARING: '.\pg_last_error($this->driver)."\r\n".
36
+                        $this->statement."\r\n".
37 37
                         "\r\n",
38 38
                         FILE_APPEND
39 39
                     );
@@ -62,22 +62,20 @@  discard block
 block discarded – undo
62 62
         try {
63 63
             if ($this->name !== null) {
64 64
                 $temp = (is_array($data) && count($data)) ?
65
-                    \pg_execute($this->driver, $this->name, $data) :
66
-                    \pg_execute($this->driver, $this->name, array());
65
+                    \pg_execute($this->driver, $this->name, $data) : \pg_execute($this->driver, $this->name, array());
67 66
             } else {
68 67
                 $temp = (is_array($data) && count($data)) ?
69
-                    \pg_query_params($this->driver, $this->statement, $data) :
70
-                    \pg_query_params($this->driver, $this->statement, array());
68
+                    \pg_query_params($this->driver, $this->statement, $data) : \pg_query_params($this->driver, $this->statement, array());
71 69
             }
72 70
         } catch (\Exception $e) {
73 71
             $temp = false;
74 72
         }
75 73
         if (!$temp) {
76
-            if ($log && (int)$this->drv->option('log_errors', 1)) {
74
+            if ($log && (int) $this->drv->option('log_errors', 1)) {
77 75
                 @file_put_contents(
78 76
                     $log,
79
-                    '--' . date('Y-m-d H:i:s') . ' ERROR: ' . \pg_last_error($this->driver) . "\r\n" .
80
-                    $this->statement . "\r\n" .
77
+                    '--'.date('Y-m-d H:i:s').' ERROR: '.\pg_last_error($this->driver)."\r\n".
78
+                    $this->statement."\r\n".
81 79
                     "\r\n",
82 80
                     FILE_APPEND
83 81
                 );
@@ -86,11 +84,11 @@  discard block
 block discarded – undo
86 84
         }
87 85
         if ($log) {
88 86
             $tm = microtime(true) - $tm;
89
-            if ($tm >= (float)$this->drv->option('log_slow', 0)) {
87
+            if ($tm >= (float) $this->drv->option('log_slow', 0)) {
90 88
                 @file_put_contents(
91 89
                     $log,
92
-                    '--' . date('Y-m-d H:i:s') . ' ' . sprintf('%01.6f', $tm) . "s\r\n" .
93
-                    $this->statement . "\r\n" .
90
+                    '--'.date('Y-m-d H:i:s').' '.sprintf('%01.6f', $tm)."s\r\n".
91
+                    $this->statement."\r\n".
94 92
                     "\r\n",
95 93
                     FILE_APPEND
96 94
                 );
Please login to merge, or discard this patch.
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/driver/sqlite/Schema.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -29,8 +29,8 @@  discard block
 block discarded – undo
29 29
             $table = $temp[1];
30 30
         }
31 31
 
32
-        if (isset($tables[$schema . '.' . $table])) {
33
-            return $tables[$schema . '.' . $table];
32
+        if (isset($tables[$schema.'.'.$table])) {
33
+            return $tables[$schema.'.'.$table];
34 34
         }
35 35
 
36 36
         static $relationsT = null;
@@ -53,8 +53,8 @@  discard block
 block discarded – undo
53 53
                             ]
54 54
                         )
55 55
                     );
56
-                    $relationsT['main.' . $row['table']][] = $row;
57
-                    $relationsR['main.' . $row['referenced_table']][] = $row;
56
+                    $relationsT['main.'.$row['table']][] = $row;
57
+                    $relationsR['main.'.$row['referenced_table']][] = $row;
58 58
                 }
59 59
             }
60 60
         }
@@ -64,10 +64,10 @@  discard block
 block discarded – undo
64 64
          */
65 65
         $columns = Collection::from($this
66 66
             ->query("PRAGMA table_info(".$table.")"))
67
-            ->mapKey(function ($v): string {
67
+            ->mapKey(function($v): string {
68 68
                 return $v['name'];
69 69
             })
70
-            ->map(function ($v) {
70
+            ->map(function($v) {
71 71
                 $v['length'] = null;
72 72
                 if (!isset($v['type'])) {
73 73
                     return $v;
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
                     default:
78 78
                         if (strpos($type, 'char') !== false && strpos($type, '(') !== false) {
79 79
                             // extract length from varchar
80
-                            $v['length'] = (int)explode(')', explode('(', $type)[1])[0];
80
+                            $v['length'] = (int) explode(')', explode('(', $type)[1])[0];
81 81
                             $v['length'] = $v['length'] > 0 ? $v['length'] : null;
82 82
                         }
83 83
                         break;
@@ -86,15 +86,15 @@  discard block
 block discarded – undo
86 86
             })
87 87
             ->toArray();
88 88
         if (!count($columns)) {
89
-            throw new DBException('Table not found by name: ' . implode('.', [$schema,$table]));
89
+            throw new DBException('Table not found by name: '.implode('.', [$schema, $table]));
90 90
         }
91 91
         $primary = [];
92 92
         foreach ($columns as $column) {
93
-            if ((int)$column['pk']) {
93
+            if ((int) $column['pk']) {
94 94
                 $primary[] = $column['name'];
95 95
             }
96 96
         }
97
-        $tables[$schema . '.' .$table] = $definition = (new Table($table, $schema))
97
+        $tables[$schema.'.'.$table] = $definition = (new Table($table, $schema))
98 98
             ->addColumns($columns)
99 99
             ->setPrimaryKey($primary)
100 100
             ->setComment('');
@@ -104,8 +104,8 @@  discard block
 block discarded – undo
104 104
             // assuming current table is on the "one" end having "many" records in the referencing table
105 105
             // resulting in a "hasMany" or "manyToMany" relationship (if a pivot table is detected)
106 106
             $relations = [];
107
-            foreach ($relationsR[$schema . '.' . $table] ?? [] as $k => $relation) {
108
-                $relations[$relation['constraint_name']]['table'] = 'main.' . $relation['table'];
107
+            foreach ($relationsR[$schema.'.'.$table] ?? [] as $k => $relation) {
108
+                $relations[$relation['constraint_name']]['table'] = 'main.'.$relation['table'];
109 109
                 $relations[$relation['constraint_name']]['keymap'][$relation['to']] = $relation['from'];
110 110
             }
111 111
             foreach ($relations as $data) {
@@ -120,11 +120,11 @@  discard block
 block discarded – undo
120 120
                 $usedcol = [];
121 121
                 if (count($columns)) {
122 122
                     foreach (Collection::from($relationsT[$data['table']] ?? [])
123
-                        ->filter(function ($v) use ($columns) {
123
+                        ->filter(function($v) use ($columns) {
124 124
                             return in_array($v['from'], $columns);
125 125
                         }) as $relation
126 126
                     ) {
127
-                        $foreign[$relation['constraint_name']]['table'] = 'main.' .
127
+                        $foreign[$relation['constraint_name']]['table'] = 'main.'.
128 128
                             $relation['referenced_table'];
129 129
                         $foreign[$relation['constraint_name']]['keymap'][$relation['from']] = $relation['to'];
130 130
                         $usedcol[] = $relation['from'];
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
                         $definition->getName() == $relname ||
144 144
                         $definition->getColumn($relname)
145 145
                     ) {
146
-                        $relname = $orig . '_' . (++ $cntr);
146
+                        $relname = $orig.'_'.(++$cntr);
147 147
                     }
148 148
                     $definition->addRelation(
149 149
                         new TableRelation(
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
                         $definition->getName() == $relname ||
168 168
                         $definition->getColumn($relname)
169 169
                     ) {
170
-                        $relname = $orig . '_' . (++ $cntr);
170
+                        $relname = $orig.'_'.(++$cntr);
171 171
                     }
172 172
                     $definition->addRelation(
173 173
                         new TableRelation(
@@ -183,8 +183,8 @@  discard block
 block discarded – undo
183 183
             // assuming current table is linked to "one" record in the referenced table
184 184
             // resulting in a "belongsTo" relationship
185 185
             $relations = [];
186
-            foreach ($relationsT[$schema . '.' . $table] ?? [] as $relation) {
187
-                $relations[$relation['constraint_name']]['table'] = 'main.' . $relation['referenced_table'];
186
+            foreach ($relationsT[$schema.'.'.$table] ?? [] as $relation) {
187
+                $relations[$relation['constraint_name']]['table'] = 'main.'.$relation['referenced_table'];
188 188
                 $relations[$relation['constraint_name']]['keymap'][$relation['from']] = $relation['to'];
189 189
             }
190 190
             foreach ($relations as $name => $data) {
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
                     $definition->getName() == $relname ||
200 200
                     $definition->getColumn($relname)
201 201
                 ) {
202
-                    $relname = $orig . '_' . (++ $cntr);
202
+                    $relname = $orig.'_'.(++$cntr);
203 203
                 }
204 204
                 $definition->addRelation(
205 205
                     new TableRelation(
@@ -220,9 +220,9 @@  discard block
 block discarded – undo
220 220
                 "SELECT tbl_name
221 221
                  FROM sqlite_schema
222 222
                  WHERE (type = ? OR type = ?) AND tbl_name NOT LIKE 'sqlite_%';",
223
-                [ 'table', 'view' ]
223
+                ['table', 'view']
224 224
             ))
225
-            ->mapKey(function ($v) {
225
+            ->mapKey(function($v) {
226 226
                 return strtolower($v['tbl_name']);
227 227
             })
228 228
             ->pluck('tbl_name')
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
             $tables[$k] = $this->table($v, true, array_keys($tables))->toLowerCase();
232 232
         }
233 233
         foreach (array_keys($tables) as $k) {
234
-            $tables[($this->connection['opts']['schema'] ?? 'main') . '.' . $k] = &$tables[$k];
234
+            $tables[($this->connection['opts']['schema'] ?? 'main').'.'.$k] = &$tables[$k];
235 235
         }
236 236
         return $tables;
237 237
     }
Please login to merge, or discard this patch.
src/driver/oracle/Schema.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -32,19 +32,19 @@  discard block
 block discarded – undo
32 32
         $columns = Collection::from($this
33 33
             ->query(
34 34
                 "SELECT * FROM all_tab_cols WHERE UPPER(table_name) = ? AND UPPER(owner) = ? and hidden_column = 'NO'",
35
-                [ strtoupper($table), strtoupper($this->name()) ]
35
+                [strtoupper($table), strtoupper($this->name())]
36 36
             ))
37
-            ->map(function ($v) {
37
+            ->map(function($v) {
38 38
                 $new = [];
39 39
                 foreach ($v as $kk => $vv) {
40 40
                     $new[strtoupper($kk)] = $vv;
41 41
                 }
42 42
                 return $new;
43 43
             })
44
-            ->mapKey(function ($v): string {
44
+            ->mapKey(function($v): string {
45 45
                 return $v['COLUMN_NAME'];
46 46
             })
47
-            ->map(function ($v) {
47
+            ->map(function($v) {
48 48
                 $v['length'] = null;
49 49
                 if (!isset($v['DATA_TYPE'])) {
50 50
                     return $v;
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
                     default:
57 57
                         if (strpos($type, 'char') !== false && strpos($type, '(') !== false) {
58 58
                             // extract length from varchar
59
-                            $v['length'] = (int)explode(')', (explode('(', $type)[1] ?? ''))[0];
59
+                            $v['length'] = (int) explode(')', (explode('(', $type)[1] ?? ''))[0];
60 60
                             $v['length'] = $v['length'] > 0 ? $v['length'] : null;
61 61
                         }
62 62
                         break;
@@ -72,9 +72,9 @@  discard block
 block discarded – undo
72 72
             ->query(
73 73
                 "SELECT constraint_name FROM all_constraints
74 74
                 WHERE table_name = ? AND constraint_type = ? AND UPPER(owner) = ?",
75
-                [ strtoupper($table), 'P', $owner ]
75
+                [strtoupper($table), 'P', $owner]
76 76
             ))
77
-            ->map(function ($v) {
77
+            ->map(function($v) {
78 78
                 $new = [];
79 79
                 foreach ($v as $kk => $vv) {
80 80
                     $new[strtoupper($kk)] = $vv;
@@ -89,9 +89,9 @@  discard block
 block discarded – undo
89 89
                 ->query(
90 90
                     "SELECT column_name FROM all_cons_columns
91 91
                     WHERE table_name = ? AND constraint_name = ? AND UPPER(owner) = ?",
92
-                    [ strtoupper($table), $pkname, $owner ]
92
+                    [strtoupper($table), $pkname, $owner]
93 93
                 ))
94
-                ->map(function ($v) {
94
+                ->map(function($v) {
95 95
                     $new = [];
96 96
                     foreach ($v as $kk => $vv) {
97 97
                         $new[strtoupper($kk)] = $vv;
@@ -120,9 +120,9 @@  discard block
 block discarded – undo
120 120
                         UPPER(ac.OWNER) = ? AND UPPER(ac.R_OWNER) = ? AND
121 121
                         ac.R_CONSTRAINT_NAME = ? AND ac.CONSTRAINT_TYPE = ?
122 122
                     ORDER BY cc.POSITION",
123
-                    [ $owner, $owner, $pkname, 'R' ]
123
+                    [$owner, $owner, $pkname, 'R']
124 124
                 ))
125
-                ->map(function ($v) {
125
+                ->map(function($v) {
126 126
                     $new = [];
127 127
                     foreach ($v as $kk => $vv) {
128 128
                         $new[strtoupper($kk)] = $vv;
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
                  as $relation
133 133
             ) {
134 134
                 $relations[$relation['CONSTRAINT_NAME']]['table'] = $relation['TABLE_NAME'];
135
-                $relations[$relation['CONSTRAINT_NAME']]['keymap'][$primary[(int)$relation['POSITION']-1]] =
135
+                $relations[$relation['CONSTRAINT_NAME']]['keymap'][$primary[(int) $relation['POSITION'] - 1]] =
136 136
                     $relation['COLUMN_NAME'];
137 137
             }
138 138
             foreach ($relations as $data) {
@@ -163,9 +163,9 @@  discard block
 block discarded – undo
163 163
                                 ac.TABLE_NAME = ? AND ac.CONSTRAINT_TYPE = ? AND
164 164
                                 cc.COLUMN_NAME IN (??)
165 165
                             ORDER BY POSITION",
166
-                            [ $owner, $owner, $data['table'], 'R', $columns ]
166
+                            [$owner, $owner, $data['table'], 'R', $columns]
167 167
                         ))
168
-                        ->map(function ($v) {
168
+                        ->map(function($v) {
169 169
                             $new = [];
170 170
                             foreach ($v as $kk => $vv) {
171 171
                                 $new[strtoupper($kk)] = $vv;
@@ -185,9 +185,9 @@  discard block
 block discarded – undo
185 185
                         ->query(
186 186
                             "SELECT COLUMN_NAME FROM all_cons_columns
187 187
                              WHERE UPPER(OWNER) = ? AND CONSTRAINT_NAME = ? ORDER BY POSITION",
188
-                            [ $owner, current($foreign['keymap']) ]
188
+                            [$owner, current($foreign['keymap'])]
189 189
                         ))
190
-                        ->map(function ($v) {
190
+                        ->map(function($v) {
191 191
                             $new = [];
192 192
                             foreach ($v as $kk => $vv) {
193 193
                                 $new[strtoupper($kk)] = $vv;
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
                     $relname = $foreign['table'];
203 203
                     $cntr = 1;
204 204
                     while ($definition->hasRelation($relname) || $definition->getName() == $relname) {
205
-                        $relname = $foreign['table'] . '_' . (++ $cntr);
205
+                        $relname = $foreign['table'].'_'.(++$cntr);
206 206
                     }
207 207
                     $definition->addRelation(
208 208
                         new TableRelation(
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
                     $relname = $data['table'];
219 219
                     $cntr = 1;
220 220
                     while ($definition->hasRelation($relname) || $definition->getName() == $relname) {
221
-                        $relname = $data['table'] . '_' . (++ $cntr);
221
+                        $relname = $data['table'].'_'.(++$cntr);
222 222
                     }
223 223
                     $definition->addRelation(
224 224
                         new TableRelation(
@@ -246,9 +246,9 @@  discard block
 block discarded – undo
246 246
                     LEFT JOIN all_cons_columns cc ON cc.OWNER = ac.OWNER AND cc.CONSTRAINT_NAME = ac.CONSTRAINT_NAME
247 247
                     WHERE UPPER(ac.OWNER) = ? AND UPPER(ac.R_OWNER) = ? AND ac.TABLE_NAME = ? AND ac.CONSTRAINT_TYPE = ?
248 248
                     ORDER BY cc.POSITION",
249
-                    [ $owner, $owner, strtoupper($table), 'R' ]
249
+                    [$owner, $owner, strtoupper($table), 'R']
250 250
                 ))
251
-                ->map(function ($v) {
251
+                ->map(function($v) {
252 252
                     $new = [];
253 253
                     foreach ($v as $kk => $vv) {
254 254
                         $new[strtoupper($kk)] = $vv;
@@ -266,9 +266,9 @@  discard block
 block discarded – undo
266 266
                     ->query(
267 267
                         "SELECT COLUMN_NAME FROM all_cons_columns
268 268
                          WHERE UPPER(OWNER) = ? AND CONSTRAINT_NAME = ? ORDER BY POSITION",
269
-                        [ $owner, current($data['keymap']) ]
269
+                        [$owner, current($data['keymap'])]
270 270
                     ))
271
-                    ->map(function ($v) {
271
+                    ->map(function($v) {
272 272
                         $new = [];
273 273
                         foreach ($v as $kk => $vv) {
274 274
                             $new[strtoupper($kk)] = $vv;
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
                 $relname = $data['table'];
284 284
                 $cntr = 1;
285 285
                 while ($definition->hasRelation($relname) || $definition->getName() == $relname) {
286
-                    $relname = $data['table'] . '_' . (++ $cntr);
286
+                    $relname = $data['table'].'_'.(++$cntr);
287 287
                 }
288 288
                 $definition->addRelation(
289 289
                     new TableRelation(
@@ -306,18 +306,18 @@  discard block
 block discarded – undo
306 306
                  SELECT VIEW_NAME AS TABLE_NAME FROM ALL_VIEWS where UPPER(OWNER) = ?",
307 307
                 [strtoupper($this->connection['name']), strtoupper($this->connection['name'])]
308 308
             ))
309
-            ->map(function ($v) {
309
+            ->map(function($v) {
310 310
                 $new = [];
311 311
                 foreach ($v as $kk => $vv) {
312 312
                     $new[strtoupper($kk)] = $vv;
313 313
                 }
314 314
                 return $new;
315 315
             })
316
-            ->mapKey(function ($v) {
316
+            ->mapKey(function($v) {
317 317
                 return strtolower($v['TABLE_NAME']);
318 318
             })
319 319
             ->pluck('TABLE_NAME')
320
-            ->map(function ($v) {
320
+            ->map(function($v) {
321 321
                 return $this->table($v)->toLowerCase();
322 322
             })
323 323
             ->toArray();
Please login to merge, or discard this patch.
src/driver/postgre/Schema.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -29,8 +29,8 @@  discard block
 block discarded – undo
29 29
             $table = $temp[1];
30 30
         }
31 31
 
32
-        if (isset($tables[$schema . '.' . $table])) {
33
-            return $tables[$schema . '.' . $table];
32
+        if (isset($tables[$schema.'.'.$table])) {
33
+            return $tables[$schema.'.'.$table];
34 34
         }
35 35
 
36 36
         static $relationsT = null;
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
                         (kc.table_schema = ? OR ct.table_schema = ?) AND
62 62
                         kc.table_name IS NOT NULL AND
63 63
                         kc.position_in_unique_constraint IS NOT NULL",
64
-                    [ $catalog, $main, $main ]
64
+                    [$catalog, $main, $main]
65 65
                 )
66 66
             )->toArray();
67 67
             foreach ($col as $row) {
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
                 if ($row['referenced_table_schema'] !== $main) {
72 72
                     $additional[] = $row['referenced_table_schema'];
73 73
                 }
74
-                $relationsT[$row['table_schema'] . '.' . $row['table_name']][] = $row;
75
-                $relationsR[$row['referenced_table_schema'] . '.' . $row['referenced_table_name']][] = $row;
74
+                $relationsT[$row['table_schema'].'.'.$row['table_name']][] = $row;
75
+                $relationsR[$row['referenced_table_schema'].'.'.$row['referenced_table_name']][] = $row;
76 76
             }
77 77
             foreach (array_filter(array_unique($additional)) as $s) {
78 78
                 $col = Collection::from(
@@ -97,12 +97,12 @@  discard block
 block discarded – undo
97 97
                             (kc.table_schema = ? AND ct.table_schema = ?) AND
98 98
                             kc.table_name IS NOT NULL AND
99 99
                             kc.position_in_unique_constraint IS NOT NULL",
100
-                        [ $catalog, $s, $s ]
100
+                        [$catalog, $s, $s]
101 101
                     )
102 102
                 )->toArray();
103 103
                 foreach ($col as $row) {
104
-                    $relationsT[$row['table_schema'] . '.' . $row['table_name']][] = $row;
105
-                    $relationsR[$row['referenced_table_schema'] . '.' . $row['referenced_table_name']][] = $row;
104
+                    $relationsT[$row['table_schema'].'.'.$row['table_name']][] = $row;
105
+                    $relationsR[$row['referenced_table_schema'].'.'.$row['referenced_table_name']][] = $row;
106 106
                 }
107 107
             }
108 108
         }
@@ -114,12 +114,12 @@  discard block
 block discarded – undo
114 114
             ->query(
115 115
                 "SELECT * FROM information_schema.columns
116 116
                  WHERE table_name = ? AND table_schema = ? AND table_catalog = ?",
117
-                [ $table, $schema, $catalog ]
117
+                [$table, $schema, $catalog]
118 118
             ))
119
-            ->mapKey(function ($v): string {
119
+            ->mapKey(function($v): string {
120 120
                 return $v['column_name'];
121 121
             })
122
-            ->map(function ($v) {
122
+            ->map(function($v) {
123 123
                 $v['length'] = null;
124 124
                 if (!isset($v['data_type'])) {
125 125
                     return $v;
@@ -127,20 +127,20 @@  discard block
 block discarded – undo
127 127
                 switch ($v['data_type']) {
128 128
                     case 'character':
129 129
                     case 'character varying':
130
-                        $v['length'] = (int)$v['character_maximum_length'];
130
+                        $v['length'] = (int) $v['character_maximum_length'];
131 131
                         break;
132 132
                 }
133 133
                 return $v;
134 134
             })
135 135
             ->toArray();
136 136
         if (!count($columns)) {
137
-            throw new DBException('Table not found by name: ' . implode('.', [$schema,$table]));
137
+            throw new DBException('Table not found by name: '.implode('.', [$schema, $table]));
138 138
         }
139 139
         $pkname = Collection::from($this
140 140
             ->query(
141 141
                 "SELECT constraint_name FROM information_schema.table_constraints
142 142
                 WHERE table_name = ? AND constraint_type = ? AND table_schema = ? AND table_catalog = ?",
143
-                [ $table, 'PRIMARY KEY', $schema, $catalog ]
143
+                [$table, 'PRIMARY KEY', $schema, $catalog]
144 144
             ))
145 145
             ->pluck('constraint_name')
146 146
             ->value();
@@ -150,12 +150,12 @@  discard block
 block discarded – undo
150 150
                 ->query(
151 151
                     "SELECT column_name FROM information_schema.constraint_column_usage
152 152
                      WHERE table_name = ? AND constraint_name = ? AND table_schema = ? AND table_catalog = ?",
153
-                    [ $table, $pkname, $schema, $catalog ]
153
+                    [$table, $pkname, $schema, $catalog]
154 154
                 ))
155 155
                 ->pluck('column_name')
156 156
                 ->toArray();
157 157
         }
158
-        $tables[$schema . '.' .$table] = $definition = (new Table($table, $schema))
158
+        $tables[$schema.'.'.$table] = $definition = (new Table($table, $schema))
159 159
             ->addColumns($columns)
160 160
             ->setPrimaryKey($primary)
161 161
             ->setComment('');
@@ -165,8 +165,8 @@  discard block
 block discarded – undo
165 165
             // assuming current table is on the "one" end having "many" records in the referencing table
166 166
             // resulting in a "hasMany" or "manyToMany" relationship (if a pivot table is detected)
167 167
             $relations = [];
168
-            foreach ($relationsR[$schema . '.' . $table] ?? [] as $relation) {
169
-                $relations[$relation['constraint_name']]['table'] = $relation['table_schema'] . '.' .
168
+            foreach ($relationsR[$schema.'.'.$table] ?? [] as $relation) {
169
+                $relations[$relation['constraint_name']]['table'] = $relation['table_schema'].'.'.
170 170
                     $relation['table_name'];
171 171
                 $relations[$relation['constraint_name']]['keymap'][$relation['referenced_column_name']] =
172 172
                     $relation['column_name'];
@@ -183,11 +183,11 @@  discard block
 block discarded – undo
183 183
                 $usedcol = [];
184 184
                 if (count($columns)) {
185 185
                     foreach (Collection::from($relationsT[$data['table']] ?? [])
186
-                        ->filter(function ($v) use ($columns) {
186
+                        ->filter(function($v) use ($columns) {
187 187
                             return in_array($v['column_name'], $columns);
188 188
                         }) as $relation
189 189
                     ) {
190
-                        $foreign[$relation['constraint_name']]['table'] = $relation['referenced_table_schema'] . '.' .
190
+                        $foreign[$relation['constraint_name']]['table'] = $relation['referenced_table_schema'].'.'.
191 191
                             $relation['referenced_table_name'];
192 192
                         $foreign[$relation['constraint_name']]['keymap'][$relation['column_name']] =
193 193
                             $relation['referenced_column_name'];
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
                         $definition->getName() == $relname ||
208 208
                         $definition->getColumn($relname)
209 209
                     ) {
210
-                        $relname = $orig . '_' . (++ $cntr);
210
+                        $relname = $orig.'_'.(++$cntr);
211 211
                     }
212 212
                     $definition->addRelation(
213 213
                         new TableRelation(
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
                         $definition->getName() == $relname ||
232 232
                         $definition->getColumn($relname)
233 233
                     ) {
234
-                        $relname = $orig . '_' . (++ $cntr);
234
+                        $relname = $orig.'_'.(++$cntr);
235 235
                     }
236 236
                     $definition->addRelation(
237 237
                         new TableRelation(
@@ -247,8 +247,8 @@  discard block
 block discarded – undo
247 247
             // assuming current table is linked to "one" record in the referenced table
248 248
             // resulting in a "belongsTo" relationship
249 249
             $relations = [];
250
-            foreach ($relationsT[$schema . '.' . $table] ?? [] as $relation) {
251
-                $relations[$relation['constraint_name']]['table'] = $relation['referenced_table_schema'] . '.' .
250
+            foreach ($relationsT[$schema.'.'.$table] ?? [] as $relation) {
251
+                $relations[$relation['constraint_name']]['table'] = $relation['referenced_table_schema'].'.'.
252 252
                     $relation['referenced_table_name'];
253 253
                 $relations[$relation['constraint_name']]['keymap'][$relation['column_name']] =
254 254
                     $relation['referenced_column_name'];
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
                     $definition->getName() == $relname ||
266 266
                     $definition->getColumn($relname)
267 267
                 ) {
268
-                    $relname = $orig . '_' . (++ $cntr);
268
+                    $relname = $orig.'_'.(++$cntr);
269 269
                 }
270 270
                 $definition->addRelation(
271 271
                     new TableRelation(
@@ -284,19 +284,19 @@  discard block
 block discarded – undo
284 284
         $tables = Collection::from($this
285 285
             ->query(
286 286
                 "SELECT table_name FROM information_schema.tables where table_schema = ? AND table_catalog = ?",
287
-                [ $this->connection['opts']['schema'] ?? 'public', $this->connection['name'] ]
287
+                [$this->connection['opts']['schema'] ?? 'public', $this->connection['name']]
288 288
             ))
289
-            ->mapKey(function ($v) {
289
+            ->mapKey(function($v) {
290 290
                 return strtolower($v['table_name']);
291 291
             })
292 292
             ->pluck('table_name')
293
-            ->map(function ($v) {
293
+            ->map(function($v) {
294 294
                 return $this->table($v)->toLowerCase();
295 295
             })
296 296
             ->toArray();
297 297
 
298 298
         foreach (array_keys($tables) as $k) {
299
-            $tables[($this->connection['opts']['schema'] ?? 'public') . '.' . $k] = &$tables[$k];
299
+            $tables[($this->connection['opts']['schema'] ?? 'public').'.'.$k] = &$tables[$k];
300 300
         }
301 301
         return $tables;
302 302
     }
Please login to merge, or discard this patch.