Completed
Pull Request — master (#3)
by Joao
04:56
created
tests/MigrationTest.php 1 patch
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 namespace Test;
3 3
 
4
-use ByJG\AnyDataset\Store\PdoMysql;
5 4
 use ByJG\DbMigration\Migration;
6 5
 use ByJG\Util\Uri;
7 6
 
Please login to merge, or discard this patch.
src/Migration.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
             . "/" . ($increment < 0 ? "down" : "up")
115 115
             . "/*.sql";
116 116
 
117
-        $result = array_filter(glob($filePattern), function ($file) use ($version) {
117
+        $result = array_filter(glob($filePattern), function($file) use ($version) {
118 118
             return preg_match("/^0*$version(-dev)?\.sql$/", basename($file));
119 119
         });
120 120
 
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
     public function reset($upVersion = null)
150 150
     {
151 151
         if ($this->callableProgress) {
152
-            call_user_func_array($this->callableProgress, ['reset', 0]);
152
+            call_user_func_array($this->callableProgress, [ 'reset', 0 ]);
153 153
         }
154 154
         $this->getDbCommand()->dropDatabase();
155 155
         $this->getDbCommand()->createDatabase();
@@ -211,9 +211,9 @@  discard block
 block discarded – undo
211 211
     protected function migrate($upVersion, $increment, $force)
212 212
     {
213 213
         $versionInfo = $this->getCurrentVersion();
214
-        $currentVersion = intval($versionInfo['version']) + $increment;
214
+        $currentVersion = intval($versionInfo[ 'version' ]) + $increment;
215 215
 
216
-        if (strpos($versionInfo['status'], 'partial') !== false && !$force) {
216
+        if (strpos($versionInfo[ 'status' ], 'partial') !== false && !$force) {
217 217
             throw new DatabaseIsIncompleteException('Database was not fully updated. Use --force for migrate.');
218 218
         }
219 219
 
@@ -221,10 +221,10 @@  discard block
 block discarded – undo
221 221
             && file_exists($file = $this->getMigrationSql($currentVersion, $increment))
222 222
         ) {
223 223
             if ($this->callableProgress) {
224
-                call_user_func_array($this->callableProgress, ['migrate', $currentVersion]);
224
+                call_user_func_array($this->callableProgress, [ 'migrate', $currentVersion ]);
225 225
             }
226 226
 
227
-            $this->getDbCommand()->setVersion($currentVersion, 'partial ' . ($increment>0 ? 'up' : 'down'));
227
+            $this->getDbCommand()->setVersion($currentVersion, 'partial ' . ($increment > 0 ? 'up' : 'down'));
228 228
             $this->getDbCommand()->executeSql(file_get_contents($file));
229 229
             $this->getDbCommand()->setVersion($currentVersion, 'complete');
230 230
             $currentVersion = $currentVersion + $increment;
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
     public function update($upVersion = null, $force = false)
252 252
     {
253 253
         $versionInfo = $this->getCurrentVersion();
254
-        $version = intval($versionInfo['version']);
254
+        $version = intval($versionInfo[ 'version' ]);
255 255
         $increment = 1;
256 256
         if ($upVersion !== null && $upVersion < $version) {
257 257
             $increment = -1;
Please login to merge, or discard this patch.