Completed
Pull Request — 2.7 (#7875)
by
unknown
09:25 queued 19s
created
tests/Doctrine/Tests/ORM/Functional/SchemaTool/MySqlSchemaToolTest.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
         parent::setUp();
20 20
 
21 21
         if ($this->_em->getConnection()->getDatabasePlatform()->getName() !== 'mysql') {
22
-            $this->markTestSkipped('The ' . __CLASS__ .' requires the use of mysql.');
22
+            $this->markTestSkipped('The '.__CLASS__.' requires the use of mysql.');
23 23
         }
24 24
     }
25 25
 
@@ -46,14 +46,14 @@  discard block
 block discarded – undo
46 46
         $sql = $tool->getCreateSchemaSql($classes);
47 47
         $collation = $this->getColumnCollationDeclarationSQL('utf8_unicode_ci');
48 48
 
49
-        $this->assertEquals('CREATE TABLE cms_groups (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(50) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 ' . $collation . ' ENGINE = InnoDB', $sql[0]);
50
-        $this->assertEquals('CREATE TABLE cms_users (id INT AUTO_INCREMENT NOT NULL, email_id INT DEFAULT NULL, status VARCHAR(50) DEFAULT NULL, username VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_3AF03EC5F85E0677 (username), UNIQUE INDEX UNIQ_3AF03EC5A832C1C9 (email_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 ' . $collation . ' ENGINE = InnoDB', $sql[1]);
51
-        $this->assertEquals('CREATE TABLE cms_users_groups (user_id INT NOT NULL, group_id INT NOT NULL, INDEX IDX_7EA9409AA76ED395 (user_id), INDEX IDX_7EA9409AFE54D947 (group_id), PRIMARY KEY(user_id, group_id)) DEFAULT CHARACTER SET utf8 ' . $collation . ' ENGINE = InnoDB', $sql[2]);
52
-        $this->assertEquals('CREATE TABLE cms_users_tags (user_id INT NOT NULL, tag_id INT NOT NULL, INDEX IDX_93F5A1ADA76ED395 (user_id), INDEX IDX_93F5A1ADBAD26311 (tag_id), PRIMARY KEY(user_id, tag_id)) DEFAULT CHARACTER SET utf8 ' . $collation . ' ENGINE = InnoDB', $sql[3]);
53
-        $this->assertEquals('CREATE TABLE cms_tags (id INT AUTO_INCREMENT NOT NULL, tag_name VARCHAR(50) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 ' . $collation . ' ENGINE = InnoDB', $sql[4]);
54
-        $this->assertEquals('CREATE TABLE cms_addresses (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, country VARCHAR(50) NOT NULL, zip VARCHAR(50) NOT NULL, city VARCHAR(50) NOT NULL, UNIQUE INDEX UNIQ_ACAC157BA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 ' . $collation . ' ENGINE = InnoDB', $sql[5]);
55
-        $this->assertEquals('CREATE TABLE cms_emails (id INT AUTO_INCREMENT NOT NULL, email VARCHAR(250) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 ' . $collation . ' ENGINE = InnoDB', $sql[6]);
56
-        $this->assertEquals('CREATE TABLE cms_phonenumbers (phonenumber VARCHAR(50) NOT NULL, user_id INT DEFAULT NULL, INDEX IDX_F21F790FA76ED395 (user_id), PRIMARY KEY(phonenumber)) DEFAULT CHARACTER SET utf8 ' . $collation . ' ENGINE = InnoDB', $sql[7]);
49
+        $this->assertEquals('CREATE TABLE cms_groups (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(50) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 '.$collation.' ENGINE = InnoDB', $sql[0]);
50
+        $this->assertEquals('CREATE TABLE cms_users (id INT AUTO_INCREMENT NOT NULL, email_id INT DEFAULT NULL, status VARCHAR(50) DEFAULT NULL, username VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_3AF03EC5F85E0677 (username), UNIQUE INDEX UNIQ_3AF03EC5A832C1C9 (email_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 '.$collation.' ENGINE = InnoDB', $sql[1]);
51
+        $this->assertEquals('CREATE TABLE cms_users_groups (user_id INT NOT NULL, group_id INT NOT NULL, INDEX IDX_7EA9409AA76ED395 (user_id), INDEX IDX_7EA9409AFE54D947 (group_id), PRIMARY KEY(user_id, group_id)) DEFAULT CHARACTER SET utf8 '.$collation.' ENGINE = InnoDB', $sql[2]);
52
+        $this->assertEquals('CREATE TABLE cms_users_tags (user_id INT NOT NULL, tag_id INT NOT NULL, INDEX IDX_93F5A1ADA76ED395 (user_id), INDEX IDX_93F5A1ADBAD26311 (tag_id), PRIMARY KEY(user_id, tag_id)) DEFAULT CHARACTER SET utf8 '.$collation.' ENGINE = InnoDB', $sql[3]);
53
+        $this->assertEquals('CREATE TABLE cms_tags (id INT AUTO_INCREMENT NOT NULL, tag_name VARCHAR(50) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 '.$collation.' ENGINE = InnoDB', $sql[4]);
54
+        $this->assertEquals('CREATE TABLE cms_addresses (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, country VARCHAR(50) NOT NULL, zip VARCHAR(50) NOT NULL, city VARCHAR(50) NOT NULL, UNIQUE INDEX UNIQ_ACAC157BA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 '.$collation.' ENGINE = InnoDB', $sql[5]);
55
+        $this->assertEquals('CREATE TABLE cms_emails (id INT AUTO_INCREMENT NOT NULL, email VARCHAR(250) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 '.$collation.' ENGINE = InnoDB', $sql[6]);
56
+        $this->assertEquals('CREATE TABLE cms_phonenumbers (phonenumber VARCHAR(50) NOT NULL, user_id INT DEFAULT NULL, INDEX IDX_F21F790FA76ED395 (user_id), PRIMARY KEY(phonenumber)) DEFAULT CHARACTER SET utf8 '.$collation.' ENGINE = InnoDB', $sql[7]);
57 57
         $this->assertEquals("ALTER TABLE cms_users ADD CONSTRAINT FK_3AF03EC5A832C1C9 FOREIGN KEY (email_id) REFERENCES cms_emails (id)", $sql[8]);
