@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | protected function getRealPath($directory) |
17 | 17 | { |
18 | 18 | $dir = realpath($directory); |
19 | - if ($dir === false || ! is_dir($dir)) { |
|
19 | + if ($dir === false || !is_dir($dir)) { |
|
20 | 20 | throw new \InvalidArgumentException(sprintf( |
21 | 21 | 'Cannot load migrations from "%s" because it is not a valid directory', |
22 | 22 | $directory |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $version = (string) substr($className, 7); |
45 | 45 | if ($version === '0') { |
46 | 46 | throw new \InvalidArgumentException(sprintf( |
47 | - 'Cannot load a migrations with the name "%s" because it is a reserved number by doctrine migrations' . PHP_EOL . |
|
47 | + 'Cannot load a migrations with the name "%s" because it is a reserved number by doctrine migrations'.PHP_EOL. |
|
48 | 48 | 'It\'s used to revert all migrations including the first one.', |
49 | 49 | $version |
50 | 50 | )); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | */ |
63 | 63 | protected function getFileSortCallback() |
64 | 64 | { |
65 | - return function ($a, $b) { |
|
65 | + return function($a, $b) { |
|
66 | 66 | return (basename($a) < basename($b)) ? -1 : 1; |
67 | 67 | }; |
68 | 68 | } |
@@ -187,10 +187,10 @@ discard block |
||
187 | 187 | */ |
188 | 188 | public function validate() |
189 | 189 | { |
190 | - if (! $this->migrationsNamespace) { |
|
190 | + if (!$this->migrationsNamespace) { |
|
191 | 191 | throw MigrationException::migrationsNamespaceRequired(); |
192 | 192 | } |
193 | - if (! $this->migrationsDirectory) { |
|
193 | + if (!$this->migrationsDirectory) { |
|
194 | 194 | throw MigrationException::migrationsDirectoryRequired(); |
195 | 195 | } |
196 | 196 | } |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | public function setMigrationsFinder(MigrationFinderInterface $finder) |
386 | 386 | { |
387 | 387 | if (($this->migrationsAreOrganizedByYear || $this->migrationsAreOrganizedByYearAndMonth) |
388 | - && ! ($finder instanceof MigrationDeepFinderInterface)) { |
|
388 | + && !($finder instanceof MigrationDeepFinderInterface)) { |
|
389 | 389 | throw MigrationException::configurationIncompatibleWithFinder( |
390 | 390 | 'organize-migrations', |
391 | 391 | $finder |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | $this->registerMigrationsFromDirectory($this->getMigrationsDirectory()); |
482 | 482 | } |
483 | 483 | |
484 | - if (! isset($this->migrations[$version])) { |
|
484 | + if (!isset($this->migrations[$version])) { |
|
485 | 485 | throw MigrationException::unknownMigrationVersion($version); |
486 | 486 | } |
487 | 487 | |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | $this->createMigrationTable(); |
516 | 516 | |
517 | 517 | $version = $this->connection->fetchColumn( |
518 | - 'SELECT ' . $this->migrationsColumnName . ' FROM ' . $this->migrationsTableName . ' WHERE ' . $this->migrationsColumnName . ' = ?', |
|
518 | + 'SELECT '.$this->migrationsColumnName.' FROM '.$this->migrationsTableName.' WHERE '.$this->migrationsColumnName.' = ?', |
|
519 | 519 | [$version->getVersion()] |
520 | 520 | ); |
521 | 521 | |
@@ -531,13 +531,13 @@ discard block |
||
531 | 531 | { |
532 | 532 | $this->createMigrationTable(); |
533 | 533 | |
534 | - if (! $this->migrationTableCreated && $this->isDryRun) { |
|
534 | + if (!$this->migrationTableCreated && $this->isDryRun) { |
|
535 | 535 | return []; |
536 | 536 | } |
537 | 537 | |
538 | 538 | $this->connect(); |
539 | 539 | |
540 | - $ret = $this->connection->fetchAll('SELECT ' . $this->migrationsColumnName . ' FROM ' . $this->migrationsTableName); |
|
540 | + $ret = $this->connection->fetchAll('SELECT '.$this->migrationsColumnName.' FROM '.$this->migrationsTableName); |
|
541 | 541 | |
542 | 542 | return array_map('current', $ret); |
543 | 543 | } |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | { |
572 | 572 | $this->createMigrationTable(); |
573 | 573 | |
574 | - if (! $this->migrationTableCreated && $this->isDryRun) { |
|
574 | + if (!$this->migrationTableCreated && $this->isDryRun) { |
|
575 | 575 | return '0'; |
576 | 576 | } |
577 | 577 | |
@@ -582,12 +582,12 @@ discard block |
||
582 | 582 | } |
583 | 583 | |
584 | 584 | $where = null; |
585 | - if (! empty($this->migrations)) { |
|
585 | + if (!empty($this->migrations)) { |
|
586 | 586 | $migratedVersions = []; |
587 | 587 | foreach ($this->migrations as $migration) { |
588 | 588 | $migratedVersions[] = sprintf("'%s'", $migration->getVersion()); |
589 | 589 | } |
590 | - $where = ' WHERE ' . $this->migrationsColumnName . ' IN (' . implode(', ', $migratedVersions) . ')'; |
|
590 | + $where = ' WHERE '.$this->migrationsColumnName.' IN ('.implode(', ', $migratedVersions).')'; |
|
591 | 591 | } |
592 | 592 | |
593 | 593 | $sql = sprintf( |
@@ -645,7 +645,7 @@ discard block |
||
645 | 645 | $versions = array_map('strval', array_keys($this->migrations)); |
646 | 646 | array_unshift($versions, '0'); |
647 | 647 | $offset = array_search((string) $version, $versions); |
648 | - if ($offset === false || ! isset($versions[$offset + $delta])) { |
|
648 | + if ($offset === false || !isset($versions[$offset + $delta])) { |
|
649 | 649 | // Unknown version or delta out of bounds. |
650 | 650 | return null; |
651 | 651 | } |
@@ -730,7 +730,7 @@ discard block |
||
730 | 730 | $this->connect(); |
731 | 731 | $this->createMigrationTable(); |
732 | 732 | |
733 | - $result = $this->connection->fetchColumn('SELECT COUNT(' . $this->migrationsColumnName . ') FROM ' . $this->migrationsTableName); |
|
733 | + $result = $this->connection->fetchColumn('SELECT COUNT('.$this->migrationsColumnName.') FROM '.$this->migrationsTableName); |
|
734 | 734 | |
735 | 735 | return $result !== false ? $result : 0; |
736 | 736 | } |
@@ -924,7 +924,7 @@ discard block |
||
924 | 924 | */ |
925 | 925 | private function ensureOrganizeMigrationsIsCompatibleWithFinder() |
926 | 926 | { |
927 | - if (! ($this->migrationFinder instanceof MigrationDeepFinderInterface)) { |
|
927 | + if (!($this->migrationFinder instanceof MigrationDeepFinderInterface)) { |
|
928 | 928 | throw MigrationException::configurationIncompatibleWithFinder( |
929 | 929 | 'organize-migrations', |
930 | 930 | $this->migrationFinder |
@@ -946,7 +946,7 @@ discard block |
||
946 | 946 | private function shouldExecuteMigration($direction, Version $version, $to, $migrated) |
947 | 947 | { |
948 | 948 | if ($direction === Version::DIRECTION_DOWN) { |
949 | - if (! in_array($version->getVersion(), $migrated)) { |
|
949 | + if (!in_array($version->getVersion(), $migrated)) { |
|
950 | 950 | return false; |
951 | 951 | } |
952 | 952 | |
@@ -969,7 +969,7 @@ discard block |
||
969 | 969 | */ |
970 | 970 | private function ensureMigrationClassExists($class) |
971 | 971 | { |
972 | - if (! class_exists($class)) { |
|
972 | + if (!class_exists($class)) { |
|
973 | 973 | throw MigrationException::migrationClassNotFound($class, $this->getMigrationsNamespace()); |
974 | 974 | } |
975 | 975 | } |
@@ -15,13 +15,13 @@ |
||
15 | 15 | */ |
16 | 16 | protected function doLoad($file) |
17 | 17 | { |
18 | - if (! class_exists(Yaml::class)) { |
|
18 | + if (!class_exists(Yaml::class)) { |
|
19 | 19 | throw MigrationException::yamlConfigurationNotAvailable(); |
20 | 20 | } |
21 | 21 | |
22 | 22 | $config = Yaml::parse(file_get_contents($file)); |
23 | 23 | |
24 | - if (! is_array($config)) { |
|
24 | + if (!is_array($config)) { |
|
25 | 25 | throw new \InvalidArgumentException('Not valid configuration.'); |
26 | 26 | } |
27 | 27 |
@@ -28,12 +28,12 @@ |
||
28 | 28 | return null; |
29 | 29 | } |
30 | 30 | |
31 | - if (! file_exists($this->filename)) { |
|
31 | + if (!file_exists($this->filename)) { |
|
32 | 32 | return null; |
33 | 33 | } |
34 | 34 | |
35 | 35 | $params = include $this->filename; |
36 | - if (! is_array($params)) { |
|
36 | + if (!is_array($params)) { |
|
37 | 37 | throw new \InvalidArgumentException('The connection file has to return an array with database configuration parameters.'); |
38 | 38 | } |
39 | 39 |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | protected function setConfiguration(array $config) |
47 | 47 | { |
48 | 48 | foreach ($config as $configurationKey => $configurationValue) { |
49 | - if (! isset($this->configurationProperties[$configurationKey])) { |
|
49 | + if (!isset($this->configurationProperties[$configurationKey])) { |
|
50 | 50 | $msg = sprintf('Migrations configuration key "%s" does not exist.', $configurationKey); |
51 | 51 | throw MigrationException::configurationNotValid($msg); |
52 | 52 | } |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | } elseif (strcasecmp($migrationOrganisation, static::VERSIONS_ORGANIZATION_BY_YEAR_AND_MONTH) === 0) { |
81 | 81 | $this->setMigrationsAreOrganizedByYearAndMonth(); |
82 | 82 | } else { |
83 | - $msg = 'Unknown ' . var_export($migrationOrganisation, true) . ' for configuration "organize_migrations".'; |
|
83 | + $msg = 'Unknown '.var_export($migrationOrganisation, true).' for configuration "organize_migrations".'; |
|
84 | 84 | throw MigrationException::configurationNotValid($msg); |
85 | 85 | } |
86 | 86 | } |
@@ -98,14 +98,14 @@ discard block |
||
98 | 98 | throw MigrationException::configurationFileAlreadyLoaded(); |
99 | 99 | } |
100 | 100 | |
101 | - $path = getcwd() . '/' . $file; |
|
101 | + $path = getcwd().'/'.$file; |
|
102 | 102 | |
103 | 103 | if (file_exists($path)) { |
104 | 104 | $file = $path; |
105 | 105 | } |
106 | 106 | $this->file = $file; |
107 | 107 | |
108 | - if (! file_exists($file)) { |
|
108 | + if (!file_exists($file)) { |
|
109 | 109 | throw new \InvalidArgumentException('Given config file does not exist'); |
110 | 110 | } |
111 | 111 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | |
116 | 116 | protected function getDirectoryRelativeToFile($file, $input) |
117 | 117 | { |
118 | - $path = realpath(dirname($file) . '/' . $input); |
|
118 | + $path = realpath(dirname($file).'/'.$input); |
|
119 | 119 | |
120 | 120 | return ($path !== false) ? $path : $input; |
121 | 121 | } |
@@ -17,7 +17,7 @@ |
||
17 | 17 | libxml_use_internal_errors(true); |
18 | 18 | $xml = new \DOMDocument(); |
19 | 19 | $xml->load($file); |
20 | - if (! $xml->schemaValidate(__DIR__ . DIRECTORY_SEPARATOR . 'XML' . DIRECTORY_SEPARATOR . 'configuration.xsd')) { |
|
20 | + if (!$xml->schemaValidate(__DIR__.DIRECTORY_SEPARATOR.'XML'.DIRECTORY_SEPARATOR.'configuration.xsd')) { |
|
21 | 21 | libxml_clear_errors(); |
22 | 22 | throw MigrationException::configurationNotValid('XML configuration did not pass the validation test.'); |
23 | 23 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $string = $this->buildMigrationFile($queriesByVersion, $direction); |
64 | 64 | |
65 | 65 | if ($this->outputWriter) { |
66 | - $this->outputWriter->write("\n" . sprintf('Writing migration file to "<info>%s</info>"', $path)); |
|
66 | + $this->outputWriter->write("\n".sprintf('Writing migration file to "<info>%s</info>"', $path)); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | return file_put_contents($path, $string); |
@@ -77,10 +77,10 @@ discard block |
||
77 | 77 | $string = sprintf("-- Doctrine Migration File Generated on %s\n", date('Y-m-d H:i:s')); |
78 | 78 | |
79 | 79 | foreach ($queriesByVersion as $version => $queries) { |
80 | - $string .= "\n-- Version " . $version . "\n"; |
|
80 | + $string .= "\n-- Version ".$version."\n"; |
|
81 | 81 | |
82 | 82 | foreach ($queries as $query) { |
83 | - $string .= $query . ";\n"; |
|
83 | + $string .= $query.";\n"; |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | $string .= $this->getVersionUpdateQuery($version, $direction); |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | |
107 | 107 | if (is_dir($path)) { |
108 | 108 | $path = realpath($path); |
109 | - $path = $path . '/doctrine_migration_' . date('YmdHis') . '.sql'; |
|
109 | + $path = $path.'/doctrine_migration_'.date('YmdHis').'.sql'; |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | return $path; |
@@ -18,7 +18,7 @@ |
||
18 | 18 | |
19 | 19 | public function __construct($em) |
20 | 20 | { |
21 | - if (! $this->isEntityManager($em)) { |
|
21 | + if (!$this->isEntityManager($em)) { |
|
22 | 22 | throw new \InvalidArgumentException(sprintf( |
23 | 23 | '$em is not a valid Doctrine ORM Entity Manager, got "%s"', |
24 | 24 | is_object($em) ? get_class($em) : gettype($em) |