@@ -116,19 +116,19 @@ |
||
116 | 116 | $replacements = [ |
117 | 117 | $configuration->getMigrationsNamespace(), |
118 | 118 | $version, |
119 | - $up ? " " . implode("\n ", explode("\n", $up)) : null, |
|
120 | - $down ? " " . implode("\n ", explode("\n", $down)) : null |
|
119 | + $up ? " ".implode("\n ", explode("\n", $up)) : null, |
|
120 | + $down ? " ".implode("\n ", explode("\n", $down)) : null |
|
121 | 121 | ]; |
122 | 122 | $code = str_replace($placeHolders, $replacements, $this->getTemplate()); |
123 | 123 | $code = preg_replace('/^ +$/m', '', $code); |
124 | 124 | $migrationDirectoryHelper = new MigrationDirectoryHelper($configuration); |
125 | 125 | $dir = $migrationDirectoryHelper->getMigrationDirectory(); |
126 | - $path = $dir . '/Version' . $version . '.php'; |
|
126 | + $path = $dir.'/Version'.$version.'.php'; |
|
127 | 127 | |
128 | 128 | file_put_contents($path, $code); |
129 | 129 | |
130 | 130 | if ($editorCmd = $input->getOption('editor-cmd')) { |
131 | - proc_open($editorCmd . ' ' . escapeshellarg($path), [], $pipes); |
|
131 | + proc_open($editorCmd.' '.escapeshellarg($path), [], $pipes); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | return $path; |
@@ -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; |
@@ -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 | } |