@@ -61,13 +61,13 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | protected function setConfiguration(array $config) |
| 63 | 63 | { |
| 64 | - foreach($config as $configurationKey => $configurationValue) { |
|
| 64 | + foreach ($config as $configurationKey => $configurationValue) { |
|
| 65 | 65 | if (!isset($this->configurationProperties[$configurationKey])) { |
| 66 | 66 | $msg = sprintf('Migrations configuration key "%s" does not exists.', $configurationKey); |
| 67 | 67 | throw MigrationException::configurationNotValid($msg); |
| 68 | 68 | } |
| 69 | 69 | } |
| 70 | - foreach($this->configurationProperties as $configurationKey => $configurationSetter) { |
|
| 70 | + foreach ($this->configurationProperties as $configurationKey => $configurationSetter) { |
|
| 71 | 71 | if (isset($config[$configurationKey])) { |
| 72 | 72 | $this->{$configurationSetter}($config[$configurationKey]); |
| 73 | 73 | } |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | } else if (strcasecmp($migrationOrganisation, static::VERSIONS_ORGANIZATION_BY_YEAR_AND_MONTH) == 0) { |
| 97 | 97 | $this->setMigrationsAreOrganizedByYearAndMonth(); |
| 98 | 98 | } else { |
| 99 | - $msg = 'Unknown ' . var_export($migrationOrganisation, true) . ' for configuration "organize_migrations".'; |
|
| 99 | + $msg = 'Unknown '.var_export($migrationOrganisation, true).' for configuration "organize_migrations".'; |
|
| 100 | 100 | throw MigrationException::configurationNotValid($msg); |
| 101 | 101 | } |
| 102 | 102 | } |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | if ($this->loaded) { |
| 114 | 114 | throw MigrationException::configurationFileAlreadyLoaded(); |
| 115 | 115 | } |
| 116 | - if (file_exists($path = getcwd() . '/' . $file)) { |
|
| 116 | + if (file_exists($path = getcwd().'/'.$file)) { |
|
| 117 | 117 | $file = $path; |
| 118 | 118 | } |
| 119 | 119 | $this->file = $file; |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | |
| 129 | 129 | protected function getDirectoryRelativeToFile($file, $input) |
| 130 | 130 | { |
| 131 | - $path = realpath(dirname($file) . '/' . $input); |
|
| 131 | + $path = realpath(dirname($file).'/'.$input); |
|
| 132 | 132 | |
| 133 | 133 | return ($path !== false) ? $path : $input; |
| 134 | 134 | } |
@@ -40,6 +40,6 @@ |
||
| 40 | 40 | * in a modified (not tagged) phar version. |
| 41 | 41 | */ |
| 42 | 42 | private static function isACustomPharBuild($gitversion) { |
| 43 | - return $gitversion !== '@' . 'git-version@'; |
|
| 43 | + return $gitversion !== '@'.'git-version@'; |
|
| 44 | 44 | } |
| 45 | 45 | } |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | $version = (string) substr($className, 7); |
| 63 | 63 | if ($version === '0') { |
| 64 | 64 | throw new \InvalidArgumentException(sprintf( |
| 65 | - 'Cannot load a migrations with the name "%s" because it is a reserved number by doctrine migraitons' . PHP_EOL . |
|
| 65 | + 'Cannot load a migrations with the name "%s" because it is a reserved number by doctrine migraitons'.PHP_EOL. |
|
| 66 | 66 | 'It\'s used to revert all migrations including the first one.', |
| 67 | 67 | $version |
| 68 | 68 | )); |
@@ -78,8 +78,8 @@ discard block |
||
| 78 | 78 | * |
| 79 | 79 | * @return callable |
| 80 | 80 | */ |
| 81 | - protected function getFileSortCallback(){ |
|
| 82 | - return function ($a, $b) { |
|
| 81 | + protected function getFileSortCallback() { |
|
| 82 | + return function($a, $b) { |
|
| 83 | 83 | return (basename($a) < basename($b)) ? -1 : 1; |
| 84 | 84 | }; |
| 85 | 85 | } |
@@ -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 | } |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | /** @var SchemaDiffProviderInterface */ |
| 103 | 103 | private $schemaProvider; |
| 104 | 104 | |
| 105 | - public function __construct(Configuration $configuration, $version, $class, SchemaDiffProviderInterface $schemaProvider=null) |
|
| 105 | + public function __construct(Configuration $configuration, $version, $class, SchemaDiffProviderInterface $schemaProvider = null) |
|
| 106 | 106 | { |
| 107 | 107 | $this->configuration = $configuration; |
| 108 | 108 | $this->outputWriter = $configuration->getOutputWriter(); |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | if ($schemaProvider !== null) { |
| 115 | 115 | $this->schemaProvider = $schemaProvider; |
| 116 | 116 | } |
| 117 | - if($schemaProvider === null) { |
|
| 117 | + if ($schemaProvider === null) { |
|
| 118 | 118 | $schemaProvider = new SchemaDiffProvider($this->connection->getSchemaManager(), |
| 119 | 119 | $this->connection->getDatabasePlatform()); |
| 120 | 120 | $this->schemaProvider = LazySchemaDiffProvider::fromDefaultProxyFacyoryConfiguration($schemaProvider); |
@@ -220,11 +220,11 @@ discard block |
||
| 220 | 220 | { |
| 221 | 221 | $queries = $this->execute($direction, true); |
| 222 | 222 | |
| 223 | - if ( ! empty($this->params)) { |
|
| 223 | + if (!empty($this->params)) { |
|
| 224 | 224 | throw MigrationException::migrationNotConvertibleToSql($this->class); |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | - $this->outputWriter->write("\n-- Version " . $this->version . "\n"); |
|
| 227 | + $this->outputWriter->write("\n-- Version ".$this->version."\n"); |
|
| 228 | 228 | |
| 229 | 229 | $sqlQueries = [$this->version => $queries]; |
| 230 | 230 | $sqlWriter = new SqlFileWriter( |
@@ -276,12 +276,12 @@ discard block |
||
| 276 | 276 | $this->state = self::STATE_PRE; |
| 277 | 277 | $fromSchema = $this->schemaProvider->createFromSchema(); |
| 278 | 278 | |
| 279 | - $this->migration->{'pre' . ucfirst($direction)}($fromSchema); |
|
| 279 | + $this->migration->{'pre'.ucfirst($direction)}($fromSchema); |
|
| 280 | 280 | |
| 281 | 281 | if ($direction === self::DIRECTION_UP) { |
| 282 | - $this->outputWriter->write("\n" . sprintf(' <info>++</info> migrating <comment>%s</comment>', $this->version) . "\n"); |
|
| 282 | + $this->outputWriter->write("\n".sprintf(' <info>++</info> migrating <comment>%s</comment>', $this->version)."\n"); |
|
| 283 | 283 | } else { |
| 284 | - $this->outputWriter->write("\n" . sprintf(' <info>--</info> reverting <comment>%s</comment>', $this->version) . "\n"); |
|
| 284 | + $this->outputWriter->write("\n".sprintf(' <info>--</info> reverting <comment>%s</comment>', $this->version)."\n"); |
|
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | $this->state = self::STATE_EXEC; |
@@ -294,9 +294,9 @@ discard block |
||
| 294 | 294 | $this->executeRegisteredSql($dryRun, $timeAllQueries); |
| 295 | 295 | |
| 296 | 296 | $this->state = self::STATE_POST; |
| 297 | - $this->migration->{'post' . ucfirst($direction)}($toSchema); |
|
| 297 | + $this->migration->{'post'.ucfirst($direction)}($toSchema); |
|
| 298 | 298 | |
| 299 | - if (! $dryRun) { |
|
| 299 | + if (!$dryRun) { |
|
| 300 | 300 | if ($direction === self::DIRECTION_UP) { |
| 301 | 301 | $this->markMigrated(); |
| 302 | 302 | } else { |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | } |
| 336 | 336 | } |
| 337 | 337 | |
| 338 | - $this->outputWriter->write(sprintf("\n <info>SS</info> skipped (Reason: %s)", $e->getMessage())); |
|
| 338 | + $this->outputWriter->write(sprintf("\n <info>SS</info> skipped (Reason: %s)", $e->getMessage())); |
|
| 339 | 339 | |
| 340 | 340 | $this->state = self::STATE_NONE; |
| 341 | 341 | |
@@ -398,13 +398,13 @@ discard block |
||
| 398 | 398 | |
| 399 | 399 | private function executeRegisteredSql($dryRun = false, $timeAllQueries = false) |
| 400 | 400 | { |
| 401 | - if (! $dryRun) { |
|
| 401 | + if (!$dryRun) { |
|
| 402 | 402 | if (!empty($this->sql)) { |
| 403 | 403 | foreach ($this->sql as $key => $query) { |
| 404 | 404 | $queryStart = microtime(true); |
| 405 | 405 | |
| 406 | - if ( ! isset($this->params[$key])) { |
|
| 407 | - $this->outputWriter->write(' <comment>-></comment> ' . $query); |
|
| 406 | + if (!isset($this->params[$key])) { |
|
| 407 | + $this->outputWriter->write(' <comment>-></comment> '.$query); |
|
| 408 | 408 | $this->connection->executeQuery($query); |
| 409 | 409 | } else { |
| 410 | 410 | $this->outputWriter->write(sprintf(' <comment>-</comment> %s (with parameters)', $query)); |
@@ -197,7 +197,7 @@ |
||
| 197 | 197 | return []; |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | - private function migrationsCanExecute(callable $confirm=null) |
|
| 200 | + private function migrationsCanExecute(callable $confirm = null) |
|
| 201 | 201 | { |
| 202 | 202 | return null === $confirm ? true : $confirm(); |
| 203 | 203 | } |
@@ -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 | { |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | $question = 'Are you sure you wish to continue? (y/n)'; |
| 117 | - if (! $this->canExecute($question, $input, $output)) { |
|
| 117 | + if (!$this->canExecute($question, $input, $output)) { |
|
| 118 | 118 | $output->writeln('<error>Migration cancelled!</error>'); |
| 119 | 119 | |
| 120 | 120 | return 1; |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | |
| 132 | 132 | $cancelled = false; |
| 133 | 133 | $migration->setNoMigrationException($input->getOption('allow-no-migration')); |
| 134 | - $result = $migration->migrate($version, $dryRun, $timeAllqueries, function () use ($input, $output, &$cancelled) { |
|
| 134 | + $result = $migration->migrate($version, $dryRun, $timeAllqueries, function() use ($input, $output, &$cancelled) { |
|
| 135 | 135 | $question = 'WARNING! You are about to execute a database migration' |
| 136 | 136 | . ' that could result in schema changes and data lost.' |
| 137 | 137 | . ' Are you sure you wish to continue? (y/n)'; |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | */ |
| 167 | 167 | private function canExecute($question, InputInterface $input, OutputInterface $output) |
| 168 | 168 | { |
| 169 | - if ($input->isInteractive() && ! $this->askConfirmation($question, $input, $output)) { |
|
| 169 | + if ($input->isInteractive() && !$this->askConfirmation($question, $input, $output)) { |
|
| 170 | 170 | return false; |
| 171 | 171 | } |
| 172 | 172 | |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | protected $schemaProvider; |
| 45 | 45 | |
| 46 | - public function __construct(SchemaProviderInterface $schemaProvider=null) |
|
| 46 | + public function __construct(SchemaProviderInterface $schemaProvider = null) |
|
| 47 | 47 | { |
| 48 | 48 | $this->schemaProvider = $schemaProvider; |
| 49 | 49 | parent::__construct(); |
@@ -93,10 +93,10 @@ discard block |
||
| 93 | 93 | $toSchema = $this->getSchemaProvider()->createSchema(); |
| 94 | 94 | |
| 95 | 95 | //Not using value from options, because filters can be set from config.yml |
| 96 | - if ( ! $isDbalOld && $filterExpr = $conn->getConfiguration()->getFilterSchemaAssetsExpression()) { |
|
| 96 | + if (!$isDbalOld && $filterExpr = $conn->getConfiguration()->getFilterSchemaAssetsExpression()) { |
|
| 97 | 97 | foreach ($toSchema->getTables() as $table) { |
| 98 | 98 | $tableName = $table->getName(); |
| 99 | - if ( ! preg_match($filterExpr, $this->resolveTableName($tableName))) { |
|
| 99 | + if (!preg_match($filterExpr, $this->resolveTableName($tableName))) { |
|
| 100 | 100 | $toSchema->dropTable($tableName); |
| 101 | 101 | } |
| 102 | 102 | } |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | $input->getOption('line-length') |
| 116 | 116 | ); |
| 117 | 117 | |
| 118 | - if (! $up && ! $down) { |
|
| 118 | + if (!$up && !$down) { |
|
| 119 | 119 | $output->writeln('No changes detected in your mapping information.'); |
| 120 | 120 | |
| 121 | 121 | return; |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | $output->writeln(file_get_contents($path)); |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - private function buildCodeFromSql(Configuration $configuration, array $sql, $formatted=false, $lineLength=120) |
|
| 131 | + private function buildCodeFromSql(Configuration $configuration, array $sql, $formatted = false, $lineLength = 120) |
|
| 132 | 132 | { |
| 133 | 133 | $currentPlatform = $configuration->getConnection()->getDatabasePlatform()->getName(); |
| 134 | 134 | $code = []; |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | */ |
| 42 | 42 | public function chosen() |
| 43 | 43 | { |
| 44 | - foreach($this->loaders as $loader) { |
|
| 44 | + foreach ($this->loaders as $loader) { |
|
| 45 | 45 | if (null !== $confObj = $loader->chosen()) { |
| 46 | 46 | return $confObj; |
| 47 | 47 | } |