@@ -42,7 +42,7 @@ |
||
| 42 | 42 | public function register() |
| 43 | 43 | { |
| 44 | 44 | $container = $this->getContainer(); |
| 45 | - $container->singleton(Services::STORAGE, function (Config $config) { |
|
| 45 | + $container->singleton(Services::STORAGE, function(Config $config) { |
|
| 46 | 46 | $storageFile = $config->getStorageFilePath(); |
| 47 | 47 | $result = touch($storageFile); |
| 48 | 48 | if (!$result) { |
@@ -52,7 +52,7 @@ |
||
| 52 | 52 | |
| 53 | 53 | $container->singleton( |
| 54 | 54 | Services::TIMELINE, |
| 55 | - function (RepositoryInterface $repository, StorageInterface $storage, ComparatorInterface $comparator) { |
|
| 55 | + function(RepositoryInterface $repository, StorageInterface $storage, ComparatorInterface $comparator) { |
|
| 56 | 56 | $available = $repository->fetchAll(); |
| 57 | 57 | $migrated = $storage->fetchAll(); |
| 58 | 58 | $factory = new TimelineFactory($available, $migrated); |
@@ -95,8 +95,7 @@ |
||
| 95 | 95 | foreach ($arrays[$i] as $v) { |
| 96 | 96 | foreach ($tmp as $t) { |
| 97 | 97 | $result[] = is_array($t) ? |
| 98 | - array_merge(array($v), $t) : |
|
| 99 | - array($v, $t); |
|
| 98 | + array_merge(array($v), $t) : array($v, $t); |
|
| 100 | 99 | } |
| 101 | 100 | } |
| 102 | 101 | |
@@ -80,8 +80,8 @@ |
||
| 80 | 80 | public function executeProvider() |
| 81 | 81 | { |
| 82 | 82 | return [ |
| 83 | - [ true ], |
|
| 84 | - [ false ], |
|
| 83 | + [true], |
|
| 84 | + [false], |
|
| 85 | 85 | ]; |
| 86 | 86 | } |
| 87 | 87 | |
@@ -64,8 +64,8 @@ |
||
| 64 | 64 | 'setAliases' => [ |
| 65 | 65 | 'with' => [['init']], |
| 66 | 66 | ], |
| 67 | - [ 'name' => 'setDescription', |
|
| 68 | - 'with' => m::type('string'),] |
|
| 67 | + ['name' => 'setDescription', |
|
| 68 | + 'with' => m::type('string'), ] |
|
| 69 | 69 | ]; |
| 70 | 70 | } |
| 71 | 71 | |
@@ -197,8 +197,7 @@ discard block |
||
| 197 | 197 | $this->command->setRepository($this->repository); |
| 198 | 198 | $this->command->setStorage($this->storage); |
| 199 | 199 | $currentMsg = $migrated->last() === false ? |
| 200 | - '/[Nn]othing has been migrated/' : |
|
| 201 | - '/[Cc]urrent version.*?' . $migrated->last()->getId() . '.*?$/'; |
|
| 200 | + '/[Nn]othing has been migrated/' : '/[Cc]urrent version.*?' . $migrated->last()->getId() . '.*?$/'; |
|
| 202 | 201 | $this->output->shouldReceive('writeln')->once()->with($currentMsg); |
| 203 | 202 | if ($pendingCount > 0) { |
| 204 | 203 | $this->output->shouldReceive('writeln')->with(m::on(function($messages) use ($pendingCount) { |
@@ -238,7 +237,7 @@ discard block |
||
| 238 | 237 | // the number of pending migrations with the foreach loop below (see comment below). |
| 239 | 238 | $repVersions = [ |
| 240 | 239 | [], |
| 241 | - Version::fromArray(range(1,10)), |
|
| 240 | + Version::fromArray(range(1, 10)), |
|
| 242 | 241 | ]; |
| 243 | 242 | $repositories = []; |
| 244 | 243 | foreach ($repVersions as $versions) { |
@@ -247,7 +246,7 @@ discard block |
||
| 247 | 246 | } |
| 248 | 247 | $storageVersions = [ |
| 249 | 248 | [], |
| 250 | - Version::fromArray(range(1,3)), |
|
| 249 | + Version::fromArray(range(1, 3)), |
|
| 251 | 250 | ]; |
| 252 | 251 | $storages = []; |
| 253 | 252 | foreach ($storageVersions as $versions) { |
@@ -258,7 +257,7 @@ discard block |
||
| 258 | 257 | $combinations = $this->combinations([$repositories, $storages]); |
| 259 | 258 | |
| 260 | 259 | // calculate pending number of migrations and set that as the third parameter. See note in function header. |
| 261 | - foreach($combinations as &$combination) { // NB: addressing by reference! |
|
| 260 | + foreach ($combinations as &$combination) { // NB: addressing by reference! |
|
| 262 | 261 | $pending = $combination[0]->count() - $combination[1]->count(); |
| 263 | 262 | $combination[] = $pending; |
| 264 | 263 | } |
@@ -319,16 +318,16 @@ discard block |
||
| 319 | 318 | $file3 = '/var/log/http/website/error.log'; |
| 320 | 319 | $dir1 = '/var'; |
| 321 | 320 | return [ |
| 322 | - ['', '', ''], // empty |
|
| 323 | - ['/', '/', ''], // from root to root |
|
| 324 | - ['/var', '/var', ''], // from directory to directory |
|
| 325 | - ['/var/log.php', '/var/log.php', ''], // from file to file |
|
| 326 | - ['/', '/var/log.php', 'var/log.php'], // from root to file |
|
| 327 | - ['', '/var/log.php', 'var/log.php'], // without $from (same as from root) |
|
| 328 | - ['/var', '', '..'], // towards root |
|
| 329 | - ['/var', '', '..'], // without $to (same as towards root) |
|
| 330 | - [$file1, $file2, '../../..' . $file2], // backwards traversal |
|
| 331 | - [$file1, $file3, 'website/error.log'], // inward traversal |
|
| 321 | + ['', '', ''], // empty |
|
| 322 | + ['/', '/', ''], // from root to root |
|
| 323 | + ['/var', '/var', ''], // from directory to directory |
|
| 324 | + ['/var/log.php', '/var/log.php', ''], // from file to file |
|
| 325 | + ['/', '/var/log.php', 'var/log.php'], // from root to file |
|
| 326 | + ['', '/var/log.php', 'var/log.php'], // without $from (same as from root) |
|
| 327 | + ['/var', '', '..'], // towards root |
|
| 328 | + ['/var', '', '..'], // without $to (same as towards root) |
|
| 329 | + [$file1, $file2, '../../..' . $file2], // backwards traversal |
|
| 330 | + [$file1, $file3, 'website/error.log'], // inward traversal |
|
| 332 | 331 | [$dir1, $file1, 'log/http/access.log'], // inward traversal from directory |
| 333 | 332 | ]; |
| 334 | 333 | } |
@@ -207,28 +207,28 @@ |
||
| 207 | 207 | public function handleProvider() |
| 208 | 208 | { |
| 209 | 209 | return [ |
| 210 | - [ // simple test |
|
| 210 | + [// simple test |
|
| 211 | 211 | ['SimpleTitle' => 'SimpleTitle'], |
| 212 | 212 | ['SimpleNamespace' => 'SimpleNamespace'], |
| 213 | 213 | true, // success |
| 214 | 214 | ], |
| 215 | - [ // simple test with editor cmd |
|
| 215 | + [// simple test with editor cmd |
|
| 216 | 216 | ['SimpleTitle' => 'SimpleTitle'], |
| 217 | 217 | ['SimpleNamespace' => 'SimpleNamespace'], |
| 218 | 218 | true, |
| 219 | 219 | 'which' // FIXME: it would be better to test whether this gets called |
| 220 | 220 | ], |
| 221 | - [ // test null namespace (load from config) |
|
| 221 | + [// test null namespace (load from config) |
|
| 222 | 222 | ['SimpleTitle' => 'SimpleTitle'], |
| 223 | 223 | [0 => 'SimpleNamespace'], |
| 224 | 224 | true, |
| 225 | 225 | ], |
| 226 | - [ // test write failure |
|
| 226 | + [// test write failure |
|
| 227 | 227 | ['SimpleTitle' => 'SimpleTitle'], |
| 228 | 228 | ['SimpleNamespace\\' => 'SimpleNamespace'], // also test trailing \ in namespace name |
| 229 | 229 | false, |
| 230 | 230 | ], |
| 231 | - [ // test title and namespace sanitizing |
|
| 231 | + [// test title and namespace sanitizing |
|
| 232 | 232 | ['I!n@v@a#l$i%d=_-+^T&i*t(l)e' => 'Invalid_Title'], |
| 233 | 233 | ['I!n@v#a$l%i^d&_¶N*a(m)e∞s-p+a=ce' => 'Invalid_Namespace'], |
| 234 | 234 | true, |
@@ -55,22 +55,22 @@ |
||
| 55 | 55 | protected function getExpectations() |
| 56 | 56 | { |
| 57 | 57 | return [ |
| 58 | - [ 'name' => 'setName', |
|
| 58 | + ['name' => 'setName', |
|
| 59 | 59 | 'with' => 'migrations:create', |
| 60 | 60 | ], |
| 61 | - [ 'name' => 'setAliases', |
|
| 61 | + ['name' => 'setAliases', |
|
| 62 | 62 | 'with' => [['create']], |
| 63 | 63 | ], |
| 64 | - [ 'name' => 'setDescription', |
|
| 64 | + ['name' => 'setDescription', |
|
| 65 | 65 | 'with' => [m::type('string')], |
| 66 | 66 | ], |
| 67 | - [ 'name' => 'addArgument', |
|
| 67 | + ['name' => 'addArgument', |
|
| 68 | 68 | 'with' => ['title', m::any(), m::type('string'), m::any()] |
| 69 | 69 | ], |
| 70 | - [ 'name' => 'addOption', |
|
| 70 | + ['name' => 'addOption', |
|
| 71 | 71 | 'with' => ['namespace', m::any(), InputOption::VALUE_OPTIONAL, m::type('string'), m::any()] |
| 72 | 72 | ], |
| 73 | - [ 'name' => 'addOption', |
|
| 73 | + ['name' => 'addOption', |
|
| 74 | 74 | 'with' => ['editor-cmd', m::any(), InputOption::VALUE_OPTIONAL, m::type('string')] |
| 75 | 75 | ], |
| 76 | 76 | ]; |
@@ -43,7 +43,7 @@ |
||
| 43 | 43 | ->shouldAllowMockingProtectedMethods() |
| 44 | 44 | ->makePartial(); |
| 45 | 45 | $this->command = m::mock(LatestMessage::class); |
| 46 | - $comparator = function(){}; |
|
| 46 | + $comparator = function() {}; |
|
| 47 | 47 | $repository = m::mock(RepositoryInterface::class); |
| 48 | 48 | $this->command->shouldReceive([ |
| 49 | 49 | 'getRepository' => $repository, |