58 58
         $this->assertEquals("ALTER TABLE cms_users_groups ADD CONSTRAINT FK_7EA9409AA76ED395 FOREIGN KEY (user_id) REFERENCES cms_users (id)", $sql[9]);
59 59
         $this->assertEquals("ALTER TABLE cms_users_groups ADD CONSTRAINT FK_7EA9409AFE54D947 FOREIGN KEY (group_id) REFERENCES cms_groups (id)", $sql[10]);
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
         $collation = $this->getColumnCollationDeclarationSQL('utf8_unicode_ci');
86 86
 
87 87
         $this->assertEquals(1, count($sql));
88
-        $this->assertEquals('CREATE TABLE decimal_model (id INT AUTO_INCREMENT NOT NULL, `decimal` NUMERIC(5, 2) NOT NULL, `high_scale` NUMERIC(14, 4) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 ' . $collation . ' ENGINE = InnoDB', $sql[0]);
88
+        $this->assertEquals('CREATE TABLE decimal_model (id INT AUTO_INCREMENT NOT NULL, `decimal` NUMERIC(5, 2) NOT NULL, `high_scale` NUMERIC(14, 4) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 '.$collation.' ENGINE = InnoDB', $sql[0]);
89 89
     }
90 90
 
91 91
     public function testGetCreateSchemaSql3()
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
         $collation = $this->getColumnCollationDeclarationSQL('utf8_unicode_ci');
100 100
 
101 101
         $this->assertEquals(1, count($sql));
102
-        $this->assertEquals('CREATE TABLE boolean_model (id INT AUTO_INCREMENT NOT NULL, booleanField TINYINT(1) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 ' . $collation . ' ENGINE = InnoDB', $sql[0]);
102
+        $this->assertEquals('CREATE TABLE boolean_model (id INT AUTO_INCREMENT NOT NULL, booleanField TINYINT(1) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 '.$collation.' ENGINE = InnoDB', $sql[0]);
103 103
     }
104 104
 
