@@ -39,7 +39,7 @@ |
||
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
42 | - * @return Schema |
|
42 | + * @return \ProxyManager\Proxy\VirtualProxyInterface |
|
43 | 43 | */ |
44 | 44 | public function createFromSchema() |
45 | 45 | { |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | |
71 | 71 | return $this->proxyFactory->createProxy( |
72 | 72 | Schema::class, |
73 | - function (& $wrappedObject, $proxy, $method, array $parameters, & $initializer) use ($originalSchemaManipulator) { |
|
73 | + function(& $wrappedObject, $proxy, $method, array $parameters, & $initializer) use ($originalSchemaManipulator) { |
|
74 | 74 | $initializer = null; |
75 | 75 | $wrappedObject = $originalSchemaManipulator->createFromSchema(); |
76 | 76 | |
@@ -87,10 +87,10 @@ discard block |
||
87 | 87 | { |
88 | 88 | $originalSchemaManipulator = $this->originalSchemaManipulator; |
89 | 89 | |
90 | - if ($fromSchema instanceof LazyLoadingInterface && ! $fromSchema->isProxyInitialized()) { |
|
90 | + if ($fromSchema instanceof LazyLoadingInterface && !$fromSchema->isProxyInitialized()) { |
|
91 | 91 | return $this->proxyFactory->createProxy( |
92 | 92 | Schema::class, |
93 | - function (& $wrappedObject, $proxy, $method, array $parameters, & $initializer) use ($originalSchemaManipulator, $fromSchema) { |
|
93 | + function(& $wrappedObject, $proxy, $method, array $parameters, & $initializer) use ($originalSchemaManipulator, $fromSchema) { |
|
94 | 94 | $initializer = null; |
95 | 95 | $wrappedObject = $originalSchemaManipulator->createToSchema($fromSchema); |
96 | 96 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | public function getSqlDiffToMigrate(Schema $fromSchema, Schema $toSchema) |
112 | 112 | { |
113 | 113 | if ($toSchema instanceof LazyLoadingInterface |
114 | - && ! $toSchema->isProxyInitialized()) { |
|
114 | + && !$toSchema->isProxyInitialized()) { |
|
115 | 115 | return []; |
116 | 116 | } |
117 | 117 |
@@ -38,7 +38,7 @@ |
||
38 | 38 | { |
39 | 39 | $dir = $this->getRealPath($directory); |
40 | 40 | |
41 | - $files = glob(rtrim($dir, '/') . '/Version*.php'); |
|
41 | + $files = glob(rtrim($dir, '/').'/Version*.php'); |
|
42 | 42 | |
43 | 43 | return $this->loadMigrations($files, $namespace); |
44 | 44 | } |
@@ -42,6 +42,9 @@ |
||
42 | 42 | */ |
43 | 43 | private $outputWriter; |
44 | 44 | |
45 | + /** |
|
46 | + * @param OutputWriter $outputWriter |
|
47 | + */ |
|
45 | 48 | public function __construct(string $columnName, string $tableName, ?OutputWriter $outputWriter) |
46 | 49 | { |
47 | 50 | $this->columnName = $columnName; |
@@ -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 |
@@ -234,7 +234,7 @@ |
||
234 | 234 | * properly, so I had to violate LoD here (so please, let's find a way to solve it on v2). |
235 | 235 | */ |
236 | 236 | return $this->configuration->getQueryWriter() |
237 | - ->write($path, $direction, $sqlQueries); |
|
237 | + ->write($path, $direction, $sqlQueries); |
|
238 | 238 | } |
239 | 239 | |
240 | 240 | /** |
@@ -81,6 +81,10 @@ discard block |
||
81 | 81 | /** @var SchemaDiffProviderInterface */ |
82 | 82 | private $schemaProvider; |
83 | 83 | |
84 | + /** |
|
85 | + * @param string $version |
|
86 | + * @param string $class |
|
87 | + */ |
|
84 | 88 | public function __construct(Configuration $configuration, $version, $class, ?SchemaDiffProviderInterface $schemaProvider = null) |
85 | 89 | { |
86 | 90 | $this->configuration = $configuration; |
@@ -137,6 +141,9 @@ discard block |
||
137 | 141 | $this->markVersion('up'); |
138 | 142 | } |
139 | 143 | |
144 | + /** |
|
145 | + * @param string $direction |
|
146 | + */ |
|
140 | 147 | private function markVersion($direction) |
141 | 148 | { |
142 | 149 | $action = $direction === 'up' ? 'insert' : 'delete'; |
@@ -157,7 +164,7 @@ discard block |
||
157 | 164 | * Add some SQL queries to this versions migration |
158 | 165 | * |
159 | 166 | * @param string|string[] $sql |
160 | - * @param mixed[]|mixed[][] $params |
|
167 | + * @param string[] $params |
|
161 | 168 | * @param string[]|string[][] $types |
162 | 169 | */ |
163 | 170 | public function addSql($sql, array $params = [], array $types = []) |
@@ -360,6 +367,9 @@ discard block |
||
360 | 367 | } |
361 | 368 | } |
362 | 369 | |
370 | + /** |
|
371 | + * @param double $queryStart |
|
372 | + */ |
|
363 | 373 | private function outputQueryTime($queryStart, $timeAllQueries = false) |
364 | 374 | { |
365 | 375 | if ($timeAllQueries !== false) { |
@@ -464,6 +474,10 @@ discard block |
||
464 | 474 | return sprintf('with parameters (%s)', implode(', ', $out)); |
465 | 475 | } |
466 | 476 | |
477 | + /** |
|
478 | + * @param string $direction |
|
479 | + * @param boolean $dryRun |
|
480 | + */ |
|
467 | 481 | private function dispatchEvent($eventName, $direction, $dryRun) |
468 | 482 | { |
469 | 483 | $this->configuration->dispatchEvent($eventName, new MigrationsVersionEventArgs( |
@@ -165,14 +165,14 @@ discard block |
||
165 | 165 | if (is_array($sql)) { |
166 | 166 | foreach ($sql as $key => $query) { |
167 | 167 | $this->sql[] = $query; |
168 | - if (! empty($params[$key])) { |
|
168 | + if (!empty($params[$key])) { |
|
169 | 169 | $queryTypes = $types[$key] ?? []; |
170 | 170 | $this->addQueryParams($params[$key], $queryTypes); |
171 | 171 | } |
172 | 172 | } |
173 | 173 | } else { |
174 | 174 | $this->sql[] = $sql; |
175 | - if (! empty($params)) { |
|
175 | + if (!empty($params)) { |
|
176 | 176 | $this->addQueryParams($params, $types); |
177 | 177 | } |
178 | 178 | } |
@@ -202,11 +202,11 @@ discard block |
||
202 | 202 | { |
203 | 203 | $queries = $this->execute($direction, true); |
204 | 204 | |
205 | - if (! empty($this->params)) { |
|
205 | + if (!empty($this->params)) { |
|
206 | 206 | throw MigrationException::migrationNotConvertibleToSql($this->class); |
207 | 207 | } |
208 | 208 | |
209 | - $this->outputWriter->write("\n-- Version " . $this->version . "\n"); |
|
209 | + $this->outputWriter->write("\n-- Version ".$this->version."\n"); |
|
210 | 210 | |
211 | 211 | $sqlQueries = [$this->version => $queries]; |
212 | 212 | |
@@ -259,12 +259,12 @@ discard block |
||
259 | 259 | $this->state = self::STATE_PRE; |
260 | 260 | $fromSchema = $this->schemaProvider->createFromSchema(); |
261 | 261 | |
262 | - $this->migration->{'pre' . ucfirst($direction)}($fromSchema); |
|
262 | + $this->migration->{'pre'.ucfirst($direction)}($fromSchema); |
|
263 | 263 | |
264 | 264 | if ($direction === self::DIRECTION_UP) { |
265 | - $this->outputWriter->write("\n" . sprintf(' <info>++</info> migrating <comment>%s</comment>', $this->version) . "\n"); |
|
265 | + $this->outputWriter->write("\n".sprintf(' <info>++</info> migrating <comment>%s</comment>', $this->version)."\n"); |
|
266 | 266 | } else { |
267 | - $this->outputWriter->write("\n" . sprintf(' <info>--</info> reverting <comment>%s</comment>', $this->version) . "\n"); |
|
267 | + $this->outputWriter->write("\n".sprintf(' <info>--</info> reverting <comment>%s</comment>', $this->version)."\n"); |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | $this->state = self::STATE_EXEC; |
@@ -277,9 +277,9 @@ discard block |
||
277 | 277 | $this->executeRegisteredSql($dryRun, $timeAllQueries); |
278 | 278 | |
279 | 279 | $this->state = self::STATE_POST; |
280 | - $this->migration->{'post' . ucfirst($direction)}($toSchema); |
|
280 | + $this->migration->{'post'.ucfirst($direction)}($toSchema); |
|
281 | 281 | |
282 | - if (! $dryRun) { |
|
282 | + if (!$dryRun) { |
|
283 | 283 | if ($direction === self::DIRECTION_UP) { |
284 | 284 | $this->markMigrated(); |
285 | 285 | } else { |
@@ -387,13 +387,13 @@ discard block |
||
387 | 387 | |
388 | 388 | private function executeRegisteredSql($dryRun = false, $timeAllQueries = false) |
389 | 389 | { |
390 | - if (! $dryRun) { |
|
391 | - if (! empty($this->sql)) { |
|
390 | + if (!$dryRun) { |
|
391 | + if (!empty($this->sql)) { |
|
392 | 392 | foreach ($this->sql as $key => $query) { |
393 | 393 | $queryStart = microtime(true); |
394 | 394 | |
395 | - if (! isset($this->params[$key])) { |
|
396 | - $this->outputWriter->write(' <comment>-></comment> ' . $query); |
|
395 | + if (!isset($this->params[$key])) { |
|
396 | + $this->outputWriter->write(' <comment>-></comment> '.$query); |
|
397 | 397 | $this->connection->executeQuery($query); |
398 | 398 | } else { |
399 | 399 | $this->outputWriter->write(sprintf(' <comment>-</comment> %s (with parameters)', $query)); |
@@ -100,7 +100,7 @@ |
||
100 | 100 | * properly, so I had to violate LoD here (so please, let's find a way to solve it on v2). |
101 | 101 | */ |
102 | 102 | return $this->configuration->getQueryWriter() |
103 | - ->write($path, $direction, $sql); |
|
103 | + ->write($path, $direction, $sql); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | * migrations. |
119 | 119 | */ |
120 | 120 | $migrations = $this->configuration->getMigrations(); |
121 | - if (! isset($migrations[$to]) && $to > 0) { |
|
121 | + if (!isset($migrations[$to]) && $to > 0) { |
|
122 | 122 | throw MigrationException::unknownMigrationVersion($to); |
123 | 123 | } |
124 | 124 | |
@@ -133,11 +133,11 @@ discard block |
||
133 | 133 | * means we are already at the destination return an empty array() |
134 | 134 | * to signify that there is nothing left to do. |
135 | 135 | */ |
136 | - if ($from === $to && empty($migrationsToExecute) && ! empty($migrations)) { |
|
136 | + if ($from === $to && empty($migrationsToExecute) && !empty($migrations)) { |
|
137 | 137 | return $this->noMigrations(); |
138 | 138 | } |
139 | 139 | |
140 | - if (! $dryRun && $this->migrationsCanExecute($confirm) === false) { |
|
140 | + if (!$dryRun && $this->migrationsCanExecute($confirm) === false) { |
|
141 | 141 | return []; |
142 | 142 | } |
143 | 143 | |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | /** |
149 | 149 | * If there are no migrations to execute throw an exception. |
150 | 150 | */ |
151 | - if (empty($migrationsToExecute) && ! $this->noMigrationException) { |
|
151 | + if (empty($migrationsToExecute) && !$this->noMigrationException) { |
|
152 | 152 | throw MigrationException::noMigrationsToExecute(); |
153 | 153 | } elseif (empty($migrationsToExecute)) { |
154 | 154 | return $this->noMigrations(); |
@@ -42,6 +42,6 @@ |
||
42 | 42 | */ |
43 | 43 | private static function isACustomPharBuild($gitversion) |
44 | 44 | { |
45 | - return $gitversion !== '@' . 'git-version@'; |
|
45 | + return $gitversion !== '@'.'git-version@'; |
|
46 | 46 | } |
47 | 47 | } |
@@ -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 |
@@ -42,7 +42,7 @@ |
||
42 | 42 | |
43 | 43 | /** |
44 | 44 | * Transform the recursiveIterator result array of array into the expected array of migration file |
45 | - * @param iterable|string[][] $iteratorFilesMatch |
|
45 | + * @param \RegexIterator $iteratorFilesMatch |
|
46 | 46 | * @return string[] |
47 | 47 | */ |
48 | 48 | private function getMatches($iteratorFilesMatch) |