Completed
Push — master ( 6c622b...a26817 )
by Gaetano
09:16
created
Core/MigrationService.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 
46 46
     public function addExecutor(ExecutorInterface $executor)
47 47
     {
48
-        foreach($executor->supportedTypes() as $type) {
48
+        foreach ($executor->supportedTypes() as $type) {
49 49
             $this->executors[$type] = $executor;
50 50
         }
51 51
     }
@@ -60,8 +60,8 @@  discard block
 block discarded – undo
60 60
     {
61 61
         // we try to be flexible in file types we support, and the same time avoid loading all files in a directory
62 62
         $handledDefinitions = array();
63
-        foreach($this->loader->listAvailableDefinitions($paths) as $migrationName => $definitionPath) {
64
-            foreach($this->DefinitionParsers as $definitionParser) {
63
+        foreach ($this->loader->listAvailableDefinitions($paths) as $migrationName => $definitionPath) {
64
+            foreach ($this->DefinitionParsers as $definitionParser) {
65 65
                 if ($definitionParser->supports($migrationName)) {
66 66
                     $handledDefinitions[] = $definitionPath;
67 67
                 }
@@ -122,13 +122,13 @@  discard block
 block discarded – undo
122 122
      */
123 123
     public function parseMigrationDefinition(MigrationDefinition $migrationDefinition)
124 124
     {
125
-        foreach($this->DefinitionParsers as $definitionParser) {
125
+        foreach ($this->DefinitionParsers as $definitionParser) {
126 126
             if ($definitionParser->supports($migrationDefinition->name)) {
127 127
                 // parse the source file
128 128
                 $migrationDefinition = $definitionParser->parseMigrationDefinition($migrationDefinition);
129 129
 
130 130
                 // and make sure we know how to handle all steps
131
-                foreach($migrationDefinition->steps as $step) {
131
+                foreach ($migrationDefinition->steps as $step) {
132 132
                     if (!isset($this->executors[$step->type])) {
133 133
                         return new MigrationDefinition(
134 134
                             $migrationDefinition->name,
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 
173 173
             $i = 1;
174 174
 
175
-            foreach($migrationDefinition->steps as $step) {
175
+            foreach ($migrationDefinition->steps as $step) {
176 176
                 // we validated the fact that we have a good executor at parsing time
177 177
                 $executor = $this->executors[$step->type];
178 178
                 $executor->execute($step);
@@ -193,16 +193,16 @@  discard block
 block discarded – undo
193 193
 
194 194
             try {
195 195
                 $this->repository->commit();
196
-            } catch(\RuntimeException $e) {
196
+            } catch (\RuntimeException $e) {
197 197
                 // at present time, the ez5 repo does not support nested commits. So if some migration step has committed
198 198
                 // already, we get an exception a this point. Extremely poor design, but what can we do ?
199 199
                 /// @todo log warning
200 200
             }
201 201
 
202
-        } catch(\Exception $e) {
202
+        } catch (\Exception $e) {
203 203
             try {
204 204
                 $this->repository->rollBack();
205
-            } catch(\RuntimeException $e2) {
205
+            } catch (\RuntimeException $e2) {
206 206
                 // at present time, the ez5 repo does not support nested commits. So if some migration step has committed
207 207
                 // already, we get an exception a this point. Extremely poor design, but what can we do ?
208 208
                 /// @todo log error
Please login to merge, or discard this patch.
Command/MigrateCommand.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 
68 68
         // filter away all migrations except 'to do' ones
69 69
         $toExecute = array();
70
-        foreach($migrationDefinitions as $name => $migrationDefinition) {
70
+        foreach ($migrationDefinitions as $name => $migrationDefinition) {
71 71
             if (!isset($migrations[$name]) || (($migration = $migrations[$name]) && $migration->status == Migration::STATUS_TODO)) {
72 72
                 $toExecute[$name] = $migrationsService->parseMigrationDefinition($migrationDefinition);
73 73
             }
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 
101 101
         $data = array();
102 102
         $i = 1;
103
-        foreach($toExecute as $name => $migrationDefinition) {
103
+        foreach ($toExecute as $name => $migrationDefinition) {
104 104
             $notes = '';
105 105
             if ($migrationDefinition->status != MigrationDefinition::STATUS_PARSED) {
106 106
                 $notes = '<error>' . $migrationDefinition->parsingError . '</error>';
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
             $output->writeln("=============================================\n");
136 136
         }
137 137
 
138
-        foreach($toExecute as $name => $migrationDefinition) {
138
+        foreach ($toExecute as $name => $migrationDefinition) {
139 139
 
140 140
             // let's skip migrations that we know are invalid - user was warned and he decided to proceed anyway
141 141
             if ($migrationDefinition->status == MigrationDefinition::STATUS_INVALID) {
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 
148 148
             try {
149 149
                 $migrationsService->executeMigration($migrationDefinition);
150
-            } catch(\Exception $e) {
150
+            } catch (\Exception $e) {
151 151
                 if ($input->getOption('ignore-failures')) {
152 152
                     $output->writeln("\n<error>Migration failed! Reason: " . $e->getMessage() . "</error>\n");
153 153
                     continue;
Please login to merge, or discard this patch.