Failed Conditions
Pull Request — master (#537)
by Luís
07:20
created
lib/Doctrine/DBAL/Migrations/Finder/GlobFinder.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
lib/Doctrine/DBAL/Migrations/Tools/Console/Command/MigrateCommand.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -177,7 +177,7 @@
 block discarded – undo
177 177
      * @param string $versionAlias
178 178
      * @param OutputInterface $output
179 179
      * @param Configuration $configuration
180
-     * @return bool|string
180
+     * @return false|string
181 181
      */
182 182
     private function getVersionNameFromAlias($versionAlias, OutputInterface $output, Configuration $configuration)
183 183
     {
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
             }
115 115
 
116 116
             $question = 'Are you sure you wish to continue? (y/n)';
117
-            if (! $this->canExecute($question, $input, $output)) {
117
+            if (!$this->canExecute($question, $input, $output)) {
118 118
                 $output->writeln('<error>Migration cancelled!</error>');
119 119
 
120 120
                 return 1;
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 
132 132
         $cancelled = false;
133 133
         $migration->setNoMigrationException($input->getOption('allow-no-migration'));
134
-        $result = $migration->migrate($version, $dryRun, $timeAllqueries, function () use ($input, $output, &$cancelled) {
134
+        $result = $migration->migrate($version, $dryRun, $timeAllqueries, function() use ($input, $output, &$cancelled) {
135 135
             $question = 'WARNING! You are about to execute a database migration'
136 136
                 . ' that could result in schema changes and data lost.'
137 137
                 . ' Are you sure you wish to continue? (y/n)';
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
      */
167 167
     private function canExecute($question, InputInterface $input, OutputInterface $output)
168 168
     {
169
-        if ($input->isInteractive() && ! $this->askConfirmation($question, $input, $output)) {
169
+        if ($input->isInteractive() && !$this->askConfirmation($question, $input, $output)) {
170 170
             return false;
171 171
         }
172 172
 
Please login to merge, or discard this patch.
lib/Doctrine/DBAL/Migrations/Configuration/Configuration.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
         $this->createMigrationTable();
502 502
 
503 503
         $version = $this->connection->fetchColumn(
504
-            "SELECT " . $this->migrationsColumnName . " FROM " . $this->migrationsTableName . " WHERE " . $this->migrationsColumnName . " = ?",
504
+            "SELECT ".$this->migrationsColumnName." FROM ".$this->migrationsTableName." WHERE ".$this->migrationsColumnName." = ?",
505 505
             [$version->getVersion()]
506 506
         );
507 507
 
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
         $this->connect();
519 519
         $this->createMigrationTable();
520 520
 
521
-        $ret = $this->connection->fetchAll("SELECT " . $this->migrationsColumnName . " FROM " . $this->migrationsTableName);
521
+        $ret = $this->connection->fetchAll("SELECT ".$this->migrationsColumnName." FROM ".$this->migrationsTableName);
522 522
 
523 523
         return array_map('current', $ret);
524 524
     }
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
             foreach ($this->migrations as $migration) {
564 564
                 $migratedVersions[] = sprintf("'%s'", $migration->getVersion());
565 565
             }
566
-            $where = " WHERE " . $this->migrationsColumnName . " IN (" . implode(', ', $migratedVersions) . ")";
566
+            $where = " WHERE ".$this->migrationsColumnName." IN (".implode(', ', $migratedVersions).")";
567 567
         }
568 568
 
569 569
         $sql = sprintf("SELECT %s FROM %s%s ORDER BY %s DESC",
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
 
614 614
         $versions = array_map('strval', array_keys($this->migrations));
615 615
         array_unshift($versions, '0');
616
-        $offset = array_search((string)$version, $versions);
616
+        $offset = array_search((string) $version, $versions);
617 617
         if ($offset === false || !isset($versions[$offset + $delta])) {
618 618
             // Unknown version or delta out of bounds.
619 619
             return null;
@@ -670,7 +670,7 @@  discard block
 block discarded – undo
670 670
         $this->connect();
671 671
         $this->createMigrationTable();
672 672
 
673
-        $result = $this->connection->fetchColumn("SELECT COUNT(" . $this->migrationsColumnName . ") FROM " . $this->migrationsTableName);
673
+        $result = $this->connection->fetchColumn("SELECT COUNT(".$this->migrationsColumnName.") FROM ".$this->migrationsTableName);
674 674
 
675 675
         return $result !== false ? $result : 0;
676 676
     }
@@ -781,7 +781,7 @@  discard block
 block discarded – undo
781 781
      * @param string $eventName The event to emit.
782 782
      * @param $args The event args instance to emit.
783 783
      */
784
-    public function dispatchEvent($eventName, EventArgs $args=null)
784
+    public function dispatchEvent($eventName, EventArgs $args = null)
785 785
     {
786 786
         $this->connection->getEventManager()->dispatchEvent($eventName, $args);
787 787
     }
@@ -826,7 +826,7 @@  discard block
 block discarded – undo
826 826
      * @param DateTimeInterface|null $now Defaults to the current time in UTC
827 827
      * @return string The newly generated version
828 828
      */
829
-    public function generateVersionNumber(\DateTimeInterface $now=null)
829
+    public function generateVersionNumber(\DateTimeInterface $now = null)
830 830
     {
831 831
         $now = $now ?: new \DateTime('now', new \DateTimeZone('UTC'));
832 832
 
@@ -899,7 +899,7 @@  discard block
 block discarded – undo
899 899
      */
900 900
     private function ensureMigrationClassExists($class)
901 901
     {
902
-        if ( ! class_exists($class)) {
902
+        if (!class_exists($class)) {
903 903
             throw MigrationException::migrationClassNotFound($class, $this->getMigrationsNamespace());
904 904
         }
905 905
     }
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.');
120 120
 
121 121
             return;
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
         $output->writeln(file_get_contents($path));
129 129
     }
130 130
 
131
-    private function buildCodeFromSql(Configuration $configuration, array $sql, $formatted=false, $lineLength=120)
131
+    private function buildCodeFromSql(Configuration $configuration, array $sql, $formatted = false, $lineLength = 120)
132 132
     {
133 133
         $currentPlatform = $configuration->getConnection()->getDatabasePlatform()->getName();
134 134
         $code = [];
Please login to merge, or discard this patch.
Configuration/Connection/Loader/ConnectionConfigurationChainLoader.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
      */
42 42
     public function chosen()
43 43
     {
44
-        foreach($this->loaders as $loader) {
44
+        foreach ($this->loaders as $loader) {
45 45
             if (null !== $confObj = $loader->chosen()) {
46 46
                 return $confObj;
47 47
             }
Please login to merge, or discard this patch.
lib/Doctrine/DBAL/Migrations/Tools/Console/Command/StatusCommand.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -64,10 +64,10 @@  discard block
 block discarded – undo
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
-            if($name == 'Executed Unavailable Migrations') {
70
-                $value = $value > 0 ? '<error>' . $value . '</error>' : 0;
69
+            if ($name == 'Executed Unavailable Migrations') {
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
 block discarded – undo
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,27 +91,27 @@  discard block
 block discarded – undo
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)
98 98
     {
99 99
         $migratedVersions = $configuration->getMigratedVersions();
100 100
 
101
-        foreach($migrations as $version) {
101
+        foreach ($migrations as $version) {
102 102
             $isMigrated = in_array($version->getVersion(), $migratedVersions);
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
 }
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 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
                 ));
@@ -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.
lib/Doctrine/DBAL/Migrations/Version.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
     /** @var SchemaDiffProviderInterface */
104 104
     private $schemaProvider;
105 105
 
106
-    public function __construct(Configuration $configuration, $version, $class, SchemaDiffProviderInterface $schemaProvider=null)
106
+    public function __construct(Configuration $configuration, $version, $class, SchemaDiffProviderInterface $schemaProvider = null)
107 107
     {
108 108
         $this->configuration = $configuration;
109 109
         $this->outputWriter = $configuration->getOutputWriter();
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
         if ($schemaProvider !== null) {
116 116
             $this->schemaProvider = $schemaProvider;
117 117
         }
118
-        if($schemaProvider === null) {
118
+        if ($schemaProvider === null) {
119 119
             $schemaProvider = new SchemaDiffProvider($this->connection->getSchemaManager(),
120 120
                 $this->connection->getDatabasePlatform());
121 121
             $this->schemaProvider = LazySchemaDiffProvider::fromDefaultProxyFactoryConfiguration($schemaProvider);
@@ -221,11 +221,11 @@  discard block
 block discarded – undo
221 221
     {
222 222
         $queries = $this->execute($direction, true);
223 223
 
224
-        if ( ! empty($this->params)) {
224
+        if (!empty($this->params)) {
225 225
             throw MigrationException::migrationNotConvertibleToSql($this->class);
226 226
         }
227 227
 
228
-        $this->outputWriter->write("\n-- Version " . $this->version . "\n");
228
+        $this->outputWriter->write("\n-- Version ".$this->version."\n");
229 229
 
230 230
         $sqlQueries = [$this->version => $queries];
231 231
 
@@ -284,12 +284,12 @@  discard block
 block discarded – undo
284 284
             $this->state = self::STATE_PRE;
285 285
             $fromSchema = $this->schemaProvider->createFromSchema();
286 286
 
287
-            $this->migration->{'pre' . ucfirst($direction)}($fromSchema);
287
+            $this->migration->{'pre'.ucfirst($direction)}($fromSchema);
288 288
 
289 289
             if ($direction === self::DIRECTION_UP) {
290
-                $this->outputWriter->write("\n" . sprintf('  <info>++</info> migrating <comment>%s</comment>', $this->version) . "\n");
290
+                $this->outputWriter->write("\n".sprintf('  <info>++</info> migrating <comment>%s</comment>', $this->version)."\n");
291 291
             } else {
292
-                $this->outputWriter->write("\n" . sprintf('  <info>--</info> reverting <comment>%s</comment>', $this->version) . "\n");
292
+                $this->outputWriter->write("\n".sprintf('  <info>--</info> reverting <comment>%s</comment>', $this->version)."\n");
293 293
             }
294 294
 
295 295
             $this->state = self::STATE_EXEC;
@@ -302,9 +302,9 @@  discard block
 block discarded – undo
302 302
             $this->executeRegisteredSql($dryRun, $timeAllQueries);
303 303
 
304 304
             $this->state = self::STATE_POST;
305
-            $this->migration->{'post' . ucfirst($direction)}($toSchema);
305
+            $this->migration->{'post'.ucfirst($direction)}($toSchema);
306 306
 
307
-            if (! $dryRun) {
307
+            if (!$dryRun) {
308 308
                 if ($direction === self::DIRECTION_UP) {
309 309
                     $this->markMigrated();
310 310
                 } else {
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
                 }
346 346
             }
347 347
 
348
-            $this->outputWriter->write(sprintf("\n  <info>SS</info> skipped (Reason: %s)",  $e->getMessage()));
348
+            $this->outputWriter->write(sprintf("\n  <info>SS</info> skipped (Reason: %s)", $e->getMessage()));
349 349
 
350 350
             $this->state = self::STATE_NONE;
351 351
 
@@ -411,13 +411,13 @@  discard block
 block discarded – undo
411 411
 
412 412
     private function executeRegisteredSql($dryRun = false, $timeAllQueries = false)
413 413
     {
414
-        if (! $dryRun) {
414
+        if (!$dryRun) {
415 415
             if (!empty($this->sql)) {
416 416
                 foreach ($this->sql as $key => $query) {
417 417
                     $queryStart = microtime(true);
418 418
 
419
-                    if ( ! isset($this->params[$key])) {
420
-                        $this->outputWriter->write('     <comment>-></comment> ' . $query);
419
+                    if (!isset($this->params[$key])) {
420
+                        $this->outputWriter->write('     <comment>-></comment> '.$query);
421 421
                         $this->connection->executeQuery($query);
422 422
                     } else {
423 423
                         $this->outputWriter->write(sprintf('    <comment>-</comment> %s (with parameters)', $query));
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -234,7 +234,7 @@
 block discarded – undo
234 234
          * properly, so I had to violate LoD here (so please, let's find a way to solve it on v2).
235 235
          */
236 236
         return $this->configuration->getQueryWriter()
237
-                                   ->write($path, $direction, $sqlQueries);
237
+                                    ->write($path, $direction, $sqlQueries);
238 238
     }
239 239
 
240 240
     /**
Please login to merge, or discard this patch.
lib/Doctrine/DBAL/Migrations/Tools/Console/Command/AbstractCommand.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -77,10 +77,10 @@
 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
 
Please login to merge, or discard this patch.