@@ -60,7 +60,7 @@ class Migrator
60
60
/**
61
61
* The paths to all of the migration files.
62
62
*
63
- * @var array
63
+ * @var string[]
64
64
*/
65
65
protected $ paths = [];
66
66
@@ -101,9 +101,9 @@ public function __construct(MigrationRepositoryInterface $repository,
101
101
/**
102
102
* Run the pending migrations at a given path.
103
103
*
104
- * @param array |string $paths
105
- * @param array $options
106
- * @return array
104
+ * @param string[] |string $paths
105
+ * @param array<string, mixed> $options
106
+ * @return string[]
107
107
*/
108
108
public function run ($ paths = [], array $ options = [])
109
109
{
@@ -127,23 +127,23 @@ public function run($paths = [], array $options = [])
127
127
/**
128
128
* Get the migration files that have not yet run.
129
129
*
130
- * @param array $files
131
- * @param array $ran
132
- * @return array
130
+ * @param string[] $files
131
+ * @param string[] $ran
132
+ * @return string[]
133
133
*/
134
134
protected function pendingMigrations ($ files , $ ran )
135
135
{
136
136
return Collection::make ($ files )
137
- ->reject (function ($ file ) use ( $ ran ) {
138
- return in_array ( $ this -> getMigrationName ( $ file ), $ ran );
139
- })-> values () ->all ();
137
+ ->reject (fn ($ file ) => in_array ( $ this -> getMigrationName ( $ file ), $ ran ))
138
+ -> values ()
139
+ ->all ();
140
140
}
141
141
142
142
/**
143
143
* Run an array of migrations.
144
144
*
145
- * @param array $migrations
146
- * @param array $options
145
+ * @param string[] $migrations
146
+ * @param array<string, mixed> $options
147
147
* @return void
148
148
*/
149
149
public function runPending (array $ migrations , array $ options = [])
@@ -220,9 +220,9 @@ protected function runUp($file, $batch, $pretend)
220
220
/**
221
221
* Rollback the last migration operation.
222
222
*
223
- * @param array |string $paths
224
- * @param array $options
225
- * @return array
223
+ * @param string[] |string $paths
224
+ * @param array<string, mixed> $options
225
+ * @return string[]
226
226
*/
227
227
public function rollback ($ paths = [], array $ options = [])
228
228
{
@@ -247,7 +247,7 @@ public function rollback($paths = [], array $options = [])
247
247
/**
248
248
* Get the migrations for a rollback operation.
249
249
*
250
- * @param array $options
250
+ * @param array<string, mixed> $options
251
251
* @return array
252
252
*/
253
253
protected function getMigrationsForRollback (array $ options )
@@ -267,9 +267,9 @@ protected function getMigrationsForRollback(array $options)
267
267
* Rollback the given migrations.
268
268
*
269
269
* @param array $migrations
270
- * @param array |string $paths
271
- * @param array $options
272
- * @return array
270
+ * @param string[] |string $paths
271
+ * @param array<string, mixed> $options
272
+ * @return string[]
273
273
*/
274
274
protected function rollbackMigrations (array $ migrations , $ paths , array $ options )
275
275
{
@@ -309,7 +309,7 @@ protected function rollbackMigrations(array $migrations, $paths, array $options)
309
309
/**
310
310
* Rolls all of the currently applied migrations back.
311
311
*
312
- * @param array |string $paths
312
+ * @param string[] |string $paths
313
313
* @param bool $pretend
314
314
* @return array
315
315
*/
@@ -334,8 +334,8 @@ public function reset($paths = [], $pretend = false)
334
334
/**
335
335
* Reset the given migrations.
336
336
*
337
- * @param array $migrations
338
- * @param array $paths
337
+ * @param string[] $migrations
338
+ * @param string[] $paths
339
339
* @param bool $pretend
340
340
* @return array
341
341
*/
@@ -344,9 +344,7 @@ protected function resetMigrations(array $migrations, array $paths, $pretend = f
344
344
// Since the getRan method that retrieves the migration name just gives us the
345
345
// migration name, we will format the names into objects with the name as a
346
346
// property on the objects so that we can pass it to the rollback method.
347
- $ migrations = collect ($ migrations )->map (function ($ m ) {
348
- return (object ) ['migration ' => $ m ];
349
- })->all ();
347
+ $ migrations = collect ($ migrations )->map (fn ($ m ) => (object ) ['migration ' => $ m ])->all ();
350
348
351
349
return $ this ->rollbackMigrations (
352
350
$ migrations , $ paths , compact ('pretend ' )
@@ -430,9 +428,10 @@ protected function pretendToRun($migration, $method)
430
428
431
429
$ this ->write (TwoColumnDetail::class, $ name );
432
430
433
- $ this ->write (BulletList::class, collect ($ this ->getQueries ($ migration , $ method ))->map (function ($ query ) {
434
- return $ query ['query ' ];
435
- }));
431
+ $ this ->write (
432
+ BulletList::class,
433
+ collect ($ this ->getQueries ($ migration , $ method ))->map (fn ($ query ) => $ query ['query ' ])
434
+ );
436
435
}
437
436
438
437
/**
@@ -532,23 +531,23 @@ protected function getMigrationClass(string $migrationName): string
532
531
* Get all of the migration files in a given path.
533
532
*
534
533
* @param string|array $paths
535
- * @return array
534
+ * @return array<string, string>
536
535
*/
537
536
public function getMigrationFiles ($ paths )
538
537
{
539
- return Collection::make ($ paths )-> flatMap ( function ( $ path ) {
540
- return str_ends_with ($ path , '.php ' ) ? [$ path ] : $ this ->files ->glob ($ path .'/*_*.php ' );
541
- }) ->filter ()-> values ()-> keyBy ( function ( $ file ) {
542
- return $ this -> getMigrationName ( $ file );
543
- })-> sortBy ( function ($ file, $ key ) {
544
- return $ key;
545
- }) ->all ();
538
+ return Collection::make ($ paths )
539
+ -> flatMap ( fn ( $ path ) => str_ends_with ($ path , '.php ' ) ? [$ path ] : $ this ->files ->glob ($ path .'/*_*.php ' ))
540
+ ->filter ()
541
+ -> values ()
542
+ -> keyBy ( fn ($ file) => $ this -> getMigrationName ( $ file ))
543
+ -> sortBy ( fn ( $ file , $ key) => $ key )
544
+ ->all ();
546
545
}
547
546
548
547
/**
549
548
* Require in all the migration files in a given path.
550
549
*
551
- * @param array $files
550
+ * @param string[] $files
552
551
* @return void
553
552
*/
554
553
public function requireFiles (array $ files )
@@ -583,7 +582,7 @@ public function path($path)
583
582
/**
584
583
* Get all of the custom migration paths.
585
584
*
586
- * @return array
585
+ * @return string[]
587
586
*/
588
587
public function paths ()
589
588
{
@@ -613,9 +612,7 @@ public function usingConnection($name, callable $callback)
613
612
614
613
$ this ->setConnection ($ name );
615
614
616
- return tap ($ callback (), function () use ($ previousConnection ) {
617
- $ this ->setConnection ($ previousConnection );
618
- });
615
+ return tap ($ callback (), fn () => $ this ->setConnection ($ previousConnection ));
619
616
}
620
617
621
618
/**
0 commit comments