Skip to content

Commit 6a578c0

Browse files
committed
Modify code for PHP 7.2 support
1 parent b3a83fb commit 6a578c0

File tree

4 files changed

+22
-8
lines changed

4 files changed

+22
-8
lines changed

classes/BackupManager.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,12 @@ public function clear(): int
7575
public function list(): array
7676
{
7777
return collect(File::files($this->folder))
78-
->filter(fn ($file) => Str::startsWith($file->getFilename(), $this->prefix))
79-
->sortBy(fn ($file) => $file->getCTime())
78+
->filter(function ($file) {
79+
return Str::startsWith($file->getFilename(), $this->prefix);
80+
})
81+
->sortBy(function ($file) {
82+
return $file->getCTime();
83+
})
8084
->toArray();
8185
}
8286

classes/drivers/Mysql.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ public function backupStream(): string
4040
;
4141

4242
$tables = collect($this->getListOfTables())
43-
->map(fn ($item) => $item->getName())
43+
->map(function ($item) {
44+
return $item->getName();
45+
})
4446
->diff($this->excludedTables)
4547
->toArray();
4648

@@ -55,7 +57,9 @@ public function backupStream(): string
5557
}
5658

5759
$views = collect($this->getListOfViews())
58-
->map(fn ($item) => $item->getName())
60+
->map(function ($item) {
61+
return $item->getName();
62+
})
5963
->diff($this->excludedTables)
6064
->toArray();
6165

@@ -150,7 +154,9 @@ protected function getInsertStatement(string $table): string
150154
if ($chunk->first() != $row) {
151155
$output .= ',';
152156
}
153-
$row = collect($row)->map(fn ($value) => $this->quote($value));
157+
$row = collect($row)->map(function ($value) {
158+
return $this->quote($value);
159+
});
154160
$output .= PHP_EOL . "(" . $row->implode(', ') . ")";
155161
}
156162
$output .= ";" . PHP_EOL;
@@ -266,7 +272,9 @@ protected function getListOfViews(): array
266272
protected function getListOfColumns(string $table): array
267273
{
268274
return collect($this->connection->getDoctrineSchemaManager()->listTableColumns($table))
269-
->map(fn ($item) => $item->getName())
275+
->map(function ($item) {
276+
return $item->getName();
277+
})
270278
->toArray();
271279
}
272280

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
}
1818
],
1919
"require": {
20-
"php": ">=7.4",
20+
"php": ">=7.2",
2121
"composer/installers": "~1.0"
2222
},
2323
"autoload" : {

updates/version.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@
55
1.1.1:
66
- Updated DB type mapping
77
1.1.2:
8-
- Fix composer command in readme
8+
- Fix composer command in readme
9+
1.1.3:
10+
- Modify code for PHP 7.2 support

0 commit comments

Comments
 (0)