@@ -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; |
@@ -128,11 +128,11 @@ discard block |
||
| 128 | 128 | $dryRun = (boolean) $input->getOption('dry-run'); |
| 129 | 129 | |
| 130 | 130 | // warn the user if no dry run and interaction is on |
| 131 | - if (! $dryRun) { |
|
| 131 | + if (!$dryRun) { |
|
| 132 | 132 | $question = 'WARNING! You are about to execute a database migration' |
| 133 | 133 | . ' that could result in schema changes and data lost.' |
| 134 | 134 | . ' Are you sure you wish to continue? (y/n)'; |
| 135 | - if (! $this->canExecute($question, $input, $output)) { |
|
| 135 | + if (!$this->canExecute($question, $input, $output)) { |
|
| 136 | 136 | $output->writeln('<error>Migration cancelled!</error>'); |
| 137 | 137 | |
| 138 | 138 | return 1; |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | */ |
| 157 | 157 | private function canExecute($question, InputInterface $input, OutputInterface $output) |
| 158 | 158 | { |
| 159 | - if ($input->isInteractive() && ! $this->askConfirmation($question, $input, $output)) { |
|
| 159 | + if ($input->isInteractive() && !$this->askConfirmation($question, $input, $output)) { |
|
| 160 | 160 | return false; |
| 161 | 161 | } |
| 162 | 162 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | return $this->proxyFactory->createProxy( |
| 49 | 49 | Schema::class, |
| 50 | - function (& $wrappedObject, $proxy, $method, array $parameters, & $initializer) use ($originalSchemaManipulator) { |
|
| 50 | + function(& $wrappedObject, $proxy, $method, array $parameters, & $initializer) use ($originalSchemaManipulator) { |
|
| 51 | 51 | $initializer = null; |
| 52 | 52 | $wrappedObject = $originalSchemaManipulator->createFromSchema(); |
| 53 | 53 | |
@@ -64,10 +64,10 @@ discard block |
||
| 64 | 64 | { |
| 65 | 65 | $originalSchemaManipulator = $this->originalSchemaManipulator; |
| 66 | 66 | |
| 67 | - if ($fromSchema instanceof LazyLoadingInterface && ! $fromSchema->isProxyInitialized()) { |
|
| 67 | + if ($fromSchema instanceof LazyLoadingInterface && !$fromSchema->isProxyInitialized()) { |
|
| 68 | 68 | return $this->proxyFactory->createProxy( |
| 69 | 69 | Schema::class, |
| 70 | - function (& $wrappedObject, $proxy, $method, array $parameters, & $initializer) use ($originalSchemaManipulator, $fromSchema) { |
|
| 70 | + function(& $wrappedObject, $proxy, $method, array $parameters, & $initializer) use ($originalSchemaManipulator, $fromSchema) { |
|
| 71 | 71 | $initializer = null; |
| 72 | 72 | $wrappedObject = $originalSchemaManipulator->createToSchema($fromSchema); |
| 73 | 73 | |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | { |
| 90 | 90 | if ( |
| 91 | 91 | $toSchema instanceof LazyLoadingInterface |
| 92 | - && ! $toSchema->isProxyInitialized() |
|
| 92 | + && !$toSchema->isProxyInitialized() |
|
| 93 | 93 | ) { |
| 94 | 94 | return []; |
| 95 | 95 | } |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | |
| 34 | 34 | public function load() |
| 35 | 35 | { |
| 36 | - foreach($this->loaders as $loader) { |
|
| 36 | + foreach ($this->loaders as $loader) { |
|
| 37 | 37 | if (false !== $confObj = $loader->load()) { |
| 38 | 38 | return $confObj; |
| 39 | 39 | } |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | /** @var Configuration */ |
| 31 | 31 | private $configuration; |
| 32 | 32 | |
| 33 | - public function __construct(Configuration $configuration=null) |
|
| 33 | + public function __construct(Configuration $configuration = null) |
|
| 34 | 34 | { |
| 35 | 35 | if ($configuration !== null) { |
| 36 | 36 | $this->configuration = $configuration; |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | { |
| 93 | 93 | $this->configuration = $this->getMigrationConfiguration($input, $output); |
| 94 | 94 | |
| 95 | - if ( ! $input->getOption('add') && ! $input->getOption('delete')) { |
|
| 95 | + if (!$input->getOption('add') && !$input->getOption('delete')) { |
|
| 96 | 96 | throw new \InvalidArgumentException('You must specify whether you want to --add or --delete the specified version.'); |
| 97 | 97 | } |
| 98 | 98 | |
@@ -149,26 +149,26 @@ discard block |
||
| 149 | 149 | |
| 150 | 150 | private function mark($version, $all = false) |
| 151 | 151 | { |
| 152 | - if ( ! $this->configuration->hasVersion($version)) { |
|
| 152 | + if (!$this->configuration->hasVersion($version)) { |
|
| 153 | 153 | throw MigrationException::unknownMigrationVersion($version); |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | $version = $this->configuration->getVersion($version); |
| 157 | 157 | if ($this->markMigrated && $this->configuration->hasVersionMigrated($version)) { |
| 158 | - if (! $all) { |
|
| 158 | + if (!$all) { |
|
| 159 | 159 | throw new \InvalidArgumentException(sprintf('The version "%s" already exists in the version table.', $version)); |
| 160 | 160 | } |
| 161 | 161 | $marked = true; |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | - if ( ! $this->markMigrated && ! $this->configuration->hasVersionMigrated($version)) { |
|
| 165 | - if (! $all) { |
|
| 164 | + if (!$this->markMigrated && !$this->configuration->hasVersionMigrated($version)) { |
|
| 165 | + if (!$all) { |
|
| 166 | 166 | throw new \InvalidArgumentException(sprintf('The version "%s" does not exists in the version table.', $version)); |
| 167 | 167 | } |
| 168 | 168 | $marked = false; |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | - if ( ! isset($marked)) { |
|
| 171 | + if (!isset($marked)) { |
|
| 172 | 172 | if ($this->markMigrated) { |
| 173 | 173 | $version->markMigrated(); |
| 174 | 174 | } else { |
@@ -64,7 +64,7 @@ |
||
| 64 | 64 | |
| 65 | 65 | private function appendDir($dir) |
| 66 | 66 | { |
| 67 | - return DIRECTORY_SEPARATOR . $dir; |
|
| 67 | + return DIRECTORY_SEPARATOR.$dir; |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | private function createDirIfNotExists($dir) |
@@ -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[] */ |
@@ -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 | - if($name == 'Executed Unavailable Migrations') { |
|
| 70 | - $value = $value > 0 ? '<error>' . $value . '</error>' : 0; |
|
| 69 | + if ($name == 'Executed Unavailable Migrations') { |
|
| 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,27 +91,27 @@ 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) |
| 98 | 98 | { |
| 99 | 99 | $migratedVersions = $configuration->getMigratedVersions(); |
| 100 | 100 | |
| 101 | - foreach($migrations as $version) { |
|
| 101 | + foreach ($migrations as $version) { |
|
| 102 | 102 | $isMigrated = in_array($version->getVersion(), $migratedVersions); |
| 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(' ', 49 - strlen($formattedVersion) - strlen($version->getVersion())) . |
|
| 114 | - $status . $migrationDescription); |
|
| 111 | + $output->writeln(' <comment>>></comment> '.$formattedVersion. |
|
| 112 | + ' (<comment>'.$version->getVersion().'</comment>)'. |
|
| 113 | + str_repeat(' ', 49 - strlen($formattedVersion) - strlen($version->getVersion())). |
|
| 114 | + $status.$migrationDescription); |
|
| 115 | 115 | } |
| 116 | 116 | } |
| 117 | 117 | } |