@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | EnvironmentInterface $env, |
45 | 45 | FinalizerInterface $finalizer, |
46 | 46 | ContainerInterface $container |
47 | - ) { |
|
47 | + ){ |
|
48 | 48 | $this->env = $env; |
49 | 49 | $this->finalizer = $finalizer; |
50 | 50 | $this->container = $container; |
@@ -73,11 +73,11 @@ discard block |
||
73 | 73 | /** @var Console $console */ |
74 | 74 | $console = $this->container->get(Console::class); |
75 | 75 | |
76 | - try { |
|
76 | + try{ |
|
77 | 77 | $console->start($input ?? new ArgvInput(), $output); |
78 | - } catch (\Throwable $e) { |
|
78 | + }catch (\Throwable $e){ |
|
79 | 79 | $this->handleException($e, $output); |
80 | - } finally { |
|
80 | + }finally{ |
|
81 | 81 | $listener->disable(); |
82 | 82 | $this->finalizer->finalize(false); |
83 | 83 | } |
@@ -89,9 +89,9 @@ discard block |
||
89 | 89 | */ |
90 | 90 | protected function handleException(\Throwable $e, OutputInterface $output) |
91 | 91 | { |
92 | - try { |
|
92 | + try{ |
|
93 | 93 | $this->container->get(SnapshotterInterface::class)->register($e); |
94 | - } catch (\Throwable|ContainerExceptionInterface $se) { |
|
94 | + }catch (\Throwable | ContainerExceptionInterface $se){ |
|
95 | 95 | // no need to notify when unable to register an exception |
96 | 96 | } |
97 | 97 | |
@@ -106,11 +106,11 @@ discard block |
||
106 | 106 | */ |
107 | 107 | private function mapVerbosity(OutputInterface $output): int |
108 | 108 | { |
109 | - if ($output->isDebug()) { |
|
109 | + if ($output->isDebug()){ |
|
110 | 110 | return ConsoleHandler::VERBOSITY_DEBUG; |
111 | 111 | } |
112 | 112 | |
113 | - if ($output->isVeryVerbose()) { |
|
113 | + if ($output->isVeryVerbose()){ |
|
114 | 114 | return ConsoleHandler::VERBOSITY_VERBOSE; |
115 | 115 | } |
116 | 116 |
@@ -40,11 +40,11 @@ discard block |
||
40 | 40 | $this->output->writeln("<info>Detecting schema changes:</info>"); |
41 | 41 | |
42 | 42 | $this->changes = []; |
43 | - foreach ($registry->getIterator() as $e) { |
|
44 | - if ($registry->hasTable($e)) { |
|
43 | + foreach ($registry->getIterator() as $e){ |
|
44 | + if ($registry->hasTable($e)){ |
|
45 | 45 | $table = $registry->getTableSchema($e); |
46 | 46 | |
47 | - if ($table->getComparator()->hasChanges()) { |
|
47 | + if ($table->getComparator()->hasChanges()){ |
|
48 | 48 | $this->changes[] = [ |
49 | 49 | 'database' => $registry->getDatabase($e), |
50 | 50 | 'table' => $registry->getTable($e), |
@@ -54,13 +54,13 @@ discard block |
||
54 | 54 | } |
55 | 55 | } |
56 | 56 | |
57 | - if ($this->changes === []) { |
|
57 | + if ($this->changes === []){ |
|
58 | 58 | $this->output->writeln("<fg=yellow>no database changes has been detected</fg=yellow>"); |
59 | 59 | |
60 | 60 | return $registry; |
61 | 61 | } |
62 | 62 | |
63 | - foreach ($this->changes as $change) { |
|
63 | + foreach ($this->changes as $change){ |
|
64 | 64 | $this->output->write(sprintf("• <fg=cyan>%s.%s</fg=cyan>", $change['database'], $change['table'])); |
65 | 65 | $this->describeChanges($change['schema']); |
66 | 66 | } |
@@ -73,22 +73,22 @@ discard block |
||
73 | 73 | */ |
74 | 74 | protected function describeChanges(AbstractTable $table) |
75 | 75 | { |
76 | - if (!$this->output->isVerbose()) { |
|
76 | + if (!$this->output->isVerbose()){ |
|
77 | 77 | $this->output->writeln(sprintf( |
78 | 78 | ": <fg=green>%s</fg=green> change(s) detected", |
79 | 79 | $this->numChanges($table) |
80 | 80 | )); |
81 | 81 | |
82 | 82 | return; |
83 | - } else { |
|
83 | + }else{ |
|
84 | 84 | $this->output->write("\n"); |
85 | 85 | } |
86 | 86 | |
87 | - if (!$table->exists()) { |
|
87 | + if (!$table->exists()){ |
|
88 | 88 | $this->output->writeln(" - create table"); |
89 | 89 | } |
90 | 90 | |
91 | - if ($table->getStatus() === AbstractTable::STATUS_DECLARED_DROPPED) { |
|
91 | + if ($table->getStatus() === AbstractTable::STATUS_DECLARED_DROPPED){ |
|
92 | 92 | $this->output->writeln(" - drop table"); |
93 | 93 | return; |
94 | 94 | } |
@@ -105,15 +105,15 @@ discard block |
||
105 | 105 | */ |
106 | 106 | protected function describeColumns(Comparator $cmp) |
107 | 107 | { |
108 | - foreach ($cmp->addedColumns() as $column) { |
|
108 | + foreach ($cmp->addedColumns() as $column){ |
|
109 | 109 | $this->output->writeln(" - add column <fg=yellow>{$column->getName()}</fg=yellow>"); |
110 | 110 | } |
111 | 111 | |
112 | - foreach ($cmp->droppedColumns() as $column) { |
|
112 | + foreach ($cmp->droppedColumns() as $column){ |
|
113 | 113 | $this->output->writeln(" - drop column <fg=yellow>{$column->getName()}</fg=yellow>"); |
114 | 114 | } |
115 | 115 | |
116 | - foreach ($cmp->alteredColumns() as $column) { |
|
116 | + foreach ($cmp->alteredColumns() as $column){ |
|
117 | 117 | $column = $column[0]; |
118 | 118 | $this->output->writeln(" - alter column <fg=yellow>{$column->getName()}</fg=yellow>"); |
119 | 119 | } |
@@ -124,17 +124,17 @@ discard block |
||
124 | 124 | */ |
125 | 125 | protected function describeIndexes(Comparator $cmp) |
126 | 126 | { |
127 | - foreach ($cmp->addedIndexes() as $index) { |
|
127 | + foreach ($cmp->addedIndexes() as $index){ |
|
128 | 128 | $index = join(', ', $index->getColumns()); |
129 | 129 | $this->output->writeln(" - add index on <fg=yellow>[{$index}]</fg=yellow>"); |
130 | 130 | } |
131 | 131 | |
132 | - foreach ($cmp->droppedIndexes() as $index) { |
|
132 | + foreach ($cmp->droppedIndexes() as $index){ |
|
133 | 133 | $index = join(', ', $index->getColumns()); |
134 | 134 | $this->output->writeln(" - drop index on <fg=yellow>[{$index}]</fg=yellow>"); |
135 | 135 | } |
136 | 136 | |
137 | - foreach ($cmp->alteredIndexes() as $index) { |
|
137 | + foreach ($cmp->alteredIndexes() as $index){ |
|
138 | 138 | $index = $index[0]; |
139 | 139 | $index = join(', ', $index->getColumns()); |
140 | 140 | $this->output->writeln(" - alter index on <fg=yellow>[{$index}]</fg=yellow>"); |
@@ -146,17 +146,17 @@ discard block |
||
146 | 146 | */ |
147 | 147 | protected function describeFKs(Comparator $cmp) |
148 | 148 | { |
149 | - foreach ($cmp->addedForeignKeys() as $fk) { |
|
149 | + foreach ($cmp->addedForeignKeys() as $fk){ |
|
150 | 150 | $fkColumns = join(', ', $fk->getColumns()); |
151 | 151 | $this->output->writeln(" - add foreign key on <fg=yellow>{$fkColumns}</fg=yellow>"); |
152 | 152 | } |
153 | 153 | |
154 | - foreach ($cmp->droppedForeignKeys() as $fk) { |
|
154 | + foreach ($cmp->droppedForeignKeys() as $fk){ |
|
155 | 155 | $fkColumns = join(', ', $fk->getColumns()); |
156 | 156 | $this->output->writeln(" - drop foreign key <fg=yellow>{$fkColumns}</fg=yellow>"); |
157 | 157 | } |
158 | 158 | |
159 | - foreach ($cmp->alteredForeignKeys() as $fk) { |
|
159 | + foreach ($cmp->alteredForeignKeys() as $fk){ |
|
160 | 160 | $fk = $fk[0]; |
161 | 161 | $fkColumns = join(', ', $fk->getColumns()); |
162 | 162 | $this->output->writeln(" - alter foreign key <fg=yellow>{$fkColumns}</fg=yellow>"); |