@@ -40,7 +40,7 @@ protected function configure(): void
40
40
{
41
41
$ this
42
42
->setDescription ('Run all not executed migrations with specified phase ' )
43
- ->addArgument (self ::ARGUMENT_PHASE , InputArgument::REQUIRED , MigrationPhase::BEFORE . '| ' . MigrationPhase::AFTER . '| ' . self ::PHASE_BOTH );
43
+ ->addArgument (self ::ARGUMENT_PHASE , InputArgument::REQUIRED , MigrationPhase::BEFORE -> value . '| ' . MigrationPhase::AFTER -> value . '| ' . self ::PHASE_BOTH );
44
44
}
45
45
46
46
public function execute (InputInterface $ input , OutputInterface $ output ): int
@@ -64,26 +64,26 @@ public function execute(InputInterface $input, OutputInterface $output): int
64
64
}
65
65
66
66
/**
67
- * @param string[] $phases
67
+ * @param list<MigrationPhase> $phases
68
68
*/
69
69
private function executeMigrations (OutputInterface $ output , array $ phases ): bool
70
70
{
71
71
$ executed = [];
72
72
73
73
if (in_array (MigrationPhase::BEFORE , $ phases , true )) {
74
- $ executed [MigrationPhase::BEFORE ] = $ this ->migrationService ->getExecutedVersions (MigrationPhase::BEFORE );
74
+ $ executed [MigrationPhase::BEFORE -> value ] = $ this ->migrationService ->getExecutedVersions (MigrationPhase::BEFORE );
75
75
}
76
76
77
77
if (in_array (MigrationPhase::AFTER , $ phases , true )) {
78
- $ executed [MigrationPhase::AFTER ] = $ this ->migrationService ->getExecutedVersions (MigrationPhase::AFTER );
78
+ $ executed [MigrationPhase::AFTER -> value ] = $ this ->migrationService ->getExecutedVersions (MigrationPhase::AFTER );
79
79
}
80
80
81
81
$ preparedVersions = $ this ->migrationService ->getPreparedVersions ();
82
82
$ migratedSomething = false ;
83
83
84
84
foreach ($ preparedVersions as $ version ) {
85
85
foreach ($ phases as $ phase ) {
86
- if (isset ($ executed [$ phase ][$ version ])) {
86
+ if (isset ($ executed [$ phase-> value ][$ version ])) {
87
87
continue ;
88
88
}
89
89
@@ -95,9 +95,9 @@ private function executeMigrations(OutputInterface $output, array $phases): bool
95
95
return $ migratedSomething ;
96
96
}
97
97
98
- private function executeMigration (OutputInterface $ output , string $ version , string $ phase ): void
98
+ private function executeMigration (OutputInterface $ output , string $ version , MigrationPhase $ phase ): void
99
99
{
100
- $ output ->write ("Executing migration {$ version } phase {$ phase }... " );
100
+ $ output ->write ("Executing migration {$ version } phase {$ phase-> value }... " );
101
101
102
102
$ run = $ this ->migrationService ->executeMigration ($ version , $ phase );
103
103
@@ -106,15 +106,15 @@ private function executeMigration(OutputInterface $output, string $version, stri
106
106
}
107
107
108
108
/**
109
- * @return list<string >
109
+ * @return list<MigrationPhase >
110
110
*/
111
111
private function getPhasesToRun (string $ phaseArgument ): array
112
112
{
113
- if ($ phaseArgument === MigrationPhase::BEFORE ) {
113
+ if ($ phaseArgument === MigrationPhase::BEFORE -> value ) {
114
114
return [MigrationPhase::BEFORE ];
115
115
}
116
116
117
- if ($ phaseArgument === MigrationPhase::AFTER ) {
117
+ if ($ phaseArgument === MigrationPhase::AFTER -> value ) {
118
118
return [MigrationPhase::AFTER ];
119
119
}
120
120
0 commit comments