@@ -74,7 +74,7 @@ |
||
74 | 74 | } |
75 | 75 | |
76 | 76 | //Show normal version number |
77 | - return $this->configuration->getDateTime($version) . ' (<comment>' . $version . '</comment>)'; |
|
77 | + return $this->configuration->getDateTime($version).' (<comment>'.$version.'</comment>)'; |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Doctrine\DBAL\Migrations; |
6 | 6 |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -declare(strict_types=1); |
|
3 | +declare(strict_types = 1); |
|
4 | 4 | |
5 | 5 | namespace Doctrine\DBAL\Migrations; |
6 | 6 |
@@ -61,10 +61,10 @@ discard block |
||
61 | 61 | { |
62 | 62 | $name = $configuration->getName(); |
63 | 63 | $name = $name ? $name : 'Doctrine Database Migrations'; |
64 | - $name = str_repeat(' ', 20) . $name . str_repeat(' ', 20); |
|
65 | - $output->writeln('<question>' . str_repeat(' ', strlen($name)) . '</question>'); |
|
66 | - $output->writeln('<question>' . $name . '</question>'); |
|
67 | - $output->writeln('<question>' . str_repeat(' ', strlen($name)) . '</question>'); |
|
64 | + $name = str_repeat(' ', 20).$name.str_repeat(' ', 20); |
|
65 | + $output->writeln('<question>'.str_repeat(' ', strlen($name)).'</question>'); |
|
66 | + $output->writeln('<question>'.$name.'</question>'); |
|
67 | + $output->writeln('<question>'.str_repeat(' ', strlen($name)).'</question>'); |
|
68 | 68 | $output->writeln(''); |
69 | 69 | } |
70 | 70 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | */ |
88 | 88 | protected function getMigrationConfiguration(InputInterface $input, OutputInterface $output) |
89 | 89 | { |
90 | - if ( ! $this->migrationConfiguration) { |
|
90 | + if (!$this->migrationConfiguration) { |
|
91 | 91 | if ($this->getHelperSet()->has('configuration') |
92 | 92 | && $this->getHelperSet()->get('configuration') instanceof ConfigurationHelperInterface) { |
93 | 93 | $configHelper = $this->getHelperSet()->get('configuration'); |
@@ -118,8 +118,8 @@ discard block |
||
118 | 118 | */ |
119 | 119 | private function getOutputWriter(OutputInterface $output) |
120 | 120 | { |
121 | - if ( ! $this->outputWriter) { |
|
122 | - $this->outputWriter = new OutputWriter(function ($message) use ($output) { |
|
121 | + if (!$this->outputWriter) { |
|
122 | + $this->outputWriter = new OutputWriter(function($message) use ($output) { |
|
123 | 123 | return $output->writeln($message); |
124 | 124 | }); |
125 | 125 | } |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | new ConnectionConfigurationLoader($this->configuration), |
148 | 148 | ] |
149 | 149 | ); |
150 | - $connection = $chainLoader->chosen(); |
|
150 | + $connection = $chainLoader->chosen(); |
|
151 | 151 | |
152 | 152 | if ($connection) { |
153 | 153 | return $this->connection = $connection; |
@@ -100,8 +100,8 @@ discard block |
||
100 | 100 | $replacements = [ |
101 | 101 | $configuration->getMigrationsNamespace(), |
102 | 102 | $version, |
103 | - $up ? " " . implode("\n ", explode("\n", $up)) : null, |
|
104 | - $down ? " " . implode("\n ", explode("\n", $down)) : null, |
|
103 | + $up ? " ".implode("\n ", explode("\n", $up)) : null, |
|
104 | + $down ? " ".implode("\n ", explode("\n", $down)) : null, |
|
105 | 105 | ]; |
106 | 106 | |
107 | 107 | $code = str_replace($placeHolders, $replacements, $this->getTemplate()); |
@@ -109,12 +109,12 @@ discard block |
||
109 | 109 | |
110 | 110 | $directoryHelper = new MigrationDirectoryHelper($configuration); |
111 | 111 | $dir = $directoryHelper->getMigrationDirectory(); |
112 | - $path = $dir . '/Version' . $version . '.php'; |
|
112 | + $path = $dir.'/Version'.$version.'.php'; |
|
113 | 113 | |
114 | 114 | file_put_contents($path, $code); |
115 | 115 | |
116 | 116 | if ($editorCmd = $input->getOption('editor-cmd')) { |
117 | - proc_open($editorCmd . ' ' . escapeshellarg($path), [], $pipes); |
|
117 | + proc_open($editorCmd.' '.escapeshellarg($path), [], $pipes); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | return $path; |
@@ -128,16 +128,16 @@ discard block |
||
128 | 128 | return; |
129 | 129 | } |
130 | 130 | |
131 | - if ( ! is_file($customTemplate) || ! is_readable($customTemplate)) { |
|
131 | + if (!is_file($customTemplate) || !is_readable($customTemplate)) { |
|
132 | 132 | throw new \InvalidArgumentException( |
133 | - 'The specified template "' . $customTemplate . '" cannot be found or is not readable.' |
|
133 | + 'The specified template "'.$customTemplate.'" cannot be found or is not readable.' |
|
134 | 134 | ); |
135 | 135 | } |
136 | 136 | |
137 | 137 | $content = file_get_contents($customTemplate); |
138 | 138 | |
139 | 139 | if ($content === false) { |
140 | - throw new \InvalidArgumentException('The specified template "' . $customTemplate . '" could not be read.'); |
|
140 | + throw new \InvalidArgumentException('The specified template "'.$customTemplate.'" could not be read.'); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | $output->writeln(sprintf('Using custom migration template "<info>%s</info>"', $customTemplate)); |
@@ -170,14 +170,14 @@ discard block |
||
170 | 170 | if (is_array($sql)) { |
171 | 171 | foreach ($sql as $key => $query) { |
172 | 172 | $this->sql[] = $query; |
173 | - if ( ! empty($params[$key])) { |
|
173 | + if (!empty($params[$key])) { |
|
174 | 174 | $queryTypes = $types[$key] ?? []; |
175 | 175 | $this->addQueryParams($params[$key], $queryTypes); |
176 | 176 | } |
177 | 177 | } |
178 | 178 | } else { |
179 | 179 | $this->sql[] = $sql; |
180 | - if ( ! empty($params)) { |
|
180 | + if (!empty($params)) { |
|
181 | 181 | $this->addQueryParams($params, $types); |
182 | 182 | } |
183 | 183 | } |
@@ -207,11 +207,11 @@ discard block |
||
207 | 207 | { |
208 | 208 | $queries = $this->execute($direction, true); |
209 | 209 | |
210 | - if ( ! empty($this->params)) { |
|
210 | + if (!empty($this->params)) { |
|
211 | 211 | throw MigrationException::migrationNotConvertibleToSql($this->class); |
212 | 212 | } |
213 | 213 | |
214 | - $this->outputWriter->write("\n-- Version " . $this->version . "\n"); |
|
214 | + $this->outputWriter->write("\n-- Version ".$this->version."\n"); |
|
215 | 215 | |
216 | 216 | $sqlQueries = [$this->version => $queries]; |
217 | 217 | |
@@ -264,12 +264,12 @@ discard block |
||
264 | 264 | $this->state = self::STATE_PRE; |
265 | 265 | $fromSchema = $this->schemaProvider->createFromSchema(); |
266 | 266 | |
267 | - $this->migration->{'pre' . ucfirst($direction)}($fromSchema); |
|
267 | + $this->migration->{'pre'.ucfirst($direction)}($fromSchema); |
|
268 | 268 | |
269 | 269 | if ($direction === self::DIRECTION_UP) { |
270 | - $this->outputWriter->write("\n" . sprintf(' <info>++</info> migrating <comment>%s</comment>', $this->version) . "\n"); |
|
270 | + $this->outputWriter->write("\n".sprintf(' <info>++</info> migrating <comment>%s</comment>', $this->version)."\n"); |
|
271 | 271 | } else { |
272 | - $this->outputWriter->write("\n" . sprintf(' <info>--</info> reverting <comment>%s</comment>', $this->version) . "\n"); |
|
272 | + $this->outputWriter->write("\n".sprintf(' <info>--</info> reverting <comment>%s</comment>', $this->version)."\n"); |
|
273 | 273 | } |
274 | 274 | |
275 | 275 | $this->state = self::STATE_EXEC; |
@@ -282,9 +282,9 @@ discard block |
||
282 | 282 | $this->executeRegisteredSql($dryRun, $timeAllQueries); |
283 | 283 | |
284 | 284 | $this->state = self::STATE_POST; |
285 | - $this->migration->{'post' . ucfirst($direction)}($toSchema); |
|
285 | + $this->migration->{'post'.ucfirst($direction)}($toSchema); |
|
286 | 286 | |
287 | - if ( ! $dryRun) { |
|
287 | + if (!$dryRun) { |
|
288 | 288 | if ($direction === self::DIRECTION_UP) { |
289 | 289 | $this->markMigrated(); |
290 | 290 | } else { |
@@ -392,13 +392,13 @@ discard block |
||
392 | 392 | |
393 | 393 | private function executeRegisteredSql($dryRun = false, $timeAllQueries = false) |
394 | 394 | { |
395 | - if ( ! $dryRun) { |
|
396 | - if ( ! empty($this->sql)) { |
|
395 | + if (!$dryRun) { |
|
396 | + if (!empty($this->sql)) { |
|
397 | 397 | foreach ($this->sql as $key => $query) { |
398 | 398 | $queryStart = microtime(true); |
399 | 399 | |
400 | - if ( ! isset($this->params[$key])) { |
|
401 | - $this->outputWriter->write(' <comment>-></comment> ' . $query); |
|
400 | + if (!isset($this->params[$key])) { |
|
401 | + $this->outputWriter->write(' <comment>-></comment> '.$query); |
|
402 | 402 | $this->connection->executeQuery($query); |
403 | 403 | } else { |
404 | 404 | $this->outputWriter->write(sprintf(' <comment>-</comment> %s (with parameters)', $query)); |