Completed
Pull Request — master (#6974)
by
unknown
100:08
created
lib/Doctrine/ORM/Tools/SchemaTool.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace Doctrine\ORM\Tools;
6 6
 
@@ -168,11 +168,11 @@  discard block
 block discarded – undo
168 168
                     $pkColumns = [];
169 169
 
170 170
                     foreach ($class->getDeclaredPropertiesIterator() as $fieldName => $property) {
171
-                        if (! ($property instanceof FieldMetadata)) {
171
+                        if ( ! ($property instanceof FieldMetadata)) {
172 172
                             continue;
173 173
                         }
174 174
 
175
-                        if (! $class->isInheritedProperty($fieldName)) {
175
+                        if ( ! $class->isInheritedProperty($fieldName)) {
176 176
                             $columnName = $this->platform->quoteIdentifier($property->getColumnName());
177 177
 
178 178
                             $this->gatherColumn($class, $property, $table);
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
                             }
208 208
                         }
209 209
 
210
-                        if (! empty($inheritedKeyColumns)) {
210
+                        if ( ! empty($inheritedKeyColumns)) {
211 211
                             // Add a FK constraint on the ID column
212 212
                             $rootClass = $this->em->getClassMetadata($class->getRootClassName());
213 213
 
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
                 }
253 253
             }
254 254
 
255
-            if (! $table->hasIndex('primary')) {
255
+            if ( ! $table->hasIndex('primary')) {
256 256
                 $table->setPrimaryKey($pkColumns);
257 257
             }
258 258
 
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
             $processedClasses[$class->getClassName()] = true;
313 313
 
314 314
             foreach ($class->getDeclaredPropertiesIterator() as $property) {
315
-                if (! $property instanceof FieldMetadata
315
+                if ( ! $property instanceof FieldMetadata
316 316
                     || ! $property->hasValueGenerator()
317 317
                     || $property->getValueGenerator()->getType() !== GeneratorType::SEQUENCE
318 318
                     || $class->getClassName() !== $class->getRootClassName()) {
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
 
322 322
                 $quotedName = $this->platform->quoteIdentifier($property->getValueGenerator()->getDefinition()['sequenceName']);
323 323
 
324
-                if (! $schema->hasSequence($quotedName)) {
324
+                if ( ! $schema->hasSequence($quotedName)) {
325 325
                     $schema->createSequence($quotedName, $property->getValueGenerator()->getDefinition()['allocationSize']);
326 326
                 }
327 327
             }
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
             }
335 335
         }
336 336
 
337
-        if (! $this->platform->supportsSchemas() && ! $this->platform->canEmulateSchemas()) {
337
+        if ( ! $this->platform->supportsSchemas() && ! $this->platform->canEmulateSchemas()) {
338 338
             $schema->visit(new RemoveNamespacedAssets());
339 339
         }
340 340
 
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
                 break;
374 374
         }
375 375
 
376
-        if (! empty($discrColumn->getColumnDefinition())) {
376
+        if ( ! empty($discrColumn->getColumnDefinition())) {
377 377
             $options['columnDefinition'] = $discrColumn->getColumnDefinition();
378 378
         }
379 379
 
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
         $pkColumns = [];
392 392
 
393 393
         foreach ($class->getDeclaredPropertiesIterator() as $fieldName => $property) {
394
-            if (! ($property instanceof FieldMetadata)) {
394
+            if ( ! ($property instanceof FieldMetadata)) {
395 395
                 continue;
396 396
             }
397 397
 
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
     private function gatherRelationsSql($class, $table, $schema, &$addedFks, &$blacklistedFks)
507 507
     {
508 508
         foreach ($class->getDeclaredPropertiesIterator() as $fieldName => $property) {
509
-            if (! ($property instanceof AssociationMetadata)) {
509
+            if ( ! ($property instanceof AssociationMetadata)) {
510 510
                 continue;
511 511
             }
512 512
 
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
                 continue;
515 515
             }
516 516
 
517
-            if (! $property->isOwningSide()) {
517
+            if ( ! $property->isOwningSide()) {
518 518
                 continue;
519 519
             }
520 520
 
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
         $idColumns        = $class->getIdentifierColumns($this->em);
605 605
         $idColumnNameList = array_keys($idColumns);
606 606
 
607
-        if (! in_array($referencedColumnName, $idColumnNameList, true)) {
607
+        if ( ! in_array($referencedColumnName, $idColumnNameList, true)) {
608 608
             return null;
609 609
         }
610 610
 
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
         foreach ($class->getIdentifierFieldNames() as $fieldName) {
613 613
             $property = $class->getProperty($fieldName);
614 614
 
615
-            if (! ($property instanceof AssociationMetadata)) {
615
+            if ( ! ($property instanceof AssociationMetadata)) {
616 616
                 continue;
617 617
             }
618 618
 
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
                 $joinColumn->getReferencedColumnName()
669 669
             );
670 670
 
671
-            if (! $definingClass) {
671
+            if ( ! $definingClass) {
672 672
                 throw new \Doctrine\ORM\ORMException(sprintf(
673 673
                     'Column name "%s" referenced for relation from %s towards %s does not exist.',
674 674
                     $joinColumn->getReferencedColumnName(),
@@ -684,14 +684,14 @@  discard block
 block discarded – undo
684 684
             $localColumns[]      = $quotedColumnName;
685 685
             $foreignColumns[]    = $quotedReferencedColumnName;
686 686
 
687
-            if (! $theJoinTable->hasColumn($quotedColumnName)) {
687
+            if ( ! $theJoinTable->hasColumn($quotedColumnName)) {
688 688
                 // Only add the column to the table if it does not exist already.
689 689
                 // It might exist already if the foreign key is mapped into a regular
690 690
                 // property as well.
691 691
                 $property  = $definingClass->getProperty($referencedFieldName);
692 692
                 $columnDef = null;
693 693
 
694
-                if (! empty($joinColumn->getColumnDefinition())) {
694
+                if ( ! empty($joinColumn->getColumnDefinition())) {
695 695
                     $columnDef = $joinColumn->getColumnDefinition();
696 696
                 } elseif ($property->getColumnDefinition()) {
697 697
                     $columnDef = $property->getColumnDefinition();
@@ -725,7 +725,7 @@  discard block
 block discarded – undo
725 725
                 $uniqueConstraints[] = ['columns' => [$quotedColumnName]];
726 726
             }
727 727
 
728
-            if (! empty($joinColumn->getOnDelete())) {
728
+            if ( ! empty($joinColumn->getOnDelete())) {
729 729
                 $fkOptions['onDelete'] = $joinColumn->getOnDelete();
730 730
             }
731 731
         }
@@ -736,7 +736,7 @@  discard block
 block discarded – undo
736 736
             $theJoinTable->addUniqueIndex($unique['columns'], is_numeric($indexName) ? null : $indexName);
737 737
         }
738 738
 
739
-        $compositeName = $theJoinTable->getName() . '.' . implode('', $localColumns);
739
+        $compositeName = $theJoinTable->getName().'.'.implode('', $localColumns);
740 740
 
741 741
         if (isset($addedFks[$compositeName])
742 742
             && ($foreignTableName !== $addedFks[$compositeName]['foreignTableName']
@@ -753,7 +753,7 @@  discard block
 block discarded – undo
753 753
             }
754 754
 
755 755
             $blacklistedFks[$compositeName] = true;
756
-        } elseif (! isset($blacklistedFks[$compositeName])) {
756
+        } elseif ( ! isset($blacklistedFks[$compositeName])) {
757 757
             $addedFks[$compositeName] = [
758 758
                 'foreignTableName' => $foreignTableName,
759 759
                 'foreignColumns'   => $foreignColumns,
@@ -835,7 +835,7 @@  discard block
 block discarded – undo
835 835
         $fullSchema = $sm->createSchema();
836 836
 
837 837
         foreach ($fullSchema->getTables() as $table) {
838
-            if (! $schema->hasTable($table->getName())) {
838
+            if ( ! $schema->hasTable($table->getName())) {
839 839
                 foreach ($table->getForeignKeys() as $foreignKey) {
840 840
                     /* @var $foreignKey \Doctrine\DBAL\Schema\ForeignKeyConstraint */
841 841
                     if ($schema->hasTable($foreignKey->getForeignTableName())) {
@@ -860,7 +860,7 @@  discard block
 block discarded – undo
860 860
                 if ($table->hasPrimaryKey()) {
861 861
                     $columns = $table->getPrimaryKey()->getColumns();
862 862
                     if (count($columns) === 1) {
863
-                        $checkSequence = $table->getName() . '_' . $columns[0] . '_seq';
863
+                        $checkSequence = $table->getName().'_'.$columns[0].'_seq';
864 864
                         if ($fullSchema->hasSequence($checkSequence)) {
865 865
                             $visitor->acceptSequence($fullSchema->getSequence($checkSequence));
866 866
                         }
Please login to merge, or discard this patch.
lib/Doctrine/ORM/Tools/SchemaValidator.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace Doctrine\ORM\Tools;
6 6
 
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
         $ce = [];
71 71
 
72 72
         foreach ($class->getDeclaredPropertiesIterator() as $fieldName => $association) {
73
-            if (! ($association instanceof AssociationMetadata)) {
73
+            if ( ! ($association instanceof AssociationMetadata)) {
74 74
                 continue;
75 75
             }
76 76
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
         }
79 79
 
80 80
         foreach ($class->getSubClasses() as $subClass) {
81
-            if (! in_array($class->getClassName(), class_parents($subClass), true)) {
81
+            if ( ! in_array($class->getClassName(), class_parents($subClass), true)) {
82 82
                 $message = "According to the discriminator map class, '%s' has to be a child of '%s', but these entities are not related through inheritance.";
83 83
 
84 84
                 $ce[] = sprintf($message, $subClass, $class->getClassName());
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
         $fieldName       = $association->getName();
98 98
         $targetEntity    = $association->getTargetEntity();
99 99
 
100
-        if (! class_exists($targetEntity) || $metadataFactory->isTransient($targetEntity)) {
100
+        if ( ! class_exists($targetEntity) || $metadataFactory->isTransient($targetEntity)) {
101 101
             $message = "The target entity '%s' specified on %s#%s is unknown or not an entity.";
102 102
 
103 103
             return [sprintf($message, $targetEntity, $class->getClassName(), $fieldName)];
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 
117 117
         /** @var ClassMetadata $targetMetadata */
118 118
         $targetMetadata    = $metadataFactory->getMetadataFor($targetEntity);
119
-        $containsForeignId = array_filter($targetMetadata->identifier, function ($identifier) use ($targetMetadata) {
119
+        $containsForeignId = array_filter($targetMetadata->identifier, function($identifier) use ($targetMetadata) {
120 120
             $targetProperty = $targetMetadata->getProperty($identifier);
121 121
 
122 122
             return $targetProperty instanceof AssociationMetadata;
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
             /** @var AssociationMetadata $targetAssociation */
133 133
             $targetAssociation = $targetMetadata->getProperty($mappedBy);
134 134
 
135
-            if (! $targetAssociation) {
135
+            if ( ! $targetAssociation) {
136 136
                 $message = 'The association %s#%s refers to the owning side property %s#%s which does not exist.';
137 137
 
138 138
                 $ce[] = sprintf($message, $class->getClassName(), $fieldName, $targetEntity, $mappedBy);
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
             /** @var AssociationMetadata $targetAssociation */
157 157
             $targetAssociation = $targetMetadata->getProperty($inversedBy);
158 158
 
159
-            if (! $targetAssociation) {
159
+            if ( ! $targetAssociation) {
160 160
                 $message = 'The association %s#%s refers to the inverse side property %s#%s which does not exist.';
161 161
 
162 162
                 $ce[] = sprintf($message, $class->getClassName(), $fieldName, $targetEntity, $inversedBy);
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
                 $joinTable               = $association->getJoinTable();
201 201
 
202 202
                 foreach ($joinTable->getJoinColumns() as $joinColumn) {
203
-                    if (! in_array($joinColumn->getReferencedColumnName(), $classIdentifierColumns, true)) {
203
+                    if ( ! in_array($joinColumn->getReferencedColumnName(), $classIdentifierColumns, true)) {
204 204
                         $message = "The referenced column name '%s' has to be a primary key column on the target entity class '%s'.";
205 205
 
206 206
                         $ce[] = sprintf($message, $joinColumn->getReferencedColumnName(), $class->getClassName());
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
                 }
210 210
 
211 211
                 foreach ($joinTable->getInverseJoinColumns() as $inverseJoinColumn) {
212
-                    if (! in_array($inverseJoinColumn->getReferencedColumnName(), $targetIdentifierColumns, true)) {
212
+                    if ( ! in_array($inverseJoinColumn->getReferencedColumnName(), $targetIdentifierColumns, true)) {
213 213
                         $message = "The referenced column name '%s' has to be a primary key column on the target entity class '%s'.";
214 214
 
215 215
                         $ce[] = sprintf($message, $joinColumn->getReferencedColumnName(), $targetMetadata->getClassName());
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 
220 220
                 if (count($targetIdentifierColumns) !== count($joinTable->getInverseJoinColumns())) {
221 221
                     $columnNames = array_map(
222
-                        function (JoinColumnMetadata $joinColumn) {
222
+                        function(JoinColumnMetadata $joinColumn) {
223 223
                             return $joinColumn->getReferencedColumnName();
224 224
                         },
225 225
                         $joinTable->getInverseJoinColumns()
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 
235 235
                 if (count($classIdentifierColumns) !== count($joinTable->getJoinColumns())) {
236 236
                     $columnNames = array_map(
237
-                        function (JoinColumnMetadata $joinColumn) {
237
+                        function(JoinColumnMetadata $joinColumn) {
238 238
                             return $joinColumn->getReferencedColumnName();
239 239
                         },
240 240
                         $joinTable->getJoinColumns()
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
                 $joinColumns       = $association->getJoinColumns();
252 252
 
253 253
                 foreach ($joinColumns as $joinColumn) {
254
-                    if (! in_array($joinColumn->getReferencedColumnName(), $identifierColumns, true)) {
254
+                    if ( ! in_array($joinColumn->getReferencedColumnName(), $identifierColumns, true)) {
255 255
                         $message = "The referenced column name '%s' has to be a primary key column on the target entity class '%s'.";
256 256
 
257 257
                         $ce[] = sprintf($message, $joinColumn->getReferencedColumnName(), $targetMetadata->getClassName());
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
                     continue;
283 283
                 }
284 284
 
285
-                if (! ($targetProperty instanceof AssociationMetadata)) {
285
+                if ( ! ($targetProperty instanceof AssociationMetadata)) {
286 286
                     $message = "The association %s#%s is ordered by a property '%s' that is non-existing field on the target entity '%s'.";
287 287
 
288 288
                     $ce[] = sprintf($message, $class->getClassName(), $fieldName, $orderField, $targetMetadata->getClassName());
Please login to merge, or discard this patch.
lib/Doctrine/ORM/Tools/Pagination/LimitSubqueryOutputWalker.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-declare(strict_types=1);
3
+declare(strict_types = 1);
4 4
 
5 5
 namespace Doctrine\ORM\Tools\Pagination;
6 6
 
@@ -187,13 +187,13 @@  discard block
 block discarded – undo
187 187
 
188 188
         $innerSql           = $this->getInnerSQL($AST);
189 189
         $sqlIdentifier      = $this->getSQLIdentifier($AST);
190
-        $sqlAliasIdentifier = array_map(function ($info) {
190
+        $sqlAliasIdentifier = array_map(function($info) {
191 191
             return $info['alias'];
192 192
         }, $sqlIdentifier);
193 193
 
194 194
         if ($hasOrderBy) {
195
-            $orderGroupBy = ' GROUP BY ' . implode(', ', $sqlAliasIdentifier);
196
-            $sqlPiece     = 'MIN(' . $this->walkResultVariable('dctrn_rownum') . ') AS dctrn_minrownum';
195
+            $orderGroupBy = ' GROUP BY '.implode(', ', $sqlAliasIdentifier);
196
+            $sqlPiece     = 'MIN('.$this->walkResultVariable('dctrn_rownum').') AS dctrn_minrownum';
197 197
 
198 198
             $sqlAliasIdentifier[] = $sqlPiece;
199 199
             $sqlIdentifier[]      = [
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
         $sql = sprintf('SELECT DISTINCT %s FROM (%s) dctrn_result', implode(', ', $sqlAliasIdentifier), $innerSql);
207 207
 
208 208
         if ($hasOrderBy) {
209
-            $sql .= $orderGroupBy . $outerOrderBy;
209
+            $sql .= $orderGroupBy.$outerOrderBy;
210 210
         }
211 211
 
212 212
         // Apply the limit and offset.
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 
251 251
         $innerSql           = $this->getInnerSQL($AST);
252 252
         $sqlIdentifier      = $this->getSQLIdentifier($AST);
253
-        $sqlAliasIdentifier = array_map(function ($info) {
253
+        $sqlAliasIdentifier = array_map(function($info) {
254 254
             return $info['alias'];
255 255
         }, $sqlIdentifier);
256 256
 
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
             $idVar = $pathExpression->identificationVariable;
309 309
             $field = $pathExpression->field;
310 310
 
311
-            if (! isset($selects[$idVar])) {
311
+            if ( ! isset($selects[$idVar])) {
312 312
                 $selects[$idVar] = [];
313 313
             }
314 314
 
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
             if ($selectExpression instanceof SelectExpression) {
322 322
                 $idVar = $selectExpression->expression;
323 323
 
324
-                if (! is_string($idVar)) {
324
+                if ( ! is_string($idVar)) {
325 325
                     continue;
326 326
                 }
327 327
 
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
         ?OrderByClause $orderByClause
357 357
     ) : string {
358 358
         // If the sql statement has an order by clause, we need to wrap it in a new select distinct statement
359
-        if (! $orderByClause) {
359
+        if ( ! $orderByClause) {
360 360
             return $sql;
361 361
         }
362 362
 
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
             $orderByItems[] = $orderByItemString;
395 395
             $identifier     = \substr($orderByItemString, 0, \strrpos($orderByItemString, ' '));
396 396
 
397
-            if (! \in_array($identifier, $identifiers, true)) {
397
+            if ( ! \in_array($identifier, $identifiers, true)) {
398 398
                 $identifiers[] = $identifier;
399 399
             }
400 400
         }
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
      */
548 548
     public function walkPathExpression($pathExpr)
549 549
     {
550
-        if (! $this->inSubSelect && ! $this->platformSupportsRowNumber() && ! in_array($pathExpr, $this->orderByPathExpressions, true)) {
550
+        if ( ! $this->inSubSelect && ! $this->platformSupportsRowNumber() && ! in_array($pathExpr, $this->orderByPathExpressions, true)) {
551 551
             $this->orderByPathExpressions[] = $pathExpr;
552 552
         }
553 553
 
Please login to merge, or discard this patch.