@@ -223,7 +223,7 @@ |
||
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 | ); |
@@ -1242,7 +1242,7 @@ |
||
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]; |
@@ -312,7 +312,7 @@ |
||
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) . ';'; |
@@ -549,7 +549,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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']; |
@@ -1280,7 +1280,7 @@ |
||
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]; |
@@ -36,7 +36,7 @@ discard block |
||
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 |
||
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 |
@@ -212,7 +212,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -70,7 +70,7 @@ |
||
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 |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | $env = $this->getEnvironment($environment); |
122 | 122 | $versions = $env->getVersionLog(); |
123 | 123 | |
124 | - $maxNameLength = $versions ? max(array_map(function ($version) { |
|
124 | + $maxNameLength = $versions ? max(array_map(function($version) { |
|
125 | 125 | return strlen($version['migration_name']); |
126 | 126 | }, $versions)) : 0; |
127 | 127 | |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | $versions = array_keys($this->getMigrations($environment)); |
286 | 286 | $dateString = $dateTime->format('YmdHis'); |
287 | 287 | |
288 | - $outstandingMigrations = array_filter($versions, function ($version) use ($dateString) { |
|
288 | + $outstandingMigrations = array_filter($versions, function($version) use ($dateString) { |
|
289 | 289 | return $version <= $dateString; |
290 | 290 | }); |
291 | 291 | |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | $target = 0; |
464 | 464 | } elseif (!is_numeric($target) && $target !== null) { // try to find a target version based on name |
465 | 465 | // search through the migrations using the name |
466 | - $migrationNames = array_map(function ($item) { |
|
466 | + $migrationNames = array_map(function($item) { |
|
467 | 467 | return $item['migration_name']; |
468 | 468 | }, $executedVersions); |
469 | 469 | $found = array_search($target, $migrationNames, true); |
@@ -708,7 +708,7 @@ discard block |
||
708 | 708 | $this->getOutput()->writeln('Migration file'); |
709 | 709 | $this->getOutput()->writeln( |
710 | 710 | array_map( |
711 | - function ($phpFile) { |
|
711 | + function($phpFile) { |
|
712 | 712 | return " <info>{$phpFile}</info>"; |
713 | 713 | }, |
714 | 714 | $phpFiles |