@@ -196,10 +196,10 @@ discard block |
||
196 | 196 | */ |
197 | 197 | public function validate() |
198 | 198 | { |
199 | - if ( ! $this->migrationsNamespace) { |
|
199 | + if (!$this->migrationsNamespace) { |
|
200 | 200 | throw MigrationException::migrationsNamespaceRequired(); |
201 | 201 | } |
202 | - if ( ! $this->migrationsDirectory) { |
|
202 | + if (!$this->migrationsDirectory) { |
|
203 | 203 | throw MigrationException::migrationsDirectoryRequired(); |
204 | 204 | } |
205 | 205 | } |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | public function setMigrationsFinder(MigrationFinderInterface $finder) |
375 | 375 | { |
376 | 376 | if (($this->migrationsAreOrganizedByYear || $this->migrationsAreOrganizedByYearAndMonth) |
377 | - && ! ($finder instanceof MigrationDeepFinderInterface)) { |
|
377 | + && !($finder instanceof MigrationDeepFinderInterface)) { |
|
378 | 378 | throw MigrationException::configurationIncompatibleWithFinder( |
379 | 379 | 'organize-migrations', |
380 | 380 | $finder |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | $this->registerMigrationsFromDirectory($this->getMigrationsDirectory()); |
472 | 472 | } |
473 | 473 | |
474 | - if ( ! isset($this->migrations[$version])) { |
|
474 | + if (!isset($this->migrations[$version])) { |
|
475 | 475 | throw MigrationException::unknownMigrationVersion($version); |
476 | 476 | } |
477 | 477 | |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | $this->createMigrationTable(); |
508 | 508 | |
509 | 509 | $version = $this->connection->fetchColumn( |
510 | - "SELECT " . $this->migrationsColumnName . " FROM " . $this->migrationsTableName . " WHERE " . $this->migrationsColumnName . " = ?", |
|
510 | + "SELECT ".$this->migrationsColumnName." FROM ".$this->migrationsTableName." WHERE ".$this->migrationsColumnName." = ?", |
|
511 | 511 | [$version->getVersion()] |
512 | 512 | ); |
513 | 513 | |
@@ -524,7 +524,7 @@ discard block |
||
524 | 524 | $this->connect(); |
525 | 525 | $this->createMigrationTable(); |
526 | 526 | |
527 | - $ret = $this->connection->fetchAll("SELECT " . $this->migrationsColumnName . " FROM " . $this->migrationsTableName); |
|
527 | + $ret = $this->connection->fetchAll("SELECT ".$this->migrationsColumnName." FROM ".$this->migrationsTableName); |
|
528 | 528 | |
529 | 529 | return array_map('current', $ret); |
530 | 530 | } |
@@ -564,12 +564,12 @@ discard block |
||
564 | 564 | } |
565 | 565 | |
566 | 566 | $where = null; |
567 | - if ( ! empty($this->migrations)) { |
|
567 | + if (!empty($this->migrations)) { |
|
568 | 568 | $migratedVersions = []; |
569 | 569 | foreach ($this->migrations as $migration) { |
570 | 570 | $migratedVersions[] = sprintf("'%s'", $migration->getVersion()); |
571 | 571 | } |
572 | - $where = " WHERE " . $this->migrationsColumnName . " IN (" . implode(', ', $migratedVersions) . ")"; |
|
572 | + $where = " WHERE ".$this->migrationsColumnName." IN (".implode(', ', $migratedVersions).")"; |
|
573 | 573 | } |
574 | 574 | |
575 | 575 | $sql = sprintf( |
@@ -624,7 +624,7 @@ discard block |
||
624 | 624 | $versions = array_map('strval', array_keys($this->migrations)); |
625 | 625 | array_unshift($versions, '0'); |
626 | 626 | $offset = array_search((string) $version, $versions); |
627 | - if ($offset === false || ! isset($versions[$offset + $delta])) { |
|
627 | + if ($offset === false || !isset($versions[$offset + $delta])) { |
|
628 | 628 | // Unknown version or delta out of bounds. |
629 | 629 | return null; |
630 | 630 | } |
@@ -705,7 +705,7 @@ discard block |
||
705 | 705 | $this->connect(); |
706 | 706 | $this->createMigrationTable(); |
707 | 707 | |
708 | - $result = $this->connection->fetchColumn("SELECT COUNT(" . $this->migrationsColumnName . ") FROM " . $this->migrationsTableName); |
|
708 | + $result = $this->connection->fetchColumn("SELECT COUNT(".$this->migrationsColumnName.") FROM ".$this->migrationsTableName); |
|
709 | 709 | |
710 | 710 | return $result !== false ? $result : 0; |
711 | 711 | } |
@@ -891,7 +891,7 @@ discard block |
||
891 | 891 | */ |
892 | 892 | private function ensureOrganizeMigrationsIsCompatibleWithFinder() |
893 | 893 | { |
894 | - if ( ! ($this->migrationFinder instanceof MigrationDeepFinderInterface)) { |
|
894 | + if (!($this->migrationFinder instanceof MigrationDeepFinderInterface)) { |
|
895 | 895 | throw MigrationException::configurationIncompatibleWithFinder( |
896 | 896 | 'organize-migrations', |
897 | 897 | $this->migrationFinder |
@@ -913,7 +913,7 @@ discard block |
||
913 | 913 | private function shouldExecuteMigration($direction, Version $version, $to, $migrated) |
914 | 914 | { |
915 | 915 | if ($direction === Version::DIRECTION_DOWN) { |
916 | - if ( ! in_array($version->getVersion(), $migrated)) { |
|
916 | + if (!in_array($version->getVersion(), $migrated)) { |
|
917 | 917 | return false; |
918 | 918 | } |
919 | 919 | |
@@ -934,7 +934,7 @@ discard block |
||
934 | 934 | */ |
935 | 935 | private function ensureMigrationClassExists($class) |
936 | 936 | { |
937 | - if ( ! class_exists($class)) { |
|
937 | + if (!class_exists($class)) { |
|
938 | 938 | throw MigrationException::migrationClassNotFound($class, $this->getMigrationsNamespace()); |
939 | 939 | } |
940 | 940 | } |
@@ -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 | } |
@@ -38,7 +38,7 @@ |
||
38 | 38 | { |
39 | 39 | $config = Yaml::parse(file_get_contents($file)); |
40 | 40 | |
41 | - if ( ! is_array($config)) { |
|
41 | + if (!is_array($config)) { |
|
42 | 42 | throw new \InvalidArgumentException('Not valid configuration.'); |
43 | 43 | } |
44 | 44 |
@@ -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; |
@@ -117,8 +117,8 @@ discard block |
||
117 | 117 | $replacements = [ |
118 | 118 | $configuration->getMigrationsNamespace(), |
119 | 119 | $version, |
120 | - $up ? " " . implode("\n ", explode("\n", $up)) : null, |
|
121 | - $down ? " " . implode("\n ", explode("\n", $down)) : null, |
|
120 | + $up ? " ".implode("\n ", explode("\n", $up)) : null, |
|
121 | + $down ? " ".implode("\n ", explode("\n", $down)) : null, |
|
122 | 122 | ]; |
123 | 123 | |
124 | 124 | $code = str_replace($placeHolders, $replacements, $this->getTemplate()); |
@@ -126,12 +126,12 @@ discard block |
||
126 | 126 | |
127 | 127 | $directoryHelper = new MigrationDirectoryHelper($configuration); |
128 | 128 | $dir = $directoryHelper->getMigrationDirectory(); |
129 | - $path = $dir . '/Version' . $version . '.php'; |
|
129 | + $path = $dir.'/Version'.$version.'.php'; |
|
130 | 130 | |
131 | 131 | file_put_contents($path, $code); |
132 | 132 | |
133 | 133 | if ($editorCmd = $input->getOption('editor-cmd')) { |
134 | - proc_open($editorCmd . ' ' . escapeshellarg($path), [], $pipes); |
|
134 | + proc_open($editorCmd.' '.escapeshellarg($path), [], $pipes); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | return $path; |
@@ -145,18 +145,18 @@ discard block |
||
145 | 145 | return; |
146 | 146 | } |
147 | 147 | |
148 | - $filePath = getcwd() . '/' . $customTemplate; |
|
148 | + $filePath = getcwd().'/'.$customTemplate; |
|
149 | 149 | |
150 | - if ( ! is_file($filePath) || ! is_readable($filePath)) { |
|
150 | + if (!is_file($filePath) || !is_readable($filePath)) { |
|
151 | 151 | throw new \InvalidArgumentException( |
152 | - 'The specified template "' . $customTemplate . '" cannot be found or is not readable.' |
|
152 | + 'The specified template "'.$customTemplate.'" cannot be found or is not readable.' |
|
153 | 153 | ); |
154 | 154 | } |
155 | 155 | |
156 | 156 | $content = file_get_contents($filePath); |
157 | 157 | |
158 | 158 | if ($content === false) { |
159 | - throw new \InvalidArgumentException('The specified template "' . $customTemplate . '" could not be read.'); |
|
159 | + throw new \InvalidArgumentException('The specified template "'.$customTemplate.'" could not be read.'); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | $output->writeln(sprintf('Using custom migration template "<info>%s</info>"', $customTemplate)); |