@@ -23,14 +23,16 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | public function perform() |
| 25 | 25 | { |
| 26 | - if (!$this->verifyConfigured() || !$this->verifyEnvironment()) { |
|
| 26 | + if (!$this->verifyConfigured() || !$this->verifyEnvironment()) |
|
| 27 | + { |
|
| 27 | 28 | return; |
| 28 | 29 | } |
| 29 | 30 | |
| 30 | 31 | $found = false; |
| 31 | 32 | $count = $this->option('one') ? 1 : PHP_INT_MAX; |
| 32 | 33 | |
| 33 | - while ($count > 0 && ($migration = $this->migrator->run())) { |
|
| 34 | + while ($count > 0 && ($migration = $this->migrator->run())) |
|
| 35 | + { |
|
| 34 | 36 | $found = true; |
| 35 | 37 | $count--; |
| 36 | 38 | |
@@ -40,7 +42,8 @@ discard block |
||
| 40 | 42 | ); |
| 41 | 43 | } |
| 42 | 44 | |
| 43 | - if (!$found) { |
|
| 45 | + if (!$found) |
|
| 46 | + { |
|
| 44 | 47 | $this->writeln("<fg=red>No outstanding migrations were found.</fg=red>"); |
| 45 | 48 | } |
| 46 | 49 | } |
@@ -40,7 +40,8 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | protected function verifyConfigured(): bool |
| 42 | 42 | { |
| 43 | - if (!$this->migrator->isConfigured()) { |
|
| 43 | + if (!$this->migrator->isConfigured()) |
|
| 44 | + { |
|
| 44 | 45 | $this->writeln( |
| 45 | 46 | "<fg=red>Migrations are not configured yet, run '<info>migrate:init</info>' first.</fg=red>" |
| 46 | 47 | ); |
@@ -58,14 +59,16 @@ discard block |
||
| 58 | 59 | */ |
| 59 | 60 | protected function verifyEnvironment(): bool |
| 60 | 61 | { |
| 61 | - if ($this->option('force') || $this->config->isSafe()) { |
|
| 62 | + if ($this->option('force') || $this->config->isSafe()) |
|
| 63 | + { |
|
| 62 | 64 | //Safe to run |
| 63 | 65 | return true; |
| 64 | 66 | } |
| 65 | 67 | |
| 66 | 68 | $this->writeln("<fg=red>Confirmation is required to run migrations!</fg=red>"); |
| 67 | 69 | |
| 68 | - if (!$this->askConfirmation()) { |
|
| 70 | + if (!$this->askConfirmation()) |
|
| 71 | + { |
|
| 69 | 72 | $this->writeln("<comment>Cancelling operation...</comment>"); |
| 70 | 73 | |
| 71 | 74 | return false; |
@@ -23,14 +23,16 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | public function perform() |
| 25 | 25 | { |
| 26 | - if (!$this->verifyConfigured() || !$this->verifyEnvironment()) { |
|
| 26 | + if (!$this->verifyConfigured() || !$this->verifyEnvironment()) |
|
| 27 | + { |
|
| 27 | 28 | //Making sure we can safely migrate in this environment |
| 28 | 29 | return; |
| 29 | 30 | } |
| 30 | 31 | |
| 31 | 32 | $found = false; |
| 32 | 33 | $count = !$this->option('all') ? 1 : PHP_INT_MAX; |
| 33 | - while ($count > 0 && ($migration = $this->migrator->rollback())) { |
|
| 34 | + while ($count > 0 && ($migration = $this->migrator->rollback())) |
|
| 35 | + { |
|
| 34 | 36 | $found = true; |
| 35 | 37 | $count--; |
| 36 | 38 | $this->sprintf( |
@@ -39,7 +41,8 @@ discard block |
||
| 39 | 41 | ); |
| 40 | 42 | } |
| 41 | 43 | |
| 42 | - if (!$found) { |
|
| 44 | + if (!$found) |
|
| 45 | + { |
|
| 43 | 46 | $this->writeln("<fg=red>No executed migrations were found.</fg=red>"); |
| 44 | 47 | } |
| 45 | 48 | } |
@@ -44,17 +44,21 @@ discard block |
||
| 44 | 44 | string $mergeMode = self::FOLLOW, |
| 45 | 45 | int $mode = FilesInterface::READONLY |
| 46 | 46 | ) { |
| 47 | - if (!$this->files->isFile($filename)) { |
|
| 47 | + if (!$this->files->isFile($filename)) |
|
| 48 | + { |
|
| 48 | 49 | throw new PublishException("Given '{$filename}' is not valid file"); |
| 49 | 50 | } |
| 50 | 51 | |
| 51 | - if ($this->files->exists($destination)) { |
|
| 52 | - if ($this->files->md5($destination) == $this->files->md5($filename)) { |
|
| 52 | + if ($this->files->exists($destination)) |
|
| 53 | + { |
|
| 54 | + if ($this->files->md5($destination) == $this->files->md5($filename)) |
|
| 55 | + { |
|
| 53 | 56 | //Nothing to do |
| 54 | 57 | return; |
| 55 | 58 | } |
| 56 | 59 | |
| 57 | - if ($mergeMode == self::FOLLOW) { |
|
| 60 | + if ($mergeMode == self::FOLLOW) |
|
| 61 | + { |
|
| 58 | 62 | return; |
| 59 | 63 | } |
| 60 | 64 | } |
@@ -76,7 +80,8 @@ discard block |
||
| 76 | 80 | string $mergeMode = self::REPLACE, |
| 77 | 81 | int $mode = FilesInterface::READONLY |
| 78 | 82 | ) { |
| 79 | - if (!$this->files->isDirectory($directory)) { |
|
| 83 | + if (!$this->files->isDirectory($directory)) |
|
| 84 | + { |
|
| 80 | 85 | throw new PublishException("Given '{$directory}' is not valid directory"); |
| 81 | 86 | } |
| 82 | 87 | |
@@ -86,7 +91,8 @@ discard block |
||
| 86 | 91 | /** |
| 87 | 92 | * @var SplFileInfo $file |
| 88 | 93 | */ |
| 89 | - foreach ($finder->getIterator() as $file) { |
|
| 94 | + foreach ($finder->getIterator() as $file) |
|
| 95 | + { |
|
| 90 | 96 | $this->publish( |
| 91 | 97 | (string)$file, |
| 92 | 98 | $destination . '/' . $file->getRelativePathname(), |
@@ -43,7 +43,8 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | public function createPaginator(string $parameter, int $limit = 25): PaginatorInterface |
| 45 | 45 | { |
| 46 | - if (!$this->container->has(ServerRequestInterface::class)) { |
|
| 46 | + if (!$this->container->has(ServerRequestInterface::class)) |
|
| 47 | + { |
|
| 47 | 48 | throw new ScopeException("Unable to create paginator, no request scope found"); |
| 48 | 49 | } |
| 49 | 50 | /** |
@@ -53,7 +54,8 @@ discard block |
||
| 53 | 54 | |
| 54 | 55 | //Getting page number |
| 55 | 56 | $page = 0; |
| 56 | - if (!empty($query[$parameter]) && is_scalar($query[$parameter])) { |
|
| 57 | + if (!empty($query[$parameter]) && is_scalar($query[$parameter])) |
|
| 58 | + { |
|
| 57 | 59 | $page = (int)$query[$parameter]; |
| 58 | 60 | } |
| 59 | 61 | |
@@ -68,7 +68,8 @@ |
||
| 68 | 68 | protected function fetchCookies(array $header) |
| 69 | 69 | { |
| 70 | 70 | $result = []; |
| 71 | - foreach ($header as $line) { |
|
| 71 | + foreach ($header as $line) |
|
| 72 | + { |
|
| 72 | 73 | $cookie = explode('=', $line); |
| 73 | 74 | $result[$cookie[0]] = rawurldecode(substr($cookie[1], 0, strpos($cookie[1], ';'))); |
| 74 | 75 | } |
@@ -16,7 +16,8 @@ |
||
| 16 | 16 | { |
| 17 | 17 | $output = $this->runCommand('php:extensions'); |
| 18 | 18 | |
| 19 | - foreach (get_loaded_extensions() as $extension) { |
|
| 19 | + foreach (get_loaded_extensions() as $extension) |
|
| 20 | + { |
|
| 20 | 21 | $this->assertContains($extension, $output); |
| 21 | 22 | } |
| 22 | 23 | } |
@@ -31,12 +31,14 @@ |
||
| 31 | 31 | |
| 32 | 32 | $fs = new Files(); |
| 33 | 33 | |
| 34 | - if ($fs->isDirectory(__DIR__ . '/../app/migrations')) { |
|
| 34 | + if ($fs->isDirectory(__DIR__ . '/../app/migrations')) |
|
| 35 | + { |
|
| 35 | 36 | $fs->deleteDirectory(__DIR__ . '/../app/migrations'); |
| 36 | 37 | } |
| 37 | 38 | |
| 38 | 39 | $runtime = $this->app->get(DirectoriesInterface::class)->get('runtime'); |
| 39 | - if ($fs->isDirectory($runtime)) { |
|
| 40 | + if ($fs->isDirectory($runtime)) |
|
| 41 | + { |
|
| 40 | 42 | $fs->deleteDirectory($runtime); |
| 41 | 43 | } |
| 42 | 44 | } |
@@ -17,9 +17,12 @@ |
||
| 17 | 17 | { |
| 18 | 18 | $app = $this->makeApp(); |
| 19 | 19 | |
| 20 | - try { |
|
| 20 | + try |
|
| 21 | + { |
|
| 21 | 22 | throw new \Error("test error"); |
| 22 | - } catch (\Error $e) { |
|
| 23 | + } |
|
| 24 | + catch (\Error $e) |
|
| 25 | + { |
|
| 23 | 26 | /** @var SnapshotInterface $s */ |
| 24 | 27 | $s = $app->get(SnapshotterInterface::class)->register($e); |
| 25 | 28 | } |