Completed
Push — master ( 857fbb...7b7f7b )
by mark
19s queued 13s
created
src/Phinx/Db/Table.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -223,7 +223,7 @@
 block discarded – undo
223 223
     {
224 224
         $columns = array_filter(
225 225
             $this->getColumns(),
226
-            function ($column) use ($name) {
226
+            function($column) use ($name) {
227 227
                 return $column->getName() === $name;
228 228
             }
229 229
         );
Please login to merge, or discard this patch.
src/Phinx/Db/Action/AddForeignKey.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -56,9 +56,9 @@
 block discarded – undo
56 56
 
57 57
         $fk = new ForeignKey();
58 58
         $fk->setReferencedTable($referencedTable)
59
-           ->setColumns($columns)
60
-           ->setReferencedColumns($referencedColumns)
61
-           ->setOptions($options);
59
+            ->setColumns($columns)
60
+            ->setReferencedColumns($referencedColumns)
61
+            ->setOptions($options);
62 62
 
63 63
         if ($name !== null) {
64 64
             $fk->setConstraint($name);
Please login to merge, or discard this patch.
src/Phinx/Db/Adapter/PostgresAdapter.php 2 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
         $options = $table->getOptions();
202 202
         $parts = $this->getSchemaName($table->getName());
203 203
 
204
-         // Add the default primary key
204
+            // Add the default primary key
205 205
         if (!isset($options['id']) || (isset($options['id']) && $options['id'] === true)) {
206 206
             $options['id'] = 'id';
207 207
         }
@@ -210,8 +210,8 @@  discard block
 block discarded – undo
210 210
             // Handle id => "field_name" to support AUTO_INCREMENT
211 211
             $column = new Column();
212 212
             $column->setName($options['id'])
213
-                   ->setType('integer')
214
-                   ->setIdentity(true);
213
+                    ->setType('integer')
214
+                    ->setIdentity(true);
215 215
 
216 216
             array_unshift($columns, $column);
217 217
             if (isset($options['primary_key']) && (array)$options['id'] !== (array)$options['primary_key']) {
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
             }
235 235
         }
236 236
 
237
-         // set the primary key(s)
237
+            // set the primary key(s)
238 238
         if (isset($options['primary_key'])) {
239 239
             $sql = rtrim($sql);
240 240
             $sql .= sprintf(' CONSTRAINT %s PRIMARY KEY (', $this->quoteColumnName($parts['table'] . '_pkey'));
@@ -429,11 +429,11 @@  discard block
 block discarded – undo
429 429
 
430 430
             $column = new Column();
431 431
             $column->setName($columnInfo['column_name'])
432
-                   ->setType($columnType)
433
-                   ->setNull($columnInfo['is_nullable'] === 'YES')
434
-                   ->setDefault($columnDefault)
435
-                   ->setIdentity($columnInfo['is_identity'] === 'YES')
436
-                   ->setScale($columnInfo['numeric_scale']);
432
+                    ->setType($columnType)
433
+                    ->setNull($columnInfo['is_nullable'] === 'YES')
434
+                    ->setDefault($columnDefault)
435
+                    ->setIdentity($columnInfo['is_identity'] === 'YES')
436
+                    ->setScale($columnInfo['numeric_scale']);
437 437
 
438 438
             if (preg_match('/\bwith time zone$/', $columnInfo['data_type'])) {
439 439
                 $column->setTimezone(true);
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1242,7 +1242,7 @@
 block discarded – undo
1242 1242
         }
1243 1243
 
1244 1244
         $order = $index->getOrder() ?? [];
1245
-        $columnNames = array_map(function ($columnName) use ($order) {
1245
+        $columnNames = array_map(function($columnName) use ($order) {
1246 1246
             $ret = '"' . $columnName . '"';
1247 1247
             if (isset($order[$columnName])) {
1248 1248
                 $ret .= ' ' . $order[$columnName];
Please login to merge, or discard this patch.
src/Phinx/Db/Adapter/PdoAdapter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -312,7 +312,7 @@
 block discarded – undo
312 312
         $sql .= '(' . implode(', ', array_map([$this, 'quoteColumnName'], $keys)) . ') VALUES ';
313 313
 
314 314
         if ($this->isDryRunEnabled()) {
315
-            $values = array_map(function ($row) {
315
+            $values = array_map(function($row) {
316 316
                 return '(' . implode(', ', array_map([$this, 'quoteValue'], $row)) . ')';
317 317
             }, $rows);
318 318
             $sql .= implode(', ', $values) . ';';
Please login to merge, or discard this patch.
src/Phinx/Db/Adapter/SQLiteAdapter.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -370,8 +370,8 @@  discard block
 block discarded – undo
370 370
             // Handle id => "field_name" to support AUTO_INCREMENT
371 371
             $column = new Column();
372 372
             $column->setName($options['id'])
373
-                   ->setType('integer')
374
-                   ->setIdentity(true);
373
+                    ->setType('integer')
374
+                    ->setIdentity(true);
375 375
 
376 376
             array_unshift($columns, $column);
377 377
         }
@@ -651,12 +651,12 @@  discard block
 block discarded – undo
651 651
             $default = $this->parseDefaultValue($columnInfo['dflt_value'], $type['name']);
652 652
 
653 653
             $column->setName($columnInfo['name'])
654
-                   ->setNull($columnInfo['notnull'] !== '1')
655
-                   ->setDefault($default)
656
-                   ->setType($type['name'])
657
-                   ->setLimit($type['limit'])
658
-                   ->setScale($type['scale'])
659
-                   ->setIdentity($columnInfo['name'] === $identity);
654
+                    ->setNull($columnInfo['notnull'] !== '1')
655
+                    ->setDefault($default)
656
+                    ->setType($type['name'])
657
+                    ->setLimit($type['limit'])
658
+                    ->setScale($type['scale'])
659
+                    ->setIdentity($columnInfo['name'] === $identity);
660 660
 
661 661
             $columns[] = $column;
662 662
         }
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
 PCRE_PATTERN;
550 550
         preg_match_all($pattern, $v, $matches);
551 551
         // strip out any comment tokens
552
-        $matches = array_map(function ($v) {
552
+        $matches = array_map(function($v) {
553 553
             return preg_match('/^(?:\/\*|--)/', $v) ? ' ' : $v;
554 554
         }, $matches[0]);
555 555
         // reconstitute the string, trimming whitespace as well as parentheses
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
 
689 689
         $instructions = $this->beginAlterByCopyTable($tableName);
690 690
 
691
-        $instructions->addPostStep(function ($state) use ($tableName, $column) {
691
+        $instructions->addPostStep(function($state) use ($tableName, $column) {
692 692
             // we use the final column to anchor our regex to insert the new column,
693 693
             // as the alternative is unwinding all possible table constraints which
694 694
             // gets messy quickly with CHECK constraints.
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
             return $state;
713 713
         });
714 714
 
715
-        $instructions->addPostStep(function ($state) use ($tableName) {
715
+        $instructions->addPostStep(function($state) use ($tableName) {
716 716
             $newState = $this->calculateNewTableColumns($tableName, false, false);
717 717
 
718 718
             return $newState + $state;
@@ -796,7 +796,7 @@  discard block
 block discarded – undo
796 796
      */
797 797
     protected function copyAndDropTmpTable($instructions, $tableName)
798 798
     {
799
-        $instructions->addPostStep(function ($state) use ($tableName) {
799
+        $instructions->addPostStep(function($state) use ($tableName) {
800 800
             $this->copyDataToNewTable(
801 801
                 $state['tmpTableName'],
802 802
                 $tableName,
@@ -877,7 +877,7 @@  discard block
 block discarded – undo
877 877
     protected function beginAlterByCopyTable($tableName)
878 878
     {
879 879
         $instructions = new AlterInstructions();
880
-        $instructions->addPostStep(function ($state) use ($tableName) {
880
+        $instructions->addPostStep(function($state) use ($tableName) {
881 881
             $tmpTableName = "tmp_{$tableName}";
882 882
             $createSQL = $this->getDeclaringSql($tableName);
883 883
 
@@ -909,7 +909,7 @@  discard block
 block discarded – undo
909 909
     {
910 910
         $instructions = $this->beginAlterByCopyTable($tableName);
911 911
 
912
-        $instructions->addPostStep(function ($state) use ($columnName, $newColumnName) {
912
+        $instructions->addPostStep(function($state) use ($columnName, $newColumnName) {
913 913
             $sql = str_replace(
914 914
                 $this->quoteColumnName($columnName),
915 915
                 $this->quoteColumnName($newColumnName),
@@ -920,7 +920,7 @@  discard block
 block discarded – undo
920 920
             return $state;
921 921
         });
922 922
 
923
-        $instructions->addPostStep(function ($state) use ($columnName, $newColumnName, $tableName) {
923
+        $instructions->addPostStep(function($state) use ($columnName, $newColumnName, $tableName) {
924 924
             $newState = $this->calculateNewTableColumns($tableName, $columnName, $newColumnName);
925 925
 
926 926
             return $newState + $state;
@@ -937,7 +937,7 @@  discard block
 block discarded – undo
937 937
         $instructions = $this->beginAlterByCopyTable($tableName);
938 938
 
939 939
         $newColumnName = $newColumn->getName();
940
-        $instructions->addPostStep(function ($state) use ($columnName, $newColumn) {
940
+        $instructions->addPostStep(function($state) use ($columnName, $newColumn) {
941 941
             $sql = preg_replace(
942 942
                 sprintf("/%s(?:\/\*.*?\*\/|\([^)]+\)|'[^']*?'|[^,])+([,)])/", $this->quoteColumnName($columnName)),
943 943
                 sprintf('%s %s$1', $this->quoteColumnName($newColumn->getName()), $this->getColumnSqlDefinition($newColumn)),
@@ -949,7 +949,7 @@  discard block
 block discarded – undo
949 949
             return $state;
950 950
         });
951 951
 
952
-        $instructions->addPostStep(function ($state) use ($columnName, $newColumnName, $tableName) {
952
+        $instructions->addPostStep(function($state) use ($columnName, $newColumnName, $tableName) {
953 953
             $newState = $this->calculateNewTableColumns($tableName, $columnName, $newColumnName);
954 954
 
955 955
             return $newState + $state;
@@ -965,13 +965,13 @@  discard block
 block discarded – undo
965 965
     {
966 966
         $instructions = $this->beginAlterByCopyTable($tableName);
967 967
 
968
-        $instructions->addPostStep(function ($state) use ($tableName, $columnName) {
968
+        $instructions->addPostStep(function($state) use ($tableName, $columnName) {
969 969
             $newState = $this->calculateNewTableColumns($tableName, $columnName, false);
970 970
 
971 971
             return $newState + $state;
972 972
         });
973 973
 
974
-        $instructions->addPostStep(function ($state) use ($columnName) {
974
+        $instructions->addPostStep(function($state) use ($columnName) {
975 975
             $sql = preg_replace(
976 976
                 sprintf("/%s\s%s.*(,\s(?!')|\)$)/U", preg_quote($this->quoteColumnName($columnName)), preg_quote($state['columnType'])),
977 977
                 '',
@@ -1238,7 +1238,7 @@  discard block
 block discarded – undo
1238 1238
         $instructions = $this->beginAlterByCopyTable($table->getName());
1239 1239
 
1240 1240
         $tableName = $table->getName();
1241
-        $instructions->addPostStep(function ($state) use ($column) {
1241
+        $instructions->addPostStep(function($state) use ($column) {
1242 1242
             $matchPattern = "/(`$column`)\s+(\w+(\(\d+\))?)\s+((NOT )?NULL)/";
1243 1243
 
1244 1244
             $sql = $state['createSQL'];
@@ -1260,7 +1260,7 @@  discard block
 block discarded – undo
1260 1260
             return $state;
1261 1261
         });
1262 1262
 
1263
-        $instructions->addPostStep(function ($state) {
1263
+        $instructions->addPostStep(function($state) {
1264 1264
             $columns = $this->fetchAll(sprintf('pragma table_info(%s)', $this->quoteTableName($state['tmpTableName'])));
1265 1265
             $names = array_map([$this, 'quoteColumnName'], array_column($columns, 'name'));
1266 1266
             $selectColumns = $writeColumns = $names;
@@ -1281,7 +1281,7 @@  discard block
 block discarded – undo
1281 1281
     {
1282 1282
         $instructions = $this->beginAlterByCopyTable($table->getName());
1283 1283
 
1284
-        $instructions->addPostStep(function ($state) {
1284
+        $instructions->addPostStep(function($state) {
1285 1285
             $search = "/(,?\s*PRIMARY KEY\s*\([^\)]*\)|\s+PRIMARY KEY(\s+AUTOINCREMENT)?)/";
1286 1286
             $sql = preg_replace($search, '', $state['createSQL'], 1);
1287 1287
 
@@ -1292,7 +1292,7 @@  discard block
 block discarded – undo
1292 1292
             return $state;
1293 1293
         });
1294 1294
 
1295
-        $instructions->addPostStep(function ($state) use ($column) {
1295
+        $instructions->addPostStep(function($state) use ($column) {
1296 1296
             $newState = $this->calculateNewTableColumns($state['tmpTableName'], $column, $column);
1297 1297
 
1298 1298
             return $newState + $state;
@@ -1309,7 +1309,7 @@  discard block
 block discarded – undo
1309 1309
         $instructions = $this->beginAlterByCopyTable($table->getName());
1310 1310
 
1311 1311
         $tableName = $table->getName();
1312
-        $instructions->addPostStep(function ($state) use ($foreignKey, $tableName) {
1312
+        $instructions->addPostStep(function($state) use ($foreignKey, $tableName) {
1313 1313
             $this->execute('pragma foreign_keys = ON');
1314 1314
             $sql = substr($state['createSQL'], 0, -1) . ',' . $this->getForeignKeySqlDefinition($foreignKey) . '); ';
1315 1315
 
@@ -1336,7 +1336,7 @@  discard block
 block discarded – undo
1336 1336
             return $state;
1337 1337
         });
1338 1338
 
1339
-        $instructions->addPostStep(function ($state) {
1339
+        $instructions->addPostStep(function($state) {
1340 1340
             $columns = $this->fetchAll(sprintf('pragma table_info(%s)', $this->quoteTableName($state['tmpTableName'])));
1341 1341
             $names = array_map([$this, 'quoteColumnName'], array_column($columns, 'name'));
1342 1342
             $selectColumns = $writeColumns = $names;
@@ -1368,7 +1368,7 @@  discard block
 block discarded – undo
1368 1368
     {
1369 1369
         $instructions = $this->beginAlterByCopyTable($tableName);
1370 1370
 
1371
-        $instructions->addPostStep(function ($state) use ($columns) {
1371
+        $instructions->addPostStep(function($state) use ($columns) {
1372 1372
             $sql = '';
1373 1373
 
1374 1374
             foreach ($columns as $columnName) {
@@ -1386,7 +1386,7 @@  discard block
 block discarded – undo
1386 1386
             return $state;
1387 1387
         });
1388 1388
 
1389
-        $instructions->addPostStep(function ($state) use ($columns) {
1389
+        $instructions->addPostStep(function($state) use ($columns) {
1390 1390
             $newState = $this->calculateNewTableColumns($state['tmpTableName'], $columns[0], $columns[0]);
1391 1391
 
1392 1392
             $selectColumns = $newState['selectColumns'];
Please login to merge, or discard this patch.
src/Phinx/Db/Adapter/SqlServerAdapter.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -235,8 +235,8 @@  discard block
 block discarded – undo
235 235
             // Handle id => "field_name" to support AUTO_INCREMENT
236 236
             $column = new Column();
237 237
             $column->setName($options['id'])
238
-                   ->setType('integer')
239
-                   ->setIdentity(true);
238
+                    ->setType('integer')
239
+                    ->setIdentity(true);
240 240
 
241 241
             array_unshift($columns, $column);
242 242
             if (isset($options['primary_key']) && (array)$options['id'] !== (array)$options['primary_key']) {
@@ -465,11 +465,11 @@  discard block
 block discarded – undo
465 465
 
466 466
             $column = new Column();
467 467
             $column->setName($columnInfo['name'])
468
-                   ->setType($type)
469
-                   ->setNull($columnInfo['null'] !== 'NO')
470
-                   ->setDefault($this->parseDefault($columnInfo['default']))
471
-                   ->setIdentity($columnInfo['identity'] === '1')
472
-                   ->setComment($this->getColumnComment($columnInfo['table_name'], $columnInfo['name']));
468
+                    ->setType($type)
469
+                    ->setNull($columnInfo['null'] !== 'NO')
470
+                    ->setDefault($this->parseDefault($columnInfo['default']))
471
+                    ->setIdentity($columnInfo['identity'] === '1')
472
+                    ->setComment($this->getColumnComment($columnInfo['table_name'], $columnInfo['name']));
473 473
 
474 474
             if (!empty($columnInfo['char_length'])) {
475 475
                 $column->setLimit($columnInfo['char_length']);
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
 
792 792
         foreach ($indexes as $name => $index) {
793 793
             if ($name === $indexName) {
794
-                 return true;
794
+                    return true;
795 795
             }
796 796
         }
797 797
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1280,7 +1280,7 @@
 block discarded – undo
1280 1280
             $indexName = sprintf('%s_%s', $tableName, implode('_', $columnNames));
1281 1281
         }
1282 1282
         $order = $index->getOrder() ?? [];
1283
-        $columnNames = array_map(function ($columnName) use ($order) {
1283
+        $columnNames = array_map(function($columnName) use ($order) {
1284 1284
             $ret = '[' . $columnName . ']';
1285 1285
             if (isset($order[$columnName])) {
1286 1286
                 $ret .= ' ' . $order[$columnName];
Please login to merge, or discard this patch.
src/Phinx/Db/Adapter/TimedOutputAdapter.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
     {
37 37
         $started = microtime(true);
38 38
 
39
-        return function () use ($started) {
39
+        return function() use ($started) {
40 40
             $end = microtime(true);
41 41
             if (OutputInterface::VERBOSITY_VERBOSE <= $this->getOutput()->getVerbosity()) {
42 42
                 $this->getOutput()->writeln('    -> ' . sprintf('%.4fs', $end - $started));
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
             foreach ($args as $arg) {
64 64
                 if (is_array($arg)) {
65 65
                     $arg = array_map(
66
-                        function ($value) {
66
+                        function($value) {
67 67
                             return '\'' . $value . '\'';
68 68
                         },
69 69
                         $arg
Please login to merge, or discard this patch.
src/Phinx/Db/Plan/Plan.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -414,7 +414,7 @@
 block discarded – undo
414 414
                 && !($action instanceof RemoveColumn)
415 415
                 && !($action instanceof RenameColumn)
416 416
             ) {
417
-                 continue;
417
+                    continue;
418 418
             } elseif (isset($this->tableCreates[$action->getTable()->getName()])) {
419 419
                 continue;
420 420
             }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
         $splitter = new ActionSplitter(
213 213
             RenameColumn::class,
214 214
             ChangeColumn::class,
215
-            function (RenameColumn $a, ChangeColumn $b) {
215
+            function(RenameColumn $a, ChangeColumn $b) {
216 216
                 return $a->getNewName() === $b->getColumnName();
217 217
             }
218 218
         );
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
         $splitter = new ActionSplitter(
233 233
             DropForeignKey::class,
234 234
             AddForeignKey::class,
235
-            function (DropForeignKey $a, AddForeignKey $b) {
235
+            function(DropForeignKey $a, AddForeignKey $b) {
236 236
                 return $a->getForeignKey()->getColumns() === $b->getForeignKey()->getColumns();
237 237
             }
238 238
         );
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
     protected function forgetDropIndex(Table $table, array $columns, array $actions)
313 313
     {
314 314
         $dropIndexActions = new ArrayObject();
315
-        $indexes = array_map(function ($alter) use ($table, $columns, $dropIndexActions) {
315
+        $indexes = array_map(function($alter) use ($table, $columns, $dropIndexActions) {
316 316
             if ($alter->getTable()->getName() !== $table->getName()) {
317 317
                 return $alter;
318 318
             }
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
     protected function forgetRemoveColumn(Table $table, array $columns, array $actions)
346 346
     {
347 347
         $removeColumnActions = new ArrayObject();
348
-        $indexes = array_map(function ($alter) use ($table, $columns, $removeColumnActions) {
348
+        $indexes = array_map(function($alter) use ($table, $columns, $removeColumnActions) {
349 349
             if ($alter->getTable()->getName() !== $table->getName()) {
350 350
                 return $alter;
351 351
             }
Please login to merge, or discard this patch.
src/Phinx/Db/Plan/Solver/ActionSplitter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@
 block discarded – undo
70 70
      */
71 71
     public function __invoke(AlterTable $alter)
72 72
     {
73
-        $conflictActions = array_filter($alter->getActions(), function ($action) {
73
+        $conflictActions = array_filter($alter->getActions(), function($action) {
74 74
             return $action instanceof $this->conflictClass;
75 75
         });
76 76
 
Please login to merge, or discard this patch.