@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | $dir = $dir ? $dir : getcwd(); |
47 | 47 | $dir = rtrim($dir, '/'); |
48 | 48 | |
49 | - if ( ! file_exists($dir)) { |
|
49 | + if (!file_exists($dir)) { |
|
50 | 50 | throw new \InvalidArgumentException(sprintf('Migrations directory "%s" does not exist.', $dir)); |
51 | 51 | } |
52 | 52 | |
@@ -64,12 +64,12 @@ discard block |
||
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) |
71 | 71 | { |
72 | - if ( ! file_exists($dir)) { |
|
72 | + if (!file_exists($dir)) { |
|
73 | 73 | mkdir($dir, 0755, true); |
74 | 74 | } |
75 | 75 | } |
@@ -93,16 +93,16 @@ 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 | } |
103 | 103 | } |
104 | 104 | |
105 | - $up = $this->buildCodeFromSql( |
|
105 | + $up = $this->buildCodeFromSql( |
|
106 | 106 | $configuration, |
107 | 107 | $fromSchema->getMigrateToSql($toSchema, $platform), |
108 | 108 | $input->getOption('formatted'), |
@@ -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; |
@@ -138,9 +138,9 @@ discard block |
||
138 | 138 | } |
139 | 139 | |
140 | 140 | if ($formatted) { |
141 | - if ( ! class_exists('\SqlFormatter')) { |
|
141 | + if (!class_exists('\SqlFormatter')) { |
|
142 | 142 | throw new \InvalidArgumentException( |
143 | - 'The "--formatted" option can only be used if the sql formatter is installed.' . |
|
143 | + 'The "--formatted" option can only be used if the sql formatter is installed.'. |
|
144 | 144 | 'Please run "composer require jdorn/sql-formatter".' |
145 | 145 | ); |
146 | 146 | } |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | $code[] = sprintf("\$this->addSql(%s);", var_export($query, true)); |
156 | 156 | } |
157 | 157 | |
158 | - if ( ! empty($code)) { |
|
158 | + if (!empty($code)) { |
|
159 | 159 | array_unshift( |
160 | 160 | $code, |
161 | 161 | sprintf( |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | |
173 | 173 | private function getSchemaProvider() |
174 | 174 | { |
175 | - if ( ! $this->schemaProvider) { |
|
175 | + if (!$this->schemaProvider) { |
|
176 | 176 | $this->schemaProvider = new OrmSchemaProvider($this->getHelper('entityManager')->getEntityManager()); |
177 | 177 | } |
178 | 178 |
@@ -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 | } |
@@ -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 |
@@ -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 | } |
@@ -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 | } |
@@ -34,7 +34,7 @@ |
||
34 | 34 | public function __construct(\Closure $closure = null) |
35 | 35 | { |
36 | 36 | if ($closure === null) { |
37 | - $closure = function ($message) { |
|
37 | + $closure = function($message) { |
|
38 | 38 | }; |
39 | 39 | } |
40 | 40 | $this->closure = $closure; |
@@ -74,7 +74,7 @@ |
||
74 | 74 | } |
75 | 75 | |
76 | 76 | //Show normal version number |
77 | - return $this->configuration->getDateTime($version) . ' (<comment>' . $version . '</comment>)'; |
|
77 | + return $this->configuration->getDateTime($version).' (<comment>'.$version.'</comment>)'; |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |