Skip to content

Commit 5792fc5

Browse files
committed
Remove static closure declarations
1 parent 336f697 commit 5792fc5

7 files changed

Lines changed: 14 additions & 14 deletions

File tree

src/Filesystem/MigrationStorage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function findAll(): Collection
5858
{
5959
$files = $this->filesystem->glob($this->directory.'/*_*.php');
6060

61-
return collect($files)->sort()->map(static function (string $filePath) {
61+
return collect($files)->sort()->map(function (string $filePath) {
6262
return new MigrationFile($filePath);
6363
});
6464
}

src/Migrator.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function migrateAll(): self
6262
$files = $this->migrationStorage->findAll();
6363
$migratedFileNames = $this->migrationRepository->getAll();
6464

65-
$nonMigratedFiles = $files->filter(static function (MigrationFile $file) use ($migratedFileNames) {
65+
$nonMigratedFiles = $files->filter(function (MigrationFile $file) use ($migratedFileNames) {
6666
return ! $migratedFileNames->contains($file->getName());
6767
});
6868

@@ -125,7 +125,7 @@ public function showStatus(): self
125125

126126
$headers = ['Ran?', 'Last batch?', 'Migration'];
127127

128-
$rows = $files->map(static function (MigrationFile $file) use ($migratedFileNames, $migratedLastBatchFileNames) {
128+
$rows = $files->map(function (MigrationFile $file) use ($migratedFileNames, $migratedLastBatchFileNames) {
129129
return [
130130
$migratedFileNames->contains($file->getName()) ? '<info>Yes</info>' : '<comment>No</comment>',
131131
$migratedLastBatchFileNames->contains($file->getName()) ? '<info>Yes</info>' : '<comment>No</comment>',
@@ -185,7 +185,7 @@ protected function rollback(Collection $fileNames): self
185185
} elseif ($fileNames->count() != $files->count()) {
186186
$this->output->writeln(
187187
'<error>Migration is not found:</error> '.
188-
implode(',', $fileNames->diff($files->map(static function (MigrationFile $file) {
188+
implode(',', $fileNames->diff($files->map(function (MigrationFile $file) {
189189
return $file->getName();
190190
}))->toArray())
191191
);

tests/Integration/Adapters/IndexManagerAdapterTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function test_index_can_be_created_with_modifier(string $indexNamePrefix)
5454

5555
$indexName = 'test';
5656

57-
$modifier = static function (Mapping $mapping, Settings $settings) {
57+
$modifier = function (Mapping $mapping, Settings $settings) {
5858
$mapping->text('title');
5959
$settings->index(['number_of_replicas' => 2]);
6060
};
@@ -99,7 +99,7 @@ public function test_mapping_can_be_updated_using_modifier(string $indexNamePref
9999

100100
$indexName = 'test';
101101

102-
$modifier = static function (Mapping $mapping) {
102+
$modifier = function (Mapping $mapping) {
103103
$mapping->disableSource()->text('title');
104104
};
105105

@@ -121,7 +121,7 @@ public function test_settings_can_be_updated_using_modifier(string $indexNamePre
121121

122122
$indexName = 'test';
123123

124-
$modifier = static function (Settings $settings) {
124+
$modifier = function (Settings $settings) {
125125
$settings->index(['number_of_replicas' => 2, 'refresh_interval' => -1]);
126126
};
127127

@@ -143,7 +143,7 @@ public function test_settings_can_be_pushed_using_modifier(string $indexNamePref
143143

144144
$indexName = 'test';
145145

146-
$modifier = static function (Settings $settings) {
146+
$modifier = function (Settings $settings) {
147147
$settings->index(['number_of_replicas' => 2]);
148148
};
149149

tests/Integration/Filesystem/MigrationStorageTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public function test_all_files_within_migrations_directory_can_be_retrieved(): v
104104
'2018_12_01_081000_create_test_index',
105105
'2019_08_10_142230_update_test_index_mapping',
106106
],
107-
$files->map(static function (MigrationFile $file) {
107+
$files->map(function (MigrationFile $file) {
108108
return $file->getName();
109109
})->toArray()
110110
);

tests/Integration/RealOpenSearchMigrationCommandTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function test_index_adapter_operations_run_against_opensearch(): void
5858
$aliasName = $this->indexPrefix.'adapter_real_alias';
5959

6060
try {
61-
$index->create('adapter_real_test', static function (Mapping $mapping, Settings $settings): void {
61+
$index->create('adapter_real_test', function (Mapping $mapping, Settings $settings): void {
6262
$mapping
6363
->text('title')
6464
->keyword('status');
@@ -71,7 +71,7 @@ public function test_index_adapter_operations_run_against_opensearch(): void
7171

7272
$this->assertTrue($this->client()->indices()->exists(['index' => $indexName]));
7373

74-
$index->putMapping('adapter_real_test', static function (Mapping $mapping): void {
74+
$index->putMapping('adapter_real_test', function (Mapping $mapping): void {
7575
$mapping->keyword('category');
7676
});
7777

tests/migrations/2019_08_10_142230_update_test_index_mapping.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ class UpdateTestIndexMapping implements MigrationInterface
88
{
99
public function up(): void
1010
{
11-
Index::putMapping('test', static function (Mapping $mapping) {
11+
Index::putMapping('test', function (Mapping $mapping) {
1212
$mapping->enableSource();
1313
$mapping->text('title');
1414
});
1515
}
1616

1717
public function down(): void
1818
{
19-
Index::putMapping('test', static function (Mapping $mapping) {
19+
Index::putMapping('test', function (Mapping $mapping) {
2020
$mapping->disableSource();
2121
});
2222
}

tests/real_migrations/2026_01_01_000000_create_real_test_index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class CreateRealTestIndex implements MigrationInterface
1111
*/
1212
public function up(): void
1313
{
14-
Index::create('real_test', static function (Mapping $mapping) {
14+
Index::create('real_test', function (Mapping $mapping) {
1515
$mapping->text('title');
1616
});
1717
}

0 commit comments

Comments
 (0)