@@ -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 | |
@@ -60,7 +60,7 @@ |
||
| 60 | 60 | * instead of any other one. |
| 61 | 61 | */ |
| 62 | 62 | if ($input->getOption('configuration')) { |
| 63 | - $outputWriter->write("Loading configuration from command option: " . $input->getOption('configuration')); |
|
| 63 | + $outputWriter->write("Loading configuration from command option: ".$input->getOption('configuration')); |
|
| 64 | 64 | |
| 65 | 65 | return $this->loadConfig($input->getOption('configuration'), $outputWriter); |
| 66 | 66 | } |
@@ -75,7 +75,7 @@ |
||
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | //Show normal version number |
| 78 | - return $this->configuration->getDateTime($version) . ' (<comment>' . $version . '</comment>)'; |
|
| 78 | + return $this->configuration->getDateTime($version).' (<comment>'.$version.'</comment>)'; |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | /** @var Version[] */ |
@@ -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 | } |
@@ -177,7 +177,7 @@ |
||
| 177 | 177 | * @param string $versionAlias |
| 178 | 178 | * @param OutputInterface $output |
| 179 | 179 | * @param Configuration $configuration |
| 180 | - * @return bool|string |
|
| 180 | + * @return false|string |
|
| 181 | 181 | */ |
| 182 | 182 | private function getVersionNameFromAlias($versionAlias, OutputInterface $output, Configuration $configuration) |
| 183 | 183 | { |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | $executedUnavailableMigrations = array_diff($executedMigrations, $availableMigrations); |
| 107 | - if ( ! empty($executedUnavailableMigrations)) { |
|
| 107 | + if (!empty($executedUnavailableMigrations)) { |
|
| 108 | 108 | $output->writeln(sprintf( |
| 109 | 109 | '<error>WARNING! You have %s previously executed migrations' |
| 110 | 110 | . ' in the database that are not registered migrations.</error>', |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | $question = 'Are you sure you wish to continue? (y/n)'; |
| 123 | - if ( ! $this->canExecute($question, $input, $output)) { |
|
| 123 | + if (!$this->canExecute($question, $input, $output)) { |
|
| 124 | 124 | $output->writeln('<error>Migration cancelled!</error>'); |
| 125 | 125 | |
| 126 | 126 | return 1; |
@@ -137,12 +137,12 @@ discard block |
||
| 137 | 137 | |
| 138 | 138 | $cancelled = false; |
| 139 | 139 | $migration->setNoMigrationException($input->getOption('allow-no-migration')); |
| 140 | - $result = $migration->migrate($version, $dryRun, $timeAllqueries, function () use ($input, $output, &$cancelled) { |
|
| 140 | + $result = $migration->migrate($version, $dryRun, $timeAllqueries, function() use ($input, $output, &$cancelled) { |
|
| 141 | 141 | $question = 'WARNING! You are about to execute a database migration' |
| 142 | 142 | . ' that could result in schema changes and data lost.' |
| 143 | 143 | . ' Are you sure you wish to continue? (y/n)'; |
| 144 | 144 | $canContinue = $this->canExecute($question, $input, $output); |
| 145 | - $cancelled = ! $canContinue; |
|
| 145 | + $cancelled = !$canContinue; |
|
| 146 | 146 | |
| 147 | 147 | return $canContinue; |
| 148 | 148 | }); |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | */ |
| 173 | 173 | private function canExecute($question, InputInterface $input, OutputInterface $output) |
| 174 | 174 | { |
| 175 | - if ($input->isInteractive() && ! $this->askConfirmation($question, $input, $output)) { |
|
| 175 | + if ($input->isInteractive() && !$this->askConfirmation($question, $input, $output)) { |
|
| 176 | 176 | return false; |
| 177 | 177 | } |
| 178 | 178 | |
@@ -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 | /** |
@@ -187,14 +187,14 @@ discard block |
||
| 187 | 187 | if (is_array($sql)) { |
| 188 | 188 | foreach ($sql as $key => $query) { |
| 189 | 189 | $this->sql[] = $query; |
| 190 | - if ( ! empty($params[$key])) { |
|
| 190 | + if (!empty($params[$key])) { |
|
| 191 | 191 | $queryTypes = isset($types[$key]) ? $types[$key] : []; |
| 192 | 192 | $this->addQueryParams($params[$key], $queryTypes); |
| 193 | 193 | } |
| 194 | 194 | } |
| 195 | 195 | } else { |
| 196 | 196 | $this->sql[] = $sql; |
| 197 | - if ( ! empty($params)) { |
|
| 197 | + if (!empty($params)) { |
|
| 198 | 198 | $this->addQueryParams($params, $types); |
| 199 | 199 | } |
| 200 | 200 | } |
@@ -223,11 +223,11 @@ discard block |
||
| 223 | 223 | { |
| 224 | 224 | $queries = $this->execute($direction, true); |
| 225 | 225 | |
| 226 | - if ( ! empty($this->params)) { |
|
| 226 | + if (!empty($this->params)) { |
|
| 227 | 227 | throw MigrationException::migrationNotConvertibleToSql($this->class); |
| 228 | 228 | } |
| 229 | 229 | |
| 230 | - $this->outputWriter->write("\n-- Version " . $this->version . "\n"); |
|
| 230 | + $this->outputWriter->write("\n-- Version ".$this->version."\n"); |
|
| 231 | 231 | |
| 232 | 232 | $sqlQueries = [$this->version => $queries]; |
| 233 | 233 | |
@@ -280,12 +280,12 @@ discard block |
||
| 280 | 280 | $this->state = self::STATE_PRE; |
| 281 | 281 | $fromSchema = $this->schemaProvider->createFromSchema(); |
| 282 | 282 | |
| 283 | - $this->migration->{'pre' . ucfirst($direction)}($fromSchema); |
|
| 283 | + $this->migration->{'pre'.ucfirst($direction)}($fromSchema); |
|
| 284 | 284 | |
| 285 | 285 | if ($direction === self::DIRECTION_UP) { |
| 286 | - $this->outputWriter->write("\n" . sprintf(' <info>++</info> migrating <comment>%s</comment>', $this->version) . "\n"); |
|
| 286 | + $this->outputWriter->write("\n".sprintf(' <info>++</info> migrating <comment>%s</comment>', $this->version)."\n"); |
|
| 287 | 287 | } else { |
| 288 | - $this->outputWriter->write("\n" . sprintf(' <info>--</info> reverting <comment>%s</comment>', $this->version) . "\n"); |
|
| 288 | + $this->outputWriter->write("\n".sprintf(' <info>--</info> reverting <comment>%s</comment>', $this->version)."\n"); |
|
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | $this->state = self::STATE_EXEC; |
@@ -298,9 +298,9 @@ discard block |
||
| 298 | 298 | $this->executeRegisteredSql($dryRun, $timeAllQueries); |
| 299 | 299 | |
| 300 | 300 | $this->state = self::STATE_POST; |
| 301 | - $this->migration->{'post' . ucfirst($direction)}($toSchema); |
|
| 301 | + $this->migration->{'post'.ucfirst($direction)}($toSchema); |
|
| 302 | 302 | |
| 303 | - if ( ! $dryRun) { |
|
| 303 | + if (!$dryRun) { |
|
| 304 | 304 | if ($direction === self::DIRECTION_UP) { |
| 305 | 305 | $this->markMigrated(); |
| 306 | 306 | } else { |
@@ -408,13 +408,13 @@ discard block |
||
| 408 | 408 | |
| 409 | 409 | private function executeRegisteredSql($dryRun = false, $timeAllQueries = false) |
| 410 | 410 | { |
| 411 | - if ( ! $dryRun) { |
|
| 412 | - if ( ! empty($this->sql)) { |
|
| 411 | + if (!$dryRun) { |
|
| 412 | + if (!empty($this->sql)) { |
|
| 413 | 413 | foreach ($this->sql as $key => $query) { |
| 414 | 414 | $queryStart = microtime(true); |
| 415 | 415 | |
| 416 | - if ( ! isset($this->params[$key])) { |
|
| 417 | - $this->outputWriter->write(' <comment>-></comment> ' . $query); |
|
| 416 | + if (!isset($this->params[$key])) { |
|
| 417 | + $this->outputWriter->write(' <comment>-></comment> '.$query); |
|
| 418 | 418 | $this->connection->executeQuery($query); |
| 419 | 419 | } else { |
| 420 | 420 | $this->outputWriter->write(sprintf(' <comment>-</comment> %s (with parameters)', $query)); |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | $string = $this->buildMigrationFile($queriesByVersion, $direction); |
| 79 | 79 | |
| 80 | 80 | if ($this->outputWriter) { |
| 81 | - $this->outputWriter->write("\n" . sprintf('Writing migration file to "<info>%s</info>"', $path)); |
|
| 81 | + $this->outputWriter->write("\n".sprintf('Writing migration file to "<info>%s</info>"', $path)); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | return file_put_contents($path, $string); |
@@ -89,10 +89,10 @@ discard block |
||
| 89 | 89 | $string = sprintf("-- Doctrine Migration File Generated on %s\n", date('Y-m-d H:i:s')); |
| 90 | 90 | |
| 91 | 91 | foreach ($queriesByVersion as $version => $queries) { |
| 92 | - $string .= "\n-- Version " . $version . "\n"; |
|
| 92 | + $string .= "\n-- Version ".$version."\n"; |
|
| 93 | 93 | |
| 94 | 94 | foreach ($queries as $query) { |
| 95 | - $string .= $query . ";\n"; |
|
| 95 | + $string .= $query.";\n"; |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | |
| 120 | 120 | if (is_dir($path)) { |
| 121 | 121 | $path = realpath($path); |
| 122 | - $path = $path . '/doctrine_migration_' . date('YmdHis') . '.sql'; |
|
| 122 | + $path = $path.'/doctrine_migration_'.date('YmdHis').'.sql'; |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | return $path; |
@@ -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 | /** |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | * migrations. |
| 141 | 141 | */ |
| 142 | 142 | $migrations = $this->configuration->getMigrations(); |
| 143 | - if ( ! isset($migrations[$to]) && $to > 0) { |
|
| 143 | + if (!isset($migrations[$to]) && $to > 0) { |
|
| 144 | 144 | throw MigrationException::unknownMigrationVersion($to); |
| 145 | 145 | } |
| 146 | 146 | |
@@ -155,11 +155,11 @@ discard block |
||
| 155 | 155 | * means we are already at the destination return an empty array() |
| 156 | 156 | * to signify that there is nothing left to do. |
| 157 | 157 | */ |
| 158 | - if ($from === $to && empty($migrationsToExecute) && ! empty($migrations)) { |
|
| 158 | + if ($from === $to && empty($migrationsToExecute) && !empty($migrations)) { |
|
| 159 | 159 | return $this->noMigrations(); |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | - if ( ! $dryRun && false === $this->migrationsCanExecute($confirm)) { |
|
| 162 | + if (!$dryRun && false === $this->migrationsCanExecute($confirm)) { |
|
| 163 | 163 | return []; |
| 164 | 164 | } |
| 165 | 165 | |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | /** |
| 171 | 171 | * If there are no migrations to execute throw an exception. |
| 172 | 172 | */ |
| 173 | - if (empty($migrationsToExecute) && ! $this->noMigrationException) { |
|
| 173 | + if (empty($migrationsToExecute) && !$this->noMigrationException) { |
|
| 174 | 174 | throw MigrationException::noMigrationsToExecute(); |
| 175 | 175 | } elseif (empty($migrationsToExecute)) { |
| 176 | 176 | return $this->noMigrations(); |