Passed
Push — master ( 1ae6b2...04a456 )
by Joas
16:37 queued 01:49
created
lib/private/DB/MigrationService.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 		}
78 78
 
79 79
 		if ($appName === 'core') {
80
-			$this->migrationsPath = \OC::$SERVERROOT . '/core/Migrations';
80
+			$this->migrationsPath = \OC::$SERVERROOT.'/core/Migrations';
81 81
 			$this->migrationsNamespace = 'OC\\Core\\Migrations';
82 82
 			$this->checkOracle = true;
83 83
 		} else {
@@ -87,10 +87,10 @@  discard block
 block discarded – undo
87 87
 			$appPath = $appLocator->getAppPath($appName);
88 88
 			$namespace = App::buildAppNamespace($appName);
89 89
 			$this->migrationsPath = "$appPath/lib/Migration";
90
-			$this->migrationsNamespace = $namespace . '\\Migration';
90
+			$this->migrationsNamespace = $namespace.'\\Migration';
91 91
 
92 92
 			$infoParser = new InfoParser();
93
-			$info = $infoParser->parse($appPath . '/appinfo/info.xml');
93
+			$info = $infoParser->parse($appPath.'/appinfo/info.xml');
94 94
 			if (!isset($info['dependencies']['database'])) {
95 95
 				$this->checkOracle = true;
96 96
 			} else {
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 			\RegexIterator::GET_MATCH);
229 229
 
230 230
 		$files = array_keys(iterator_to_array($iterator));
231
-		uasort($files, function ($a, $b) {
231
+		uasort($files, function($a, $b) {
232 232
 			preg_match('/^Version(\d+)Date(\d+)\\.php$/', basename($a), $matchA);
233 233
 			preg_match('/^Version(\d+)Date(\d+)\\.php$/', basename($b), $matchB);
234 234
 			if (!empty($matchA) && !empty($matchB)) {
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 	 * @return string
307 307
 	 */
308 308
 	public function getMigrationsTableName() {
309
-		return $this->connection->getPrefix() . 'migrations';
309
+		return $this->connection->getPrefix().'migrations';
310 310
 	}
311 311
 
312 312
 	/**
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
 			} catch (DriverException $e) {
427 427
 				// The exception itself does not contain the name of the migration,
428 428
 				// so we wrap it here, to make debugging easier.
429
-				throw new \Exception('Database error when running migration ' . $to . ' for app ' . $this->getApp(), 0, $e);
429
+				throw new \Exception('Database error when running migration '.$to.' for app '.$this->getApp(), 0, $e);
430 430
 			}
431 431
 		}
432 432
 	}
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
 		foreach ($toBeExecuted as $version) {
450 450
 			$instance = $this->createInstance($version);
451 451
 
452
-			$toSchema = $instance->changeSchema($this->output, function () use ($toSchema) {
452
+			$toSchema = $instance->changeSchema($this->output, function() use ($toSchema) {
453 453
 				return $toSchema ?: new SchemaWrapper($this->connection);
454 454
 			}, ['tablePrefix' => $this->connection->getPrefix()]) ?: $toSchema;
455 455
 		}
@@ -522,12 +522,12 @@  discard block
 block discarded – undo
522 522
 		$instance = $this->createInstance($version);
523 523
 
524 524
 		if (!$schemaOnly) {
525
-			$instance->preSchemaChange($this->output, function () {
525
+			$instance->preSchemaChange($this->output, function() {
526 526
 				return new SchemaWrapper($this->connection);
527 527
 			}, ['tablePrefix' => $this->connection->getPrefix()]);
528 528
 		}
529 529
 
530
-		$toSchema = $instance->changeSchema($this->output, function () {
530
+		$toSchema = $instance->changeSchema($this->output, function() {
531 531
 			return new SchemaWrapper($this->connection);
532 532
 		}, ['tablePrefix' => $this->connection->getPrefix()]);
533 533
 
@@ -542,7 +542,7 @@  discard block
 block discarded – undo
542 542
 		}
543 543
 
544 544
 		if (!$schemaOnly) {
545
-			$instance->postSchemaChange($this->output, function () {
545
+			$instance->postSchemaChange($this->output, function() {
546 546
 				return new SchemaWrapper($this->connection);
547 547
 			}, ['tablePrefix' => $this->connection->getPrefix()]);
548 548
 		}
@@ -576,35 +576,35 @@  discard block
 block discarded – undo
576 576
 				$sourceTable = $sourceSchema->getTable($table->getName());
577 577
 			} catch (SchemaException $e) {
578 578
 				if (\strlen($table->getName()) - $prefixLength > 27) {
579
-					throw new \InvalidArgumentException('Table name "' . $table->getName() . '" is too long.');
579
+					throw new \InvalidArgumentException('Table name "'.$table->getName().'" is too long.');
580 580
 				}
581 581
 				$sourceTable = null;
582 582
 			}
583 583
 
584 584
 			foreach ($table->getColumns() as $thing) {
585 585
 				if ((!$sourceTable instanceof Table || !$sourceTable->hasColumn($thing->getName())) && \strlen($thing->getName()) > 30) {
586
-					throw new \InvalidArgumentException('Column name "' . $table->getName() . '"."' . $thing->getName() . '" is too long.');
586
+					throw new \InvalidArgumentException('Column name "'.$table->getName().'"."'.$thing->getName().'" is too long.');
587 587
 				}
588 588
 
589 589
 				if ((!$sourceTable instanceof Table || !$sourceTable->hasColumn($thing->getName())) && $thing->getNotnull() && $thing->getDefault() === ''
590 590
 					&& $sourceTable instanceof Table && !$sourceTable->hasColumn($thing->getName())) {
591
-					throw new \InvalidArgumentException('Column "' . $table->getName() . '"."' . $thing->getName() . '" is NotNull, but has empty string or null as default.');
591
+					throw new \InvalidArgumentException('Column "'.$table->getName().'"."'.$thing->getName().'" is NotNull, but has empty string or null as default.');
592 592
 				}
593 593
 
594 594
 				if ((!$sourceTable instanceof Table || !$sourceTable->hasColumn($thing->getName())) && $thing->getNotnull() && $thing->getType()->getName() === Types::BOOLEAN) {
595
-					throw new \InvalidArgumentException('Column "' . $table->getName() . '"."' . $thing->getName() . '" is type Bool and also NotNull, so it can not store "false".');
595
+					throw new \InvalidArgumentException('Column "'.$table->getName().'"."'.$thing->getName().'" is type Bool and also NotNull, so it can not store "false".');
596 596
 				}
597 597
 			}
598 598
 
599 599
 			foreach ($table->getIndexes() as $thing) {
600 600
 				if ((!$sourceTable instanceof Table || !$sourceTable->hasIndex($thing->getName())) && \strlen($thing->getName()) > 30) {
601
-					throw new \InvalidArgumentException('Index name "' . $table->getName() . '"."' . $thing->getName() . '" is too long.');
601
+					throw new \InvalidArgumentException('Index name "'.$table->getName().'"."'.$thing->getName().'" is too long.');
602 602
 				}
603 603
 			}
604 604
 
605 605
 			foreach ($table->getForeignKeys() as $thing) {
606 606
 				if ((!$sourceTable instanceof Table || !$sourceTable->hasForeignKey($thing->getName())) && \strlen($thing->getName()) > 30) {
607
-					throw new \InvalidArgumentException('Foreign key name "' . $table->getName() . '"."' . $thing->getName() . '" is too long.');
607
+					throw new \InvalidArgumentException('Foreign key name "'.$table->getName().'"."'.$thing->getName().'" is too long.');
608 608
 				}
609 609
 			}
610 610
 
@@ -614,34 +614,34 @@  discard block
 block discarded – undo
614 614
 				$isUsingDefaultName = $indexName === 'primary';
615 615
 
616 616
 				if ($this->connection->getDatabasePlatform() instanceof PostgreSQL94Platform) {
617
-					$defaultName = $table->getName() . '_pkey';
617
+					$defaultName = $table->getName().'_pkey';
618 618
 					$isUsingDefaultName = strtolower($defaultName) === $indexName;
619 619
 
620 620
 					if ($isUsingDefaultName) {
621
-						$sequenceName = $table->getName() . '_' . implode('_', $primaryKey->getColumns()) . '_seq';
622
-						$sequences = array_filter($sequences, function (Sequence $sequence) use ($sequenceName) {
621
+						$sequenceName = $table->getName().'_'.implode('_', $primaryKey->getColumns()).'_seq';
622
+						$sequences = array_filter($sequences, function(Sequence $sequence) use ($sequenceName) {
623 623
 							return $sequence->getName() !== $sequenceName;
624 624
 						});
625 625
 					}
626 626
 				} elseif ($this->connection->getDatabasePlatform() instanceof OraclePlatform) {
627
-					$defaultName = $table->getName() . '_seq';
627
+					$defaultName = $table->getName().'_seq';
628 628
 					$isUsingDefaultName = strtolower($defaultName) === $indexName;
629 629
 				}
630 630
 
631 631
 				if (!$isUsingDefaultName && \strlen($indexName) > 30) {
632
-					throw new \InvalidArgumentException('Primary index name on "' . $table->getName() . '" is too long.');
632
+					throw new \InvalidArgumentException('Primary index name on "'.$table->getName().'" is too long.');
633 633
 				}
634 634
 				if ($isUsingDefaultName && \strlen($table->getName()) - $prefixLength >= 23) {
635
-					throw new \InvalidArgumentException('Primary index name on "' . $table->getName() . '" is too long.');
635
+					throw new \InvalidArgumentException('Primary index name on "'.$table->getName().'" is too long.');
636 636
 				}
637 637
 			} elseif (!$primaryKey instanceof Index) {
638
-				throw new \InvalidArgumentException('Table "' . $table->getName() . '" has no primary key and therefor will not behave sane in clustered setups.');
638
+				throw new \InvalidArgumentException('Table "'.$table->getName().'" has no primary key and therefor will not behave sane in clustered setups.');
639 639
 			}
640 640
 		}
641 641
 
642 642
 		foreach ($sequences as $sequence) {
643 643
 			if (!$sourceSchema->hasSequence($sequence->getName()) && \strlen($sequence->getName()) > 30) {
644
-				throw new \InvalidArgumentException('Sequence name "' . $sequence->getName() . '" is too long.');
644
+				throw new \InvalidArgumentException('Sequence name "'.$sequence->getName().'" is too long.');
645 645
 			}
646 646
 		}
647 647
 	}
Please login to merge, or discard this patch.