@@ -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 | } |
@@ -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 | } |
@@ -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 |
@@ -501,7 +501,7 @@ discard block |
||
501 | 501 | $this->createMigrationTable(); |
502 | 502 | |
503 | 503 | $version = $this->connection->fetchColumn( |
504 | - "SELECT " . $this->migrationsColumnName . " FROM " . $this->migrationsTableName . " WHERE " . $this->migrationsColumnName . " = ?", |
|
504 | + "SELECT ".$this->migrationsColumnName." FROM ".$this->migrationsTableName." WHERE ".$this->migrationsColumnName." = ?", |
|
505 | 505 | [$version->getVersion()] |
506 | 506 | ); |
507 | 507 | |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | $this->connect(); |
519 | 519 | $this->createMigrationTable(); |
520 | 520 | |
521 | - $ret = $this->connection->fetchAll("SELECT " . $this->migrationsColumnName . " FROM " . $this->migrationsTableName); |
|
521 | + $ret = $this->connection->fetchAll("SELECT ".$this->migrationsColumnName." FROM ".$this->migrationsTableName); |
|
522 | 522 | |
523 | 523 | return array_map('current', $ret); |
524 | 524 | } |
@@ -563,7 +563,7 @@ discard block |
||
563 | 563 | foreach ($this->migrations as $migration) { |
564 | 564 | $migratedVersions[] = sprintf("'%s'", $migration->getVersion()); |
565 | 565 | } |
566 | - $where = " WHERE " . $this->migrationsColumnName . " IN (" . implode(', ', $migratedVersions) . ")"; |
|
566 | + $where = " WHERE ".$this->migrationsColumnName." IN (".implode(', ', $migratedVersions).")"; |
|
567 | 567 | } |
568 | 568 | |
569 | 569 | $sql = sprintf("SELECT %s FROM %s%s ORDER BY %s DESC", |
@@ -613,7 +613,7 @@ discard block |
||
613 | 613 | |
614 | 614 | $versions = array_map('strval', array_keys($this->migrations)); |
615 | 615 | array_unshift($versions, '0'); |
616 | - $offset = array_search((string)$version, $versions); |
|
616 | + $offset = array_search((string) $version, $versions); |
|
617 | 617 | if ($offset === false || !isset($versions[$offset + $delta])) { |
618 | 618 | // Unknown version or delta out of bounds. |
619 | 619 | return null; |
@@ -670,7 +670,7 @@ discard block |
||
670 | 670 | $this->connect(); |
671 | 671 | $this->createMigrationTable(); |
672 | 672 | |
673 | - $result = $this->connection->fetchColumn("SELECT COUNT(" . $this->migrationsColumnName . ") FROM " . $this->migrationsTableName); |
|
673 | + $result = $this->connection->fetchColumn("SELECT COUNT(".$this->migrationsColumnName.") FROM ".$this->migrationsTableName); |
|
674 | 674 | |
675 | 675 | return $result !== false ? $result : 0; |
676 | 676 | } |
@@ -781,7 +781,7 @@ discard block |
||
781 | 781 | * @param string $eventName The event to emit. |
782 | 782 | * @param $args The event args instance to emit. |
783 | 783 | */ |
784 | - public function dispatchEvent($eventName, EventArgs $args=null) |
|
784 | + public function dispatchEvent($eventName, EventArgs $args = null) |
|
785 | 785 | { |
786 | 786 | $this->connection->getEventManager()->dispatchEvent($eventName, $args); |
787 | 787 | } |
@@ -826,7 +826,7 @@ discard block |
||
826 | 826 | * @param DateTimeInterface|null $now Defaults to the current time in UTC |
827 | 827 | * @return string The newly generated version |
828 | 828 | */ |
829 | - public function generateVersionNumber(\DateTimeInterface $now=null) |
|
829 | + public function generateVersionNumber(\DateTimeInterface $now = null) |
|
830 | 830 | { |
831 | 831 | $now = $now ?: new \DateTime('now', new \DateTimeZone('UTC')); |
832 | 832 | |
@@ -899,7 +899,7 @@ discard block |
||
899 | 899 | */ |
900 | 900 | private function ensureMigrationClassExists($class) |
901 | 901 | { |
902 | - if ( ! class_exists($class)) { |
|
902 | + if (!class_exists($class)) { |
|
903 | 903 | throw MigrationException::migrationClassNotFound($class, $this->getMigrationsNamespace()); |
904 | 904 | } |
905 | 905 | } |
@@ -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 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $string = $this->buildMigrationFile($queriesByVersion, $direction); |
70 | 70 | |
71 | 71 | if ($this->outputWriter) { |
72 | - $this->outputWriter->write("\n" . sprintf('Writing migration file to "<info>%s</info>"', $path)); |
|
72 | + $this->outputWriter->write("\n".sprintf('Writing migration file to "<info>%s</info>"', $path)); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | return file_put_contents($path, $string); |
@@ -80,9 +80,9 @@ discard block |
||
80 | 80 | $string = sprintf("-- Doctrine Migration File Generated on %s\n", date('Y-m-d H:i:s')); |
81 | 81 | |
82 | 82 | foreach ($queriesByVersion as $version => $queries) { |
83 | - $string .= "\n-- Version " . $version . "\n"; |
|
83 | + $string .= "\n-- Version ".$version."\n"; |
|
84 | 84 | foreach ($queries as $query) { |
85 | - $string .= $query . ";\n"; |
|
85 | + $string .= $query.";\n"; |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | $path = $this->destPath; |
109 | 109 | if (is_dir($path)) { |
110 | 110 | $path = realpath($path); |
111 | - $path = $path . '/doctrine_migration_' . date('YmdHis') . '.sql'; |
|
111 | + $path = $path.'/doctrine_migration_'.date('YmdHis').'.sql'; |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | return $path; |
@@ -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(' ', 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 | } |