Completed
Pull Request — master (#464)
by Michele
06:54
created
lib/Doctrine/DBAL/Migrations/Tools/Console/Command/AbstractCommand.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -77,10 +77,10 @@  discard block
 block discarded – undo
77 77
     {
78 78
         $name = $configuration->getName();
79 79
         $name = $name ? $name : 'Doctrine Database Migrations';
80
-        $name = str_repeat(' ', 20) . $name . str_repeat(' ', 20);
81
-        $output->writeln('<question>' . str_repeat(' ', strlen($name)) . '</question>');
82
-        $output->writeln('<question>' . $name . '</question>');
83
-        $output->writeln('<question>' . str_repeat(' ', strlen($name)) . '</question>');
80
+        $name = str_repeat(' ', 20).$name.str_repeat(' ', 20);
81
+        $output->writeln('<question>'.str_repeat(' ', strlen($name)).'</question>');
82
+        $output->writeln('<question>'.$name.'</question>');
83
+        $output->writeln('<question>'.str_repeat(' ', strlen($name)).'</question>');
84 84
         $output->writeln('');
85 85
     }
86 86
 
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
     protected function askConfirmation($question, InputInterface $input, OutputInterface $output)
129 129
     {
130 130
         if (!$this->getHelperSet()->has('question')) {
131
-            return $this->getHelper('dialog')->askConfirmation($output, '<question>' . $question . '</question>', false);
131
+            return $this->getHelper('dialog')->askConfirmation($output, '<question>'.$question.'</question>', false);
132 132
         }
133 133
 
134 134
         return $this->getHelper('question')->ask($input, $output, new ConfirmationQuestion($question));
Please login to merge, or discard this patch.
lib/Doctrine/DBAL/Migrations/Tools/Console/Command/GenerateCommand.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -116,19 +116,19 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
lib/Doctrine/DBAL/Migrations/Tools/Console/Command/DiffCommand.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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 = [];
Please login to merge, or discard this patch.
lib/Doctrine/DBAL/Migrations/Configuration/XmlConfiguration.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
lib/Doctrine/DBAL/Migrations/Configuration/Configuration.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
         $this->createMigrationTable();
494 494
 
495 495
         $version = $this->connection->fetchColumn(
496
-            "SELECT " . $this->migrationsColumnName . " FROM " . $this->migrationsTableName . " WHERE " . $this->migrationsColumnName . " = ?",
496
+            "SELECT ".$this->migrationsColumnName." FROM ".$this->migrationsTableName." WHERE ".$this->migrationsColumnName." = ?",
497 497
             [$version->getVersion()]
498 498
         );
499 499
 
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
     {
510 510
         $this->createMigrationTable();
511 511
 
512
-        $ret = $this->connection->fetchAll("SELECT " . $this->migrationsColumnName . " FROM " . $this->migrationsTableName);
512
+        $ret = $this->connection->fetchAll("SELECT ".$this->migrationsColumnName." FROM ".$this->migrationsTableName);
513 513
 
514 514
         return array_map('current', $ret);
515 515
     }
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
             foreach ($this->migrations as $migration) {
554 554
                 $migratedVersions[] = sprintf("'%s'", $migration->getVersion());
555 555
             }
556
-            $where = " WHERE " . $this->migrationsColumnName . " IN (" . implode(', ', $migratedVersions) . ")";
556
+            $where = " WHERE ".$this->migrationsColumnName." IN (".implode(', ', $migratedVersions).")";
557 557
         }
558 558
 
559 559
         $sql = sprintf("SELECT %s FROM %s%s ORDER BY %s DESC",
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
     {
660 660
         $this->createMigrationTable();
661 661
 
662
-        $result = $this->connection->fetchColumn("SELECT COUNT(" . $this->migrationsColumnName . ") FROM " . $this->migrationsTableName);
662
+        $result = $this->connection->fetchColumn("SELECT COUNT(".$this->migrationsColumnName.") FROM ".$this->migrationsTableName);
663 663
 
664 664
         return $result !== false ? $result : 0;
665 665
     }
@@ -845,7 +845,7 @@  discard block
 block discarded – undo
845 845
      */
846 846
     private function ensureMigrationClassExists($class)
847 847
     {
848
-        if ( ! class_exists($class)) {
848
+        if (!class_exists($class)) {
849 849
             throw MigrationException::migrationClassNotFound($class, $this->getMigrationsNamespace());
850 850
         }
851 851
     }
Please login to merge, or discard this patch.
lib/Doctrine/DBAL/Migrations/Configuration/AbstractFileConfiguration.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -61,13 +61,13 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
lib/Doctrine/DBAL/Migrations/Version.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
     /** @var SchemaDiffProviderInterface */
102 102
     private $schemaProvider;
103 103
 
104
-    public function __construct(Configuration $configuration, $version, $class, SchemaDiffProviderInterface $schemaProvider=null)
104
+    public function __construct(Configuration $configuration, $version, $class, SchemaDiffProviderInterface $schemaProvider = null)
105 105
     {
106 106
         $this->configuration = $configuration;
107 107
         $this->outputWriter = $configuration->getOutputWriter();
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
         if ($schemaProvider !== null) {
114 114
             $this->schemaProvider = $schemaProvider;
115 115
         }
116
-        if($schemaProvider === null) {
116
+        if ($schemaProvider === null) {
117 117
             $schemaProvider = new SchemaDiffProvider($this->connection->getSchemaManager(),
118 118
                 $this->connection->getDatabasePlatform());
119 119
             $this->schemaProvider = LazySchemaDiffProvider::fromDefaultProxyFacyoryConfiguration($schemaProvider);
@@ -219,11 +219,11 @@  discard block
 block discarded – undo
219 219
     {
220 220
         $queries = $this->execute($direction, true);
221 221
 
222
-        if ( ! empty($this->params)) {
222
+        if (!empty($this->params)) {
223 223
             throw MigrationException::migrationNotConvertibleToSql($this->class);
224 224
         }
225 225
 
226
-        $this->outputWriter->write("\n# Version " . $this->version . "\n");
226
+        $this->outputWriter->write("\n# Version ".$this->version."\n");
227 227
 
228 228
         $sqlQueries = [$this->version => $queries];
229 229
         $sqlWriter = new SqlFileWriter(
@@ -275,12 +275,12 @@  discard block
 block discarded – undo
275 275
             $this->state = self::STATE_PRE;
276 276
             $fromSchema = $this->schemaProvider->createFromSchema();
277 277
 
278
-            $this->migration->{'pre' . ucfirst($direction)}($fromSchema);
278
+            $this->migration->{'pre'.ucfirst($direction)}($fromSchema);
279 279
 
280 280
             if ($direction === self::DIRECTION_UP) {
281
-                $this->outputWriter->write("\n" . sprintf('  <info>++</info> migrating <comment>%s</comment>', $this->version) . "\n");
281
+                $this->outputWriter->write("\n".sprintf('  <info>++</info> migrating <comment>%s</comment>', $this->version)."\n");
282 282
             } else {
283
-                $this->outputWriter->write("\n" . sprintf('  <info>--</info> reverting <comment>%s</comment>', $this->version) . "\n");
283
+                $this->outputWriter->write("\n".sprintf('  <info>--</info> reverting <comment>%s</comment>', $this->version)."\n");
284 284
             }
285 285
 
286 286
             $this->state = self::STATE_EXEC;
@@ -293,9 +293,9 @@  discard block
 block discarded – undo
293 293
             $this->executeRegisteredSql($dryRun, $timeAllQueries);
294 294
 
295 295
             $this->state = self::STATE_POST;
296
-            $this->migration->{'post' . ucfirst($direction)}($toSchema);
296
+            $this->migration->{'post'.ucfirst($direction)}($toSchema);
297 297
 
298
-            if (! $dryRun) {
298
+            if (!$dryRun) {
299 299
                 if ($direction === self::DIRECTION_UP) {
300 300
                     $this->markMigrated();
301 301
                 } else {
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
                 }
335 335
             }
336 336
 
337
-            $this->outputWriter->write(sprintf("\n  <info>SS</info> skipped (Reason: %s)",  $e->getMessage()));
337
+            $this->outputWriter->write(sprintf("\n  <info>SS</info> skipped (Reason: %s)", $e->getMessage()));
338 338
 
339 339
             $this->state = self::STATE_NONE;
340 340
 
@@ -397,13 +397,13 @@  discard block
 block discarded – undo
397 397
 
398 398
     private function executeRegisteredSql($dryRun = false, $timeAllQueries = false)
399 399
     {
400
-        if (! $dryRun) {
400
+        if (!$dryRun) {
401 401
             if (!empty($this->sql)) {
402 402
                 foreach ($this->sql as $key => $query) {
403 403
                     $queryStart = microtime(true);
404 404
 
405
-                    if ( ! isset($this->params[$key])) {
406
-                        $this->outputWriter->write('     <comment>-></comment> ' . $query);
405
+                    if (!isset($this->params[$key])) {
406
+                        $this->outputWriter->write('     <comment>-></comment> '.$query);
407 407
                         $this->connection->executeQuery($query);
408 408
                     } else {
409 409
                         $this->outputWriter->write(sprintf('    <comment>-</comment> %s (with parameters)', $query));
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
             }
421 421
         } else {
422 422
             foreach ($this->sql as $query) {
423
-                $this->outputWriter->write('     <comment>-></comment> ' . $query);
423
+                $this->outputWriter->write('     <comment>-></comment> '.$query);
424 424
             }
425 425
         }
426 426
     }
Please login to merge, or discard this patch.
lib/Doctrine/DBAL/Migrations/MigrationsVersion.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,6 +40,6 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
lib/Doctrine/DBAL/Migrations/Finder/AbstractFinder.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.