@@ -43,7 +43,7 @@  | 
                                                    ||
| 43 | 43 | |
| 44 | 44 |          if (!$schema->exists()) { | 
                                                        
| 45 | 45 | throw new DBALException(  | 
                                                        
| 46 | -                "Table {$database->getName()}.{$this->argument('table')} does not exists." | 
                                                        |
| 46 | +                "table {$database->getName()}.{$this->argument('table')} does not exists." | 
                                                        |
| 47 | 47 | );  | 
                                                        
| 48 | 48 | }  | 
                                                        
| 49 | 49 | |
@@ -46,7 +46,7 @@ discard block  | 
                                                    ||
| 46 | 46 |          $database = $dbal->database($this->option('database')); | 
                                                        
| 47 | 47 |          $schema = $database->table($this->argument('table'))->getSchema(); | 
                                                        
| 48 | 48 | |
| 49 | -        if (!$schema->exists()) { | 
                                                        |
| 49 | +        if (!$schema->exists()){ | 
                                                        |
| 50 | 50 | throw new DBALException(  | 
                                                        
| 51 | 51 |                  "Table {$database->getName()}.{$this->argument('table')} does not exists." | 
                                                        
| 52 | 52 | );  | 
                                                        
@@ -60,11 +60,11 @@ discard block  | 
                                                    ||
| 60 | 60 | |
| 61 | 61 | $this->describeColumns($schema);  | 
                                                        
| 62 | 62 | |
| 63 | -        if (!empty($indexes = $schema->getIndexes())) { | 
                                                        |
| 63 | +        if (!empty($indexes = $schema->getIndexes())){ | 
                                                        |
| 64 | 64 | $this->describeIndexes($database, $indexes);  | 
                                                        
| 65 | 65 | }  | 
                                                        
| 66 | 66 | |
| 67 | -        if (!empty($foreignKeys = $schema->getForeignKeys())) { | 
                                                        |
| 67 | +        if (!empty($foreignKeys = $schema->getForeignKeys())){ | 
                                                        |
| 68 | 68 | $this->describeForeignKeys($database, $foreignKeys);  | 
                                                        
| 69 | 69 | }  | 
                                                        
| 70 | 70 | |
@@ -84,10 +84,10 @@ discard block  | 
                                                    ||
| 84 | 84 | 'Default Value:'  | 
                                                        
| 85 | 85 | ]);  | 
                                                        
| 86 | 86 | |
| 87 | -        foreach ($schema->getColumns() as $column) { | 
                                                        |
| 87 | +        foreach ($schema->getColumns() as $column){ | 
                                                        |
| 88 | 88 | $name = $column->getName();  | 
                                                        
| 89 | 89 | |
| 90 | -            if (in_array($column->getName(), $schema->getPrimaryKeys())) { | 
                                                        |
| 90 | +            if (in_array($column->getName(), $schema->getPrimaryKeys())){ | 
                                                        |
| 91 | 91 |                  $name = "<fg=magenta>{$name}</fg=magenta>"; | 
                                                        
| 92 | 92 | }  | 
                                                        
| 93 | 93 | |
@@ -116,7 +116,7 @@ discard block  | 
                                                    ||
| 116 | 116 | );  | 
                                                        
| 117 | 117 | |
| 118 | 118 | $indexesTable = $this->table(['Name:', 'Type:', 'Columns:']);  | 
                                                        
| 119 | -        foreach ($indexes as $index) { | 
                                                        |
| 119 | +        foreach ($indexes as $index){ | 
                                                        |
| 120 | 120 | $indexesTable->addRow([  | 
                                                        
| 121 | 121 | $index->getName(),  | 
                                                        
| 122 | 122 | $index->isUnique() ? 'UNIQUE INDEX' : 'INDEX',  | 
                                                        
@@ -147,7 +147,7 @@ discard block  | 
                                                    ||
| 147 | 147 | 'On Update:'  | 
                                                        
| 148 | 148 | ]);  | 
                                                        
| 149 | 149 | |
| 150 | -        foreach ($foreignKeys as $reference) { | 
                                                        |
| 150 | +        foreach ($foreignKeys as $reference){ | 
                                                        |
| 151 | 151 | $foreignTable->addRow([  | 
                                                        
| 152 | 152 | $reference->getName(),  | 
                                                        
| 153 | 153 |                  join(', ', $reference->getColumns()), | 
                                                        
@@ -170,12 +170,12 @@ discard block  | 
                                                    ||
| 170 | 170 |      { | 
                                                        
| 171 | 171 | $defaultValue = $column->getDefaultValue();  | 
                                                        
| 172 | 172 | |
| 173 | -        if ($defaultValue instanceof FragmentInterface) { | 
                                                        |
| 173 | +        if ($defaultValue instanceof FragmentInterface){ | 
                                                        |
| 174 | 174 | $value = $defaultValue->compile(new QueryBindings(), $driver->getCompiler());  | 
                                                        
| 175 | 175 |              return "<info>{$value}</info>"; | 
                                                        
| 176 | 176 | }  | 
                                                        
| 177 | 177 | |
| 178 | -        if ($defaultValue instanceof \DateTimeInterface) { | 
                                                        |
| 178 | +        if ($defaultValue instanceof \DateTimeInterface){ | 
                                                        |
| 179 | 179 |              $defaultValue = $defaultValue->format('c'); | 
                                                        
| 180 | 180 | }  | 
                                                        
| 181 | 181 | |
@@ -192,11 +192,11 @@ discard block  | 
                                                    ||
| 192 | 192 | |
| 193 | 193 | $abstractType = $column->getAbstractType();  | 
                                                        
| 194 | 194 | |
| 195 | -        if ($column->getSize()) { | 
                                                        |
| 195 | +        if ($column->getSize()){ | 
                                                        |
| 196 | 196 |              $type .= " ({$column->getSize()})"; | 
                                                        
| 197 | 197 | }  | 
                                                        
| 198 | 198 | |
| 199 | -        if ($abstractType == 'decimal') { | 
                                                        |
| 199 | +        if ($abstractType == 'decimal'){ | 
                                                        |
| 200 | 200 |              $type .= " ({$column->getPrecision()}, {$column->getScale()})"; | 
                                                        
| 201 | 201 | }  | 
                                                        
| 202 | 202 | |
@@ -211,7 +211,7 @@ discard block  | 
                                                    ||
| 211 | 211 |      { | 
                                                        
| 212 | 212 | $abstractType = $column->getAbstractType();  | 
                                                        
| 213 | 213 | |
| 214 | -        if (in_array($abstractType, ['primary', 'bigPrimary'])) { | 
                                                        |
| 214 | +        if (in_array($abstractType, ['primary', 'bigPrimary'])){ | 
                                                        |
| 215 | 215 |              $abstractType = "<fg=magenta>{$abstractType}</fg=magenta>"; | 
                                                        
| 216 | 216 | }  | 
                                                        
| 217 | 217 | |
@@ -46,7 +46,8 @@ discard block  | 
                                                    ||
| 46 | 46 |          $database = $dbal->database($this->option('database')); | 
                                                        
| 47 | 47 |          $schema = $database->table($this->argument('table'))->getSchema(); | 
                                                        
| 48 | 48 | |
| 49 | -        if (!$schema->exists()) { | 
                                                        |
| 49 | + if (!$schema->exists())  | 
                                                        |
| 50 | +        { | 
                                                        |
| 50 | 51 | throw new DBALException(  | 
                                                        
| 51 | 52 |                  "Table {$database->getName()}.{$this->argument('table')} does not exists." | 
                                                        
| 52 | 53 | );  | 
                                                        
@@ -60,11 +61,13 @@ discard block  | 
                                                    ||
| 60 | 61 | |
| 61 | 62 | $this->describeColumns($schema);  | 
                                                        
| 62 | 63 | |
| 63 | -        if (!empty($indexes = $schema->getIndexes())) { | 
                                                        |
| 64 | + if (!empty($indexes = $schema->getIndexes()))  | 
                                                        |
| 65 | +        { | 
                                                        |
| 64 | 66 | $this->describeIndexes($database, $indexes);  | 
                                                        
| 65 | 67 | }  | 
                                                        
| 66 | 68 | |
| 67 | -        if (!empty($foreignKeys = $schema->getForeignKeys())) { | 
                                                        |
| 69 | + if (!empty($foreignKeys = $schema->getForeignKeys()))  | 
                                                        |
| 70 | +        { | 
                                                        |
| 68 | 71 | $this->describeForeignKeys($database, $foreignKeys);  | 
                                                        
| 69 | 72 | }  | 
                                                        
| 70 | 73 | |
@@ -84,10 +87,12 @@ discard block  | 
                                                    ||
| 84 | 87 | 'Default Value:'  | 
                                                        
| 85 | 88 | ]);  | 
                                                        
| 86 | 89 | |
| 87 | -        foreach ($schema->getColumns() as $column) { | 
                                                        |
| 90 | + foreach ($schema->getColumns() as $column)  | 
                                                        |
| 91 | +        { | 
                                                        |
| 88 | 92 | $name = $column->getName();  | 
                                                        
| 89 | 93 | |
| 90 | -            if (in_array($column->getName(), $schema->getPrimaryKeys())) { | 
                                                        |
| 94 | + if (in_array($column->getName(), $schema->getPrimaryKeys()))  | 
                                                        |
| 95 | +            { | 
                                                        |
| 91 | 96 |                  $name = "<fg=magenta>{$name}</fg=magenta>"; | 
                                                        
| 92 | 97 | }  | 
                                                        
| 93 | 98 | |
@@ -116,7 +121,8 @@ discard block  | 
                                                    ||
| 116 | 121 | );  | 
                                                        
| 117 | 122 | |
| 118 | 123 | $indexesTable = $this->table(['Name:', 'Type:', 'Columns:']);  | 
                                                        
| 119 | -        foreach ($indexes as $index) { | 
                                                        |
| 124 | + foreach ($indexes as $index)  | 
                                                        |
| 125 | +        { | 
                                                        |
| 120 | 126 | $indexesTable->addRow([  | 
                                                        
| 121 | 127 | $index->getName(),  | 
                                                        
| 122 | 128 | $index->isUnique() ? 'UNIQUE INDEX' : 'INDEX',  | 
                                                        
@@ -147,7 +153,8 @@ discard block  | 
                                                    ||
| 147 | 153 | 'On Update:'  | 
                                                        
| 148 | 154 | ]);  | 
                                                        
| 149 | 155 | |
| 150 | -        foreach ($foreignKeys as $reference) { | 
                                                        |
| 156 | + foreach ($foreignKeys as $reference)  | 
                                                        |
| 157 | +        { | 
                                                        |
| 151 | 158 | $foreignTable->addRow([  | 
                                                        
| 152 | 159 | $reference->getName(),  | 
                                                        
| 153 | 160 |                  join(', ', $reference->getColumns()), | 
                                                        
@@ -170,12 +177,14 @@ discard block  | 
                                                    ||
| 170 | 177 |      { | 
                                                        
| 171 | 178 | $defaultValue = $column->getDefaultValue();  | 
                                                        
| 172 | 179 | |
| 173 | -        if ($defaultValue instanceof FragmentInterface) { | 
                                                        |
| 180 | + if ($defaultValue instanceof FragmentInterface)  | 
                                                        |
| 181 | +        { | 
                                                        |
| 174 | 182 | $value = $defaultValue->compile(new QueryBindings(), $driver->getCompiler());  | 
                                                        
| 175 | 183 |              return "<info>{$value}</info>"; | 
                                                        
| 176 | 184 | }  | 
                                                        
| 177 | 185 | |
| 178 | -        if ($defaultValue instanceof \DateTimeInterface) { | 
                                                        |
| 186 | + if ($defaultValue instanceof \DateTimeInterface)  | 
                                                        |
| 187 | +        { | 
                                                        |
| 179 | 188 |              $defaultValue = $defaultValue->format('c'); | 
                                                        
| 180 | 189 | }  | 
                                                        
| 181 | 190 | |
@@ -192,11 +201,13 @@ discard block  | 
                                                    ||
| 192 | 201 | |
| 193 | 202 | $abstractType = $column->getAbstractType();  | 
                                                        
| 194 | 203 | |
| 195 | -        if ($column->getSize()) { | 
                                                        |
| 204 | + if ($column->getSize())  | 
                                                        |
| 205 | +        { | 
                                                        |
| 196 | 206 |              $type .= " ({$column->getSize()})"; | 
                                                        
| 197 | 207 | }  | 
                                                        
| 198 | 208 | |
| 199 | -        if ($abstractType == 'decimal') { | 
                                                        |
| 209 | + if ($abstractType == 'decimal')  | 
                                                        |
| 210 | +        { | 
                                                        |
| 200 | 211 |              $type .= " ({$column->getPrecision()}, {$column->getScale()})"; | 
                                                        
| 201 | 212 | }  | 
                                                        
| 202 | 213 | |
@@ -211,7 +222,8 @@ discard block  | 
                                                    ||
| 211 | 222 |      { | 
                                                        
| 212 | 223 | $abstractType = $column->getAbstractType();  | 
                                                        
| 213 | 224 | |
| 214 | -        if (in_array($abstractType, ['primary', 'bigPrimary'])) { | 
                                                        |
| 225 | + if (in_array($abstractType, ['primary', 'bigPrimary']))  | 
                                                        |
| 226 | +        { | 
                                                        |
| 215 | 227 |              $abstractType = "<fg=magenta>{$abstractType}</fg=magenta>"; | 
                                                        
| 216 | 228 | }  | 
                                                        
| 217 | 229 | |
@@ -68,7 +68,7 @@  | 
                                                    ||
| 68 | 68 | protected function fetchCookies(array $header)  | 
                                                        
| 69 | 69 |      { | 
                                                        
| 70 | 70 | $result = [];  | 
                                                        
| 71 | -        foreach ($header as $line) { | 
                                                        |
| 71 | +        foreach ($header as $line){ | 
                                                        |
| 72 | 72 |              $cookie = explode('=', $line); | 
                                                        
| 73 | 73 | $result[$cookie[0]] = rawurldecode(substr($cookie[1], 0, strpos($cookie[1], ';')));  | 
                                                        
| 74 | 74 | }  | 
                                                        
@@ -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,7 @@  | 
                                                    ||
| 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 | $this->assertContains($extension, $output);  | 
                                                        
| 21 | 21 | }  | 
                                                        
| 22 | 22 | }  | 
                                                        
@@ -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,12 @@  | 
                                                    ||
| 31 | 31 | |
| 32 | 32 | $fs = new Files();  | 
                                                        
| 33 | 33 | |
| 34 | -        if ($fs->isDirectory(__DIR__ . '/../app/migrations')) { | 
                                                        |
| 35 | - $fs->deleteDirectory(__DIR__ . '/../app/migrations');  | 
                                                        |
| 34 | +        if ($fs->isDirectory(__DIR__.'/../app/migrations')){ | 
                                                        |
| 35 | + $fs->deleteDirectory(__DIR__.'/../app/migrations');  | 
                                                        |
| 36 | 36 | }  | 
                                                        
| 37 | 37 | |
| 38 | 38 |          $runtime = $this->app->get(DirectoriesInterface::class)->get('runtime'); | 
                                                        
| 39 | -        if ($fs->isDirectory($runtime)) { | 
                                                        |
| 39 | +        if ($fs->isDirectory($runtime)){ | 
                                                        |
| 40 | 40 | $fs->deleteDirectory($runtime);  | 
                                                        
| 41 | 41 | }  | 
                                                        
| 42 | 42 | }  | 
                                                        
@@ -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 | }  | 
                                                        
@@ -36,7 +36,7 @@  | 
                                                    ||
| 36 | 36 | */  | 
                                                        
| 37 | 37 | $dirs = $this->app->get(DirectoriesInterface::class);  | 
                                                        
| 38 | 38 | $fs = $this->app->get(FilesInterface::class);  | 
                                                        
| 39 | -        $fs->write($dirs->get('cache') . '/views/test.php', 'test', null, true); | 
                                                        |
| 39 | +        $fs->write($dirs->get('cache').'/views/test.php', 'test', null, true); | 
                                                        |
| 40 | 40 | |
| 41 | 41 |          $out = $this->runCommandDebug('views:reset'); | 
                                                        
| 42 | 42 |          $this->assertContains('test.php', $out); | 
                                                        
@@ -103,7 +103,7 @@  | 
                                                    ||
| 103 | 103 | ]  | 
                                                        
| 104 | 104 | ]);  | 
                                                        
| 105 | 105 | |
| 106 | -        $tokenizer->addDirectory(directory('vendor') . 'spiral/validation/src/'); | 
                                                        |
| 106 | +        $tokenizer->addDirectory(directory('vendor').'spiral/validation/src/'); | 
                                                        |
| 107 | 107 | }  | 
                                                        
| 108 | 108 | |
| 109 | 109 | /**  | 
                                                        
@@ -133,7 +133,8 @@  | 
                                                    ||
| 133 | 133 | string $footer,  | 
                                                        
| 134 | 134 | array $options  | 
                                                        
| 135 | 135 |      ): Append { | 
                                                        
| 136 | -        if (is_array($sequence) || $sequence instanceof \Closure) { | 
                                                        |
| 136 | + if (is_array($sequence) || $sequence instanceof \Closure)  | 
                                                        |
| 137 | +        { | 
                                                        |
| 137 | 138 | return new Append(  | 
                                                        
| 138 | 139 | $target,  | 
                                                        
| 139 | 140 | null,  | 
                                                        
@@ -128,7 +128,7 @@  | 
                                                    ||
| 128 | 128 | string $footer,  | 
                                                        
| 129 | 129 | array $options  | 
                                                        
| 130 | 130 |      ): Append { | 
                                                        
| 131 | -        if (is_array($sequence) || $sequence instanceof \Closure) { | 
                                                        |
| 131 | +        if (is_array($sequence) || $sequence instanceof \Closure){ | 
                                                        |
| 132 | 132 | return new Append(  | 
                                                        
| 133 | 133 | $target,  | 
                                                        
| 134 | 134 | null,  | 
                                                        
@@ -46,7 +46,8 @@  | 
                                                    ||
| 46 | 46 | //We are not forcing locale for now  | 
                                                        
| 47 | 47 | return $source->withCode(preg_replace_callback(  | 
                                                        
| 48 | 48 | self::REGEXP,  | 
                                                        
| 49 | -            function ($matches) use ($domain, $context) { | 
                                                        |
| 49 | + function ($matches) use ($domain, $context)  | 
                                                        |
| 50 | +            { | 
                                                        |
| 50 | 51 | return $this->translator->trans(  | 
                                                        
| 51 | 52 | $matches[1],  | 
                                                        
| 52 | 53 | [],  | 
                                                        
@@ -39,10 +39,13 @@  | 
                                                    ||
| 39 | 39 | |
| 40 | 40 | $user = file_get_contents(__DIR__ . '/../../app/src/User/User.php');  | 
                                                        
| 41 | 41 | unlink(__DIR__ . '/../../app/src/User/User.php');  | 
                                                        
| 42 | -        try { | 
                                                        |
| 42 | + try  | 
                                                        |
| 43 | +        { | 
                                                        |
| 43 | 44 |              $output = $this->runCommandDebug('cycle:migrate', ['-r' => true]); | 
                                                        
| 44 | 45 |              $this->assertContains('drop foreign key', $output); | 
                                                        
| 45 | -        } finally { | 
                                                        |
| 46 | + }  | 
                                                        |
| 47 | + finally  | 
                                                        |
| 48 | +        { | 
                                                        |
| 46 | 49 | file_put_contents(__DIR__ . '/../../app/src/User/User.php', $user);  | 
                                                        
| 47 | 50 | }  | 
                                                        
| 48 | 51 | }  | 
                                                        
@@ -50,13 +50,13 @@  | 
                                                    ||
| 50 | 50 |          $output = $this->runCommandDebug('cycle:migrate', ['-r' => true]); | 
                                                        
| 51 | 51 |          $this->assertContains('default.users', $output); | 
                                                        
| 52 | 52 | |
| 53 | - $user = file_get_contents(__DIR__ . '/../../app/src/User/User.php');  | 
                                                        |
| 54 | - unlink(__DIR__ . '/../../app/src/User/User.php');  | 
                                                        |
| 55 | -        try { | 
                                                        |
| 53 | + $user = file_get_contents(__DIR__.'/../../app/src/User/User.php');  | 
                                                        |
| 54 | + unlink(__DIR__.'/../../app/src/User/User.php');  | 
                                                        |
| 55 | +        try{ | 
                                                        |
| 56 | 56 |              $output = $this->runCommandDebug('cycle:migrate', ['-r' => true]); | 
                                                        
| 57 | 57 |              $this->assertContains('drop foreign key', $output); | 
                                                        
| 58 | -        } finally { | 
                                                        |
| 59 | - file_put_contents(__DIR__ . '/../../app/src/User/User.php', $user);  | 
                                                        |
| 58 | +        }finally{ | 
                                                        |
| 59 | + file_put_contents(__DIR__.'/../../app/src/User/User.php', $user);  | 
                                                        |
| 60 | 60 | }  | 
                                                        
| 61 | 61 | }  | 
                                                        
| 62 | 62 | }  |