@@ -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.', 'ERROR'); |
120 | 120 | |
121 | 121 | return; |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | $output->writeln(sprintf('Generated new migration class to "<info>%s</info>" from schema differences.', $path)); |
128 | 128 | } |
129 | 129 | |
130 | - private function buildCodeFromSql(Configuration $configuration, array $sql, $formatted=false, $lineLength=120) |
|
130 | + private function buildCodeFromSql(Configuration $configuration, array $sql, $formatted = false, $lineLength = 120) |
|
131 | 131 | { |
132 | 132 | $currentPlatform = $configuration->getConnection()->getDatabasePlatform()->getName(); |
133 | 133 | $code = []; |
@@ -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 | } |
@@ -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 | } |
@@ -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 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | { |
108 | 108 | $path = $this->destPath; |
109 | 109 | if (is_dir($path)) { |
110 | - $path = $path . '/doctrine_migration_' . date('YmdHis') . '.sql'; |
|
110 | + $path = $path.'/doctrine_migration_'.date('YmdHis').'.sql'; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | return $path; |
@@ -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)); |
@@ -498,7 +498,7 @@ discard block |
||
498 | 498 | $this->createMigrationTable(); |
499 | 499 | |
500 | 500 | $version = $this->connection->fetchColumn( |
501 | - "SELECT " . $this->migrationsColumnName . " FROM " . $this->migrationsTableName . " WHERE " . $this->migrationsColumnName . " = ?", |
|
501 | + "SELECT ".$this->migrationsColumnName." FROM ".$this->migrationsTableName." WHERE ".$this->migrationsColumnName." = ?", |
|
502 | 502 | [$version->getVersion()] |
503 | 503 | ); |
504 | 504 | |
@@ -514,7 +514,7 @@ discard block |
||
514 | 514 | { |
515 | 515 | $this->createMigrationTable(); |
516 | 516 | |
517 | - $ret = $this->connection->fetchAll("SELECT " . $this->migrationsColumnName . " FROM " . $this->migrationsTableName); |
|
517 | + $ret = $this->connection->fetchAll("SELECT ".$this->migrationsColumnName." FROM ".$this->migrationsTableName); |
|
518 | 518 | |
519 | 519 | return array_map('current', $ret); |
520 | 520 | } |
@@ -558,7 +558,7 @@ discard block |
||
558 | 558 | foreach ($this->migrations as $migration) { |
559 | 559 | $migratedVersions[] = sprintf("'%s'", $migration->getVersion()); |
560 | 560 | } |
561 | - $where = " WHERE " . $this->migrationsColumnName . " IN (" . implode(', ', $migratedVersions) . ")"; |
|
561 | + $where = " WHERE ".$this->migrationsColumnName." IN (".implode(', ', $migratedVersions).")"; |
|
562 | 562 | } |
563 | 563 | |
564 | 564 | $sql = sprintf("SELECT %s FROM %s%s ORDER BY %s DESC", |
@@ -608,7 +608,7 @@ discard block |
||
608 | 608 | |
609 | 609 | $versions = array_map('strval', array_keys($this->migrations)); |
610 | 610 | array_unshift($versions, '0'); |
611 | - $offset = array_search((string)$version, $versions); |
|
611 | + $offset = array_search((string) $version, $versions); |
|
612 | 612 | if ($offset === false || !isset($versions[$offset + $delta])) { |
613 | 613 | // Unknown version or delta out of bounds. |
614 | 614 | return null; |
@@ -664,7 +664,7 @@ discard block |
||
664 | 664 | { |
665 | 665 | $this->createMigrationTable(); |
666 | 666 | |
667 | - $result = $this->connection->fetchColumn("SELECT COUNT(" . $this->migrationsColumnName . ") FROM " . $this->migrationsTableName); |
|
667 | + $result = $this->connection->fetchColumn("SELECT COUNT(".$this->migrationsColumnName.") FROM ".$this->migrationsTableName); |
|
668 | 668 | |
669 | 669 | return $result !== false ? $result : 0; |
670 | 670 | } |
@@ -808,7 +808,7 @@ discard block |
||
808 | 808 | * @param DateTimeInterface|null $now Defaults to the current time in UTC |
809 | 809 | * @return string The newly generated version |
810 | 810 | */ |
811 | - public function generateVersionNumber(\DateTimeInterface $now=null) |
|
811 | + public function generateVersionNumber(\DateTimeInterface $now = null) |
|
812 | 812 | { |
813 | 813 | $now = $now ?: new \DateTime('now', new \DateTimeZone('UTC')); |
814 | 814 | |
@@ -863,7 +863,7 @@ discard block |
||
863 | 863 | */ |
864 | 864 | private function ensureMigrationClassExists($class) |
865 | 865 | { |
866 | - if ( ! class_exists($class)) { |
|
866 | + if (!class_exists($class)) { |
|
867 | 867 | throw MigrationException::migrationClassNotFound($class, $this->getMigrationsNamespace()); |
868 | 868 | } |
869 | 869 | } |