@@ -64,10 +64,10 @@ discard block |
||
| 64 | 64 | $output->writeln("\n <info>==</info> Configuration\n"); |
| 65 | 65 | foreach ($infos->getMigrationsInfos() as $name => $value) { |
| 66 | 66 | if ($name == 'New Migrations') { |
| 67 | - $value = $value > 0 ? '<question>' . $value . '</question>' : 0; |
|
| 67 | + $value = $value > 0 ? '<question>'.$value.'</question>' : 0; |
|
| 68 | 68 | } |
| 69 | 69 | if ($name == 'Executed Unavailable Migrations') { |
| 70 | - $value = $value > 0 ? '<error>' . $value . '</error>' : 0; |
|
| 70 | + $value = $value > 0 ? '<error>'.$value.'</error>' : 0; |
|
| 71 | 71 | } |
| 72 | 72 | $this->writeStatusInfosLineAligned($output, $name, $value); |
| 73 | 73 | } |
@@ -82,8 +82,8 @@ discard block |
||
| 82 | 82 | if (count($infos->getExecutedUnavailableMigrations())) { |
| 83 | 83 | $output->writeln("\n <info>==</info> Previously Executed Unavailable Migration Versions\n"); |
| 84 | 84 | foreach ($infos->getExecutedUnavailableMigrations() as $executedUnavailableMigration) { |
| 85 | - $output->writeln(' <comment>>></comment> ' . $configuration->getDateTime($executedUnavailableMigration) . |
|
| 86 | - ' (<comment>' . $executedUnavailableMigration . '</comment>)'); |
|
| 85 | + $output->writeln(' <comment>>></comment> '.$configuration->getDateTime($executedUnavailableMigration). |
|
| 86 | + ' (<comment>'.$executedUnavailableMigration.'</comment>)'); |
|
| 87 | 87 | } |
| 88 | 88 | } |
| 89 | 89 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | private function writeStatusInfosLineAligned(OutputInterface $output, $title, $value) |
| 93 | 93 | { |
| 94 | - $output->writeln(' <comment>>></comment> ' . $title . ': ' . str_repeat(' ', 50 - strlen($title)) . $value); |
|
| 94 | + $output->writeln(' <comment>>></comment> '.$title.': '.str_repeat(' ', 50 - strlen($title)).$value); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | private function showVersions($migrations, Configuration $configuration, OutputInterface $output) |
@@ -103,15 +103,15 @@ discard block |
||
| 103 | 103 | $status = $isMigrated ? '<info>migrated</info>' : '<error>not migrated</error>'; |
| 104 | 104 | |
| 105 | 105 | $migrationDescription = $version->getMigration()->getDescription() |
| 106 | - ? str_repeat(' ', 5) . $version->getMigration()->getDescription() |
|
| 106 | + ? str_repeat(' ', 5).$version->getMigration()->getDescription() |
|
| 107 | 107 | : ''; |
| 108 | 108 | |
| 109 | 109 | $formattedVersion = $configuration->getDateTime($version->getVersion()); |
| 110 | 110 | |
| 111 | - $output->writeln(' <comment>>></comment> ' . $formattedVersion . |
|
| 112 | - ' (<comment>' . $version->getVersion() . '</comment>)' . |
|
| 113 | - str_repeat(' ', max(1, 49 - strlen($formattedVersion) - strlen($version->getVersion()))) . |
|
| 114 | - $status . $migrationDescription); |
|
| 111 | + $output->writeln(' <comment>>></comment> '.$formattedVersion. |
|
| 112 | + ' (<comment>'.$version->getVersion().'</comment>)'. |
|
| 113 | + str_repeat(' ', max(1, 49 - strlen($formattedVersion) - strlen($version->getVersion()))). |
|
| 114 | + $status.$migrationDescription); |
|
| 115 | 115 | } |
| 116 | 116 | } |
| 117 | 117 | } |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | protected function getRealPath($directory) |
| 35 | 35 | { |
| 36 | 36 | $dir = realpath($directory); |
| 37 | - if (false === $dir || ! is_dir($dir)) { |
|
| 37 | + if (false === $dir || !is_dir($dir)) { |
|
| 38 | 38 | throw new \InvalidArgumentException(sprintf( |
| 39 | 39 | 'Cannot load migrations from "%s" because it is not a valid directory', |
| 40 | 40 | $directory |
@@ -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 migrations' . PHP_EOL . |
|
| 65 | + 'Cannot load a migrations with the name "%s" because it is a reserved number by doctrine migrations'.PHP_EOL. |
|
| 66 | 66 | 'It\'s used to revert all migrations including the first one.', |
| 67 | 67 | $version |
| 68 | 68 | )); |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | */ |
| 81 | 81 | protected function getFileSortCallback() |
| 82 | 82 | { |
| 83 | - return function ($a, $b) { |
|
| 83 | + return function($a, $b) { |
|
| 84 | 84 | return (basename($a) < basename($b)) ? -1 : 1; |
| 85 | 85 | }; |
| 86 | 86 | } |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | protected function setConfiguration(array $config) |
| 63 | 63 | { |
| 64 | 64 | foreach ($config as $configurationKey => $configurationValue) { |
| 65 | - if ( ! isset($this->configurationProperties[$configurationKey])) { |
|
| 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 | } |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | } elseif (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,12 +113,12 @@ 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; |
| 120 | 120 | |
| 121 | - if ( ! file_exists($file)) { |
|
| 121 | + if (!file_exists($file)) { |
|
| 122 | 122 | throw new \InvalidArgumentException('Given config file does not exist'); |
| 123 | 123 | } |
| 124 | 124 | |
@@ -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 | } |
@@ -43,12 +43,12 @@ |
||
| 43 | 43 | return null; |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - if ( ! file_exists($this->filename)) { |
|
| 46 | + if (!file_exists($this->filename)) { |
|
| 47 | 47 | return null; |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | $params = include $this->filename; |
| 51 | - if ( ! is_array($params)) { |
|
| 51 | + if (!is_array($params)) { |
|
| 52 | 52 | throw new \InvalidArgumentException('The connection file has to return an array with database configuration parameters.'); |
| 53 | 53 | } |
| 54 | 54 | |
@@ -196,10 +196,10 @@ discard block |
||
| 196 | 196 | */ |
| 197 | 197 | public function validate() |
| 198 | 198 | { |
| 199 | - if ( ! $this->migrationsNamespace) { |
|
| 199 | + if (!$this->migrationsNamespace) { |
|
| 200 | 200 | throw MigrationException::migrationsNamespaceRequired(); |
| 201 | 201 | } |
| 202 | - if ( ! $this->migrationsDirectory) { |
|
| 202 | + if (!$this->migrationsDirectory) { |
|
| 203 | 203 | throw MigrationException::migrationsDirectoryRequired(); |
| 204 | 204 | } |
| 205 | 205 | } |
@@ -374,7 +374,7 @@ discard block |
||
| 374 | 374 | public function setMigrationsFinder(MigrationFinderInterface $finder) |
| 375 | 375 | { |
| 376 | 376 | if (($this->migrationsAreOrganizedByYear || $this->migrationsAreOrganizedByYearAndMonth) |
| 377 | - && ! ($finder instanceof MigrationDeepFinderInterface)) { |
|
| 377 | + && !($finder instanceof MigrationDeepFinderInterface)) { |
|
| 378 | 378 | throw MigrationException::configurationIncompatibleWithFinder( |
| 379 | 379 | 'organize-migrations', |
| 380 | 380 | $finder |
@@ -471,7 +471,7 @@ discard block |
||
| 471 | 471 | $this->registerMigrationsFromDirectory($this->getMigrationsDirectory()); |
| 472 | 472 | } |
| 473 | 473 | |
| 474 | - if ( ! isset($this->migrations[$version])) { |
|
| 474 | + if (!isset($this->migrations[$version])) { |
|
| 475 | 475 | throw MigrationException::unknownMigrationVersion($version); |
| 476 | 476 | } |
| 477 | 477 | |
@@ -507,7 +507,7 @@ discard block |
||
| 507 | 507 | $this->createMigrationTable(); |
| 508 | 508 | |
| 509 | 509 | $version = $this->connection->fetchColumn( |
| 510 | - "SELECT " . $this->migrationsColumnName . " FROM " . $this->migrationsTableName . " WHERE " . $this->migrationsColumnName . " = ?", |
|
| 510 | + "SELECT ".$this->migrationsColumnName." FROM ".$this->migrationsTableName." WHERE ".$this->migrationsColumnName." = ?", |
|
| 511 | 511 | [$version->getVersion()] |
| 512 | 512 | ); |
| 513 | 513 | |
@@ -524,7 +524,7 @@ discard block |
||
| 524 | 524 | $this->connect(); |
| 525 | 525 | $this->createMigrationTable(); |
| 526 | 526 | |
| 527 | - $ret = $this->connection->fetchAll("SELECT " . $this->migrationsColumnName . " FROM " . $this->migrationsTableName); |
|
| 527 | + $ret = $this->connection->fetchAll("SELECT ".$this->migrationsColumnName." FROM ".$this->migrationsTableName); |
|
| 528 | 528 | |
| 529 | 529 | return array_map('current', $ret); |
| 530 | 530 | } |
@@ -564,12 +564,12 @@ discard block |
||
| 564 | 564 | } |
| 565 | 565 | |
| 566 | 566 | $where = null; |
| 567 | - if ( ! empty($this->migrations)) { |
|
| 567 | + if (!empty($this->migrations)) { |
|
| 568 | 568 | $migratedVersions = []; |
| 569 | 569 | foreach ($this->migrations as $migration) { |
| 570 | 570 | $migratedVersions[] = sprintf("'%s'", $migration->getVersion()); |
| 571 | 571 | } |
| 572 | - $where = " WHERE " . $this->migrationsColumnName . " IN (" . implode(', ', $migratedVersions) . ")"; |
|
| 572 | + $where = " WHERE ".$this->migrationsColumnName." IN (".implode(', ', $migratedVersions).")"; |
|
| 573 | 573 | } |
| 574 | 574 | |
| 575 | 575 | $sql = sprintf( |
@@ -624,7 +624,7 @@ discard block |
||
| 624 | 624 | $versions = array_map('strval', array_keys($this->migrations)); |
| 625 | 625 | array_unshift($versions, '0'); |
| 626 | 626 | $offset = array_search((string) $version, $versions); |
| 627 | - if ($offset === false || ! isset($versions[$offset + $delta])) { |
|
| 627 | + if ($offset === false || !isset($versions[$offset + $delta])) { |
|
| 628 | 628 | // Unknown version or delta out of bounds. |
| 629 | 629 | return null; |
| 630 | 630 | } |
@@ -705,7 +705,7 @@ discard block |
||
| 705 | 705 | $this->connect(); |
| 706 | 706 | $this->createMigrationTable(); |
| 707 | 707 | |
| 708 | - $result = $this->connection->fetchColumn("SELECT COUNT(" . $this->migrationsColumnName . ") FROM " . $this->migrationsTableName); |
|
| 708 | + $result = $this->connection->fetchColumn("SELECT COUNT(".$this->migrationsColumnName.") FROM ".$this->migrationsTableName); |
|
| 709 | 709 | |
| 710 | 710 | return $result !== false ? $result : 0; |
| 711 | 711 | } |
@@ -891,7 +891,7 @@ discard block |
||
| 891 | 891 | */ |
| 892 | 892 | private function ensureOrganizeMigrationsIsCompatibleWithFinder() |
| 893 | 893 | { |
| 894 | - if ( ! ($this->migrationFinder instanceof MigrationDeepFinderInterface)) { |
|
| 894 | + if (!($this->migrationFinder instanceof MigrationDeepFinderInterface)) { |
|
| 895 | 895 | throw MigrationException::configurationIncompatibleWithFinder( |
| 896 | 896 | 'organize-migrations', |
| 897 | 897 | $this->migrationFinder |
@@ -913,7 +913,7 @@ discard block |
||
| 913 | 913 | private function shouldExecuteMigration($direction, Version $version, $to, $migrated) |
| 914 | 914 | { |
| 915 | 915 | if ($direction === Version::DIRECTION_DOWN) { |
| 916 | - if ( ! in_array($version->getVersion(), $migrated)) { |
|
| 916 | + if (!in_array($version->getVersion(), $migrated)) { |
|
| 917 | 917 | return false; |
| 918 | 918 | } |
| 919 | 919 | |
@@ -934,7 +934,7 @@ discard block |
||
| 934 | 934 | */ |
| 935 | 935 | private function ensureMigrationClassExists($class) |
| 936 | 936 | { |
| 937 | - if ( ! class_exists($class)) { |
|
| 937 | + if (!class_exists($class)) { |
|
| 938 | 938 | throw MigrationException::migrationClassNotFound($class, $this->getMigrationsNamespace()); |
| 939 | 939 | } |
| 940 | 940 | } |
@@ -39,7 +39,7 @@ |
||
| 39 | 39 | libxml_use_internal_errors(true); |
| 40 | 40 | $xml = new \DOMDocument(); |
| 41 | 41 | $xml->load($file); |
| 42 | - if ( ! $xml->schemaValidate(__DIR__ . DIRECTORY_SEPARATOR . "XML" . DIRECTORY_SEPARATOR . "configuration.xsd")) { |
|
| 42 | + if (!$xml->schemaValidate(__DIR__.DIRECTORY_SEPARATOR."XML".DIRECTORY_SEPARATOR."configuration.xsd")) { |
|
| 43 | 43 | libxml_clear_errors(); |
| 44 | 44 | throw MigrationException::configurationNotValid('XML configuration did not pass the validation test.'); |
| 45 | 45 | } |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | { |
| 39 | 39 | $config = Yaml::parse(file_get_contents($file)); |
| 40 | 40 | |
| 41 | - if ( ! is_array($config)) { |
|
| 41 | + if (!is_array($config)) { |
|
| 42 | 42 | throw new \InvalidArgumentException('Not valid configuration.'); |
| 43 | 43 | } |
| 44 | 44 | |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | public function onMigrationsMigrated(MigrationsEventArgs $args) |
| 35 | 35 | { |
| 36 | 36 | $conn = $args->getConnection(); |
| 37 | - if ( ! $args->isDryRun() && ! $conn->isAutoCommit()) { |
|
| 37 | + if (!$args->isDryRun() && !$conn->isAutoCommit()) { |
|
| 38 | 38 | $conn->commit(); |
| 39 | 39 | } |
| 40 | 40 | } |
@@ -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(); |