105 105
     /**
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
             ['/^(?!entity_to_r)/', null],
147 147
             [
148 148
                 null,
149
-                static function ($assetName) : bool {
149
+                static function($assetName) : bool {
150 150
                     return $assetName !== 'entity_to_remove';
151 151
                 },
152 152
             ],
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 
188 188
     private function filterSqls(array $sqls, array $needles) : array
189 189
     {
190
-        return array_filter($sqls, static function ($sql) use ($needles) {
190
+        return array_filter($sqls, static function($sql) use ($needles) {
191 191
             foreach ($needles as $needle) {
192 192
                 if (strpos($sql, $needle) !== false) {
193 193
                     return true;
Please login to merge, or discard this patch.
tests/Doctrine/Tests/ORM/Functional/SchemaTool/SqliteSchemaToolTest.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
         parent::setUp();
21 21
 
22 22
         if ($this->_em->getConnection()->getDatabasePlatform()->getName() !== 'sqlite') {
23
-            $this->markTestSkipped('The ' . self::class . ' requires the use of sqlite.');
23
+            $this->markTestSkipped('The '.self::class.' requires the use of sqlite.');
24 24
         }
25 25
     }
26 26
 
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 
35 35
     private function filterCreateTable(array $sqls, string $tableName) : array
36 36
     {
37
-        return array_filter($sqls, static function (string $sql) use ($tableName) : bool {
37
+        return array_filter($sqls, static function(string $sql) use ($tableName) : bool {
38 38
             return strpos($sql, sprintf('CREATE TABLE %s (', $tableName)) === 0;
39 39
         });
40 40
     }
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 
52 52
         $this->_em->getConnection()->exec(current($sqls));
53 53
         $sqls = $tool->getUpdateSchemaSql($classes);
54
-        $sqls = array_filter($sqls, static function (string $sql) : bool {
54
+        $sqls = array_filter($sqls, static function(string $sql) : bool {
55 55
             return (bool) strpos($sql, 'my_entity');
56 56
         });
57 57
         $this->assertCount(0, $sqls);
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
             ['/^(?!my_enti)/', null],
69 69
             [
70 70
                 null,
71
-                static function ($assetName) : bool {
71
+                static function($assetName) : bool {
72 72
                     return $assetName !== 'my_entity';
73 73
                 },
74 74
             ],
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
         }
98 98
 
99 99
         $sqls = $tool->getUpdateSchemaSql($classes);
100
-        $sqls = array_filter($sqls, static function (string $sql) : bool {
100
+        $sqls = array_filter($sqls, static function(string $sql) : bool {
101 101
             return (bool) strpos($sql, 'my_entity');
102 102
         });
103 103
         self::assertCount(0, $sqls);
Please login to merge, or discard this patch.
tests/Doctrine/Tests/ORM/Functional/SchemaTool/PostgreSqlSchemaToolTest.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
         parent::setUp();
19 19
 
20 20
         if ($this->_em->getConnection()->getDatabasePlatform()->getName() !== 'postgresql') {
21
-            $this->markTestSkipped('The ' . __CLASS__ .' requires the use of postgresql.');
21
+            $this->markTestSkipped('The '.__CLASS__.' requires the use of postgresql.');
22 22
         }
23 23
     }
24 24
 
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
             ['/^(?!pg_entity_to_r)/', null],
154 154
             [
155 155
                 null,
156
-                static function ($assetName) : bool {
156
+                static function($assetName) : bool {
157 157
                     return $assetName !== 'pg_entity_to_remove';
158 158
                 },
159 159
             ],
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
         }
183 183
 
184 184
         $sqls = $tool->getUpdateSchemaSql($classes);
185
-        $sqls = array_filter($sqls, static function ($sql) {
185
+        $sqls = array_filter($sqls, static function($sql) {
186 186
             return strpos($sql, 'pg_entity_to_remove') !== false;
187 187
         });
188 188
         self::assertCount(0, $sqls);
Please login to merge, or discard this patch.
lib/Doctrine/ORM/Tools/SchemaTool.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
                             $targetEntity = current(
229 229
                                 array_filter(
230 230
                                     $classes,
231
-                                    function (ClassMetadata $class) use ($idMapping) : bool {
231
+                                    function(ClassMetadata $class) use ($idMapping) : bool {
232 232
                                         return $class->name === $idMapping['targetEntity'];
233 233
                                     }
234 234
                                 )
@@ -648,8 +648,8 @@  discard block
 block discarded – undo
648 648
 
649 649
             if ( ! $definingClass) {
650 650
                 throw new \Doctrine\ORM\ORMException(
651
-                    'Column name `' . $joinColumn['referencedColumnName'] . '` referenced for relation from '
652
-                    . $mapping['sourceEntity'] . ' towards ' . $mapping['targetEntity'] . ' does not exist.'
651
+                    'Column name `'.$joinColumn['referencedColumnName'].'` referenced for relation from '
652
+                    . $mapping['sourceEntity'].' towards '.$mapping['targetEntity'].' does not exist.'
653 653
                 );
654 654
             }
655 655
 
@@ -713,7 +713,7 @@  discard block
 block discarded – undo
713 713
 
714 714
         $compositeName = $theJoinTable->getName().'.'.implode('', $localColumns);
715 715
 
716
-        if (! $this->platform->supportsForeignKeyConstraints()) {
716
+        if ( ! $this->platform->supportsForeignKeyConstraints()) {
717 717
             return;
718 718
         }
719 719
 
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
      */
750 750
     private function gatherColumnOptions(array $mapping) : array
751 751
     {
752
-        if (! isset($mapping['options'])) {
752
+        if ( ! isset($mapping['options'])) {
753 753
             return [];
754 754
         }
755 755
 
@@ -855,7 +855,7 @@  discard block
 block discarded – undo
855 855
                 if ($table->hasPrimaryKey()) {
856 856
                     $columns = $table->getPrimaryKey()->getColumns();
857 857
                     if (count($columns) == 1) {
858
-                        $checkSequence = $table->getName() . '_' . $columns[0] . '_seq';
858
+                        $checkSequence = $table->getName().'_'.$columns[0].'_seq';
859 859
                         if ($fullSchema->hasSequence($checkSequence)) {
860 860
                             $visitor->acceptSequence($fullSchema->getSequence($checkSequence));
861 861
                         }
@@ -932,7 +932,7 @@  discard block
 block discarded – undo
932 932
         }
933 933
 
934 934
         // whitelist assets we already know about in $toSchema, use the existing filter otherwise
935
-        $config->setSchemaAssetsFilter(static function ($asset) use ($filter, $toSchema) : bool {
935
+        $config->setSchemaAssetsFilter(static function($asset) use ($filter, $toSchema) : bool {
936 936
             $assetName = $asset instanceof AbstractAsset ? $asset->getName() : $asset;
937 937
 
938 938
             return $toSchema->hasTable($assetName) || $toSchema->hasSequence($assetName) || $filter($asset);
Please login to merge, or discard this patch.