Skip to content

Commit 4e71b88

Browse files
Merge pull request #143 from marlon-be/feature/symfony5
add support for Symfony 5 components
2 parents 815d6b5 + a250ad4 commit 4e71b88

File tree

8 files changed

+31
-21
lines changed

8 files changed

+31
-21
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
}],
1717
"require": {
1818
"php": ">=5.3.2",
19-
"symfony/console": "^2.0||^3.0||^4.0",
20-
"symfony/config": "^2.0||^3.0||^4.0"
19+
"symfony/console": "^2.0||^3.0||^4.0||^5.0",
20+
"symfony/config": "^2.0||^3.0||^4.0||^5.0"
2121
},
2222
"require-dev": {
2323
"phpunit/phpunit": "3.*",

src/Phpmig/Console/Command/DownCommand.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,17 @@ protected function execute(InputInterface $input, OutputInterface $output)
5858
$version = $input->getArgument('version');
5959

6060
if (!in_array($version, $versions)) {
61-
return;
61+
return 0;
6262
}
6363

6464
if (!isset($migrations[$version])) {
65-
return;
65+
return 0;
6666
}
6767

6868
$container = $this->getContainer();
6969
$container['phpmig.migrator']->down($migrations[$version]);
70+
71+
return 0;
7072
}
7173
}
7274

src/Phpmig/Console/Command/GenerateCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public function down()
153153
'.' . str_replace(getcwd(), '', $path)
154154
);
155155

156-
return;
156+
return 0;
157157
}
158158

159159
protected function transMigName($migrationName)

src/Phpmig/Console/Command/MigrateCommand.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,5 +112,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
112112
$container['phpmig.migrator']->up($migration);
113113
}
114114
}
115+
116+
return 0;
115117
}
116118
}

src/Phpmig/Console/Command/RedoCommand.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,18 @@ protected function execute(InputInterface $input, OutputInterface $output)
5858
$version = $input->getArgument('version');
5959

6060
if (!in_array($version, $versions)) {
61-
return;
61+
return 0;
6262
}
6363

6464
if (!isset($migrations[$version])) {
65-
return;
65+
return 0;
6666
}
6767

6868
$container = $this->getContainer();
6969
$container['phpmig.migrator']->down($migrations[$version]);
7070
$container['phpmig.migrator']->up($migrations[$version]);
71+
72+
return 0;
7173
}
7274
}
7375

src/Phpmig/Console/Command/RollbackCommand.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
5555

5656
$migrations = $this->getMigrations();
5757
$versions = $this->getAdapter()->fetchAll();
58-
58+
5959
$version = $input->getOption('target');
6060

6161
ksort($migrations);
@@ -64,9 +64,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
6464
// Check we have at least 1 migration to revert
6565
if (empty($versions) || $version == end($versions)) {
6666
$output->writeln("<error>No migrations to rollback</error>");
67-
return;
67+
return 0;
6868
}
69-
69+
7070
// If no target version was supplied, revert the last migration
7171
if (null === $version) {
7272
// Get the migration before the last run migration
@@ -75,17 +75,17 @@ protected function execute(InputInterface $input, OutputInterface $output)
7575
} else {
7676
// Get the first migration number
7777
$first = reset($versions);
78-
78+
7979
// If the target version is before the first migration, revert all migrations
8080
if ($version < $first) {
8181
$version = 0;
8282
}
8383
}
84-
84+
8585
// Check the target version exists
8686
if (0 !== $version && !isset($migrations[$version])) {
8787
$output->writeln("<error>Target version ($version) not found</error>");
88-
return;
88+
return 0;
8989
}
9090

9191
// Revert the migration(s)
@@ -100,5 +100,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
100100
$container['phpmig.migrator']->down($migration);
101101
}
102102
}
103+
104+
return 0;
103105
}
104106
}

src/Phpmig/Console/Command/StatusCommand.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
5454

5555
$versions = $this->getAdapter()->fetchAll();
5656
foreach($this->getMigrations() as $migration) {
57-
57+
5858
if (in_array($migration->getVersion(), $versions)) {
5959
$status = " <info>up</info> ";
6060
unset($versions[array_search($migration->getVersion(), $versions)]);
@@ -63,23 +63,23 @@ protected function execute(InputInterface $input, OutputInterface $output)
6363
}
6464

6565
$output->writeln(
66-
$status .
67-
sprintf(" %14s ", $migration->getVersion()) .
66+
$status .
67+
sprintf(" %14s ", $migration->getVersion()) .
6868
" <comment>" . $migration->getName() . "</comment>"
6969
);
7070
}
7171

7272
foreach($versions as $missing) {
7373
$output->writeln(
74-
' <error>up</error> ' .
75-
sprintf(" %14s ", $missing) .
74+
' <error>up</error> ' .
75+
sprintf(" %14s ", $missing) .
7676
' <error>** MISSING **</error> '
7777
);
7878
}
7979

8080
// print status
8181
$output->writeln("");
82-
return;
82+
return 0;
8383
}
8484
}
8585

src/Phpmig/Console/Command/UpCommand.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,17 @@ protected function execute(InputInterface $input, OutputInterface $output)
5858
$version = $input->getArgument('version');
5959

6060
if (in_array($version, $versions)) {
61-
return;
61+
return 0;
6262
}
6363

6464
if (!isset($migrations[$version])) {
65-
return;
65+
return 0;
6666
}
6767

6868
$container = $this->getContainer();
6969
$container['phpmig.migrator']->up($migrations[$version]);
70+
71+
return 0;
7072
}
7173
}
7274

0 commit comments

Comments
 (0)