Completed
Pull Request — master (#7457)
by Michael
11:13
created
tests/Doctrine/Tests/ORM/Mapping/ClassMetadataFactoryTest.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -114,9 +114,9 @@  discard block
 block discarded – undo
114 114
 
115 115
     public function testHasGetMetadataNamespaceSeparatorIsNotNormalized() : void
116 116
     {
117
-        require_once __DIR__ . '/../../Models/Global/GlobalNamespaceModel.php';
117
+        require_once __DIR__.'/../../Models/Global/GlobalNamespaceModel.php';
118 118
 
119
-        $metadataDriver = $this->createAnnotationDriver([__DIR__ . '/../../Models/Global/']);
119
+        $metadataDriver = $this->createAnnotationDriver([__DIR__.'/../../Models/Global/']);
120 120
 
121 121
         $entityManager = $this->createEntityManager($metadataDriver);
122 122
 
@@ -124,10 +124,10 @@  discard block
 block discarded – undo
124 124
 
125 125
         self::assertSame(
126 126
             $mf->getMetadataFor(DoctrineGlobalArticle::class),
127
-            $mf->getMetadataFor('\\' . DoctrineGlobalArticle::class)
127
+            $mf->getMetadataFor('\\'.DoctrineGlobalArticle::class)
128 128
         );
129 129
         self::assertTrue($mf->hasMetadataFor(DoctrineGlobalArticle::class));
130
-        self::assertTrue($mf->hasMetadataFor('\\' . DoctrineGlobalArticle::class));
130
+        self::assertTrue($mf->hasMetadataFor('\\'.DoctrineGlobalArticle::class));
131 131
     }
132 132
 
133 133
     /**
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
     public function testNoDefaultDiscriminatorMapIsAssumed(string $rootClassName, string $targetClassName) : void
159 159
     {
160 160
         $cmf    = new ClassMetadataFactory();
161
-        $driver = $this->createAnnotationDriver([__DIR__ . '/../../Models/JoinedInheritanceType/']);
161
+        $driver = $this->createAnnotationDriver([__DIR__.'/../../Models/JoinedInheritanceType/']);
162 162
         $em     = $this->createEntityManager($driver);
163 163
         $cmf->setEntityManager($em);
164 164
 
@@ -208,10 +208,10 @@  discard block
 block discarded – undo
208 208
         $driverMock = new DriverMock();
209 209
         $config     = new Configuration();
210 210
 
211
-        $config->setProxyDir(__DIR__ . '/../../Proxies');
211
+        $config->setProxyDir(__DIR__.'/../../Proxies');
212 212
         $config->setProxyNamespace('Doctrine\Tests\Proxies');
213 213
 
214
-        if (! $conn) {
214
+        if ( ! $conn) {
215 215
             $conn = new ConnectionMock([], $driverMock, $config, new EventManager());
216 216
         }
217 217
         $eventManager = $conn->getEventManager();
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
     public function testQuoteMetadata() : void
302 302
     {
303 303
         $cmf    = new ClassMetadataFactory();
304
-        $driver = $this->createAnnotationDriver([__DIR__ . '/../../Models/Quote/']);
304
+        $driver = $this->createAnnotationDriver([__DIR__.'/../../Models/Quote/']);
305 305
         $em     = $this->createEntityManager($driver);
306 306
         $cmf->setEntityManager($em);
307 307
 
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
         $listener
384 384
             ->expects($this->any())
385 385
             ->method('onClassMetadataNotFound')
386
-            ->will($this->returnCallback(function (OnClassMetadataNotFoundEventArgs $args) use ($metadata, $em, $test) {
386
+            ->will($this->returnCallback(function(OnClassMetadataNotFoundEventArgs $args) use ($metadata, $em, $test) {
387 387
                 $test->assertNull($args->getFoundMetadata());
388 388
                 $test->assertSame('Foo', $args->getClassName());
389 389
                 $test->assertSame($em, $args->getObjectManager());
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
     public function testInheritsIdGeneratorMappingFromEmbeddable() : void
446 446
     {
447 447
         $cmf    = new ClassMetadataFactory();
448
-        $driver = $this->createAnnotationDriver([__DIR__ . '/../../Models/DDC4006/']);
448
+        $driver = $this->createAnnotationDriver([__DIR__.'/../../Models/DDC4006/']);
449 449
         $em     = $this->createEntityManager($driver);
450 450
         $cmf->setEntityManager($em);
451 451
 
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
     ) : ClassMetadata {
469 469
         $this->requestedClasses[] = $className;
470 470
 
471
-        if (! isset($this->mockMetadata[$className])) {
471
+        if ( ! isset($this->mockMetadata[$className])) {
472 472
             throw new \InvalidArgumentException(sprintf('No mock metadata found for class %s.', $className));
473 473
         }
474 474
 
Please login to merge, or discard this patch.
lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
         string $className,
89 89
         ClassMetadataBuildingContext $metadataBuildingContext
90 90
     ) : ?ClassMetadata {
91
-        if (! $this->evm->hasListeners(Events::onClassMetadataNotFound)) {
91
+        if ( ! $this->evm->hasListeners(Events::onClassMetadataNotFound)) {
92 92
             return null;
93 93
         }
94 94
 
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
                 $classMetadata->setCache(clone $parent->getCache());
150 150
             }
151 151
 
152
-            if (! empty($parent->entityListeners) && empty($classMetadata->entityListeners)) {
152
+            if ( ! empty($parent->entityListeners) && empty($classMetadata->entityListeners)) {
153 153
                 $classMetadata->entityListeners = $parent->entityListeners;
154 154
             }
155 155
         }
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 
171 171
     protected function completeRuntimeMetadata(ClassMetadata $class, ?ClassMetadata $parent = null) : void
172 172
     {
173
-        if (! $parent || ! $parent->isMappedSuperclass) {
173
+        if ( ! $parent || ! $parent->isMappedSuperclass) {
174 174
             return;
175 175
         }
176 176
 
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
                 continue;
189 189
             }
190 190
 
191
-            if (! ($property instanceof ToOneAssociationMetadata)) {
191
+            if ( ! ($property instanceof ToOneAssociationMetadata)) {
192 192
                 continue;
193 193
             }
194 194
 
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
      */
208 208
     protected function validateRuntimeMetadata(ClassMetadata $class, ?ClassMetadata $parent = null) : void
209 209
     {
210
-        if (! $class->getReflectionClass()) {
210
+        if ( ! $class->getReflectionClass()) {
211 211
             // only validate if there is a reflection class instance
212 212
             return;
213 213
         }
@@ -217,13 +217,13 @@  discard block
 block discarded – undo
217 217
         $class->validateLifecycleCallbacks($this->getReflectionService());
218 218
 
219 219
         // verify inheritance
220
-        if (! $class->isMappedSuperclass && $class->inheritanceType !== InheritanceType::NONE) {
221
-            if (! $parent) {
222
-                if (! $class->discriminatorMap) {
220
+        if ( ! $class->isMappedSuperclass && $class->inheritanceType !== InheritanceType::NONE) {
221
+            if ( ! $parent) {
222
+                if ( ! $class->discriminatorMap) {
223 223
                     throw MappingException::missingDiscriminatorMap($class->getClassName());
224 224
                 }
225 225
 
226
-                if (! $class->discriminatorColumn) {
226
+                if ( ! $class->discriminatorColumn) {
227 227
                     throw MappingException::missingDiscriminatorColumn($class->getClassName());
228 228
                 }
229 229
             }
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
     private function completeIdentifierGeneratorMappings(ClassMetadata $class) : void
291 291
     {
292 292
         foreach ($class->getDeclaredPropertiesIterator() as $property) {
293
-            if (! $property instanceof FieldMetadata /*&& ! $property instanceof AssocationMetadata*/) {
293
+            if ( ! $property instanceof FieldMetadata /*&& ! $property instanceof AssocationMetadata*/) {
294 294
                 continue;
295 295
             }
296 296
 
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 
301 301
     private function completeFieldIdentifierGeneratorMapping(FieldMetadata $field)
302 302
     {
303
-        if (! $field->hasValueGenerator()) {
303
+        if ( ! $field->hasValueGenerator()) {
304 304
             return;
305 305
         }
306 306
 
@@ -352,10 +352,10 @@  discard block
 block discarded – undo
352 352
 
353 353
             case GeneratorType::CUSTOM:
354 354
                 $definition = $generator->getDefinition();
355
-                if (! isset($definition['class'])) {
355
+                if ( ! isset($definition['class'])) {
356 356
                     throw InvalidCustomGenerator::onClassNotConfigured();
357 357
                 }
358
-                if (! class_exists($definition['class'])) {
358
+                if ( ! class_exists($definition['class'])) {
359 359
                     throw InvalidCustomGenerator::onMissingClass($definition);
360 360
                 }
361 361
 
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 
389 389
     private function getTargetPlatform() : Platforms\AbstractPlatform
390 390
     {
391
-        if (! $this->targetPlatform) {
391
+        if ( ! $this->targetPlatform) {
392 392
             $this->targetPlatform = $this->em->getConnection()->getDatabasePlatform();
393 393
         }
394 394
 
Please login to merge, or discard this patch.
lib/Doctrine/ORM/Mapping/MappingException.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
      */
23 23
     public static function pathRequired()
24 24
     {
25
-        return new self('Specifying the paths to your entities is required ' .
25
+        return new self('Specifying the paths to your entities is required '.
26 26
             'in the AnnotationDriver to retrieve all class names.');
27 27
     }
28 28
 
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
      */
213 213
     public static function missingQueryMapping($entity, $queryName)
214 214
     {
215
-        return new self('Query named "' . $queryName . '" in "' . $entity . ' requires a result class or result set mapping.');
215
+        return new self('Query named "'.$queryName.'" in "'.$entity.' requires a result class or result set mapping.');
216 216
     }
217 217
 
218 218
     /**
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
      */
224 224
     public static function missingResultSetMappingEntity($entity, $resultName)
225 225
     {
226
-        return new self('Result set mapping named "' . $resultName . '" in "' . $entity . ' requires a entity class name.');
226
+        return new self('Result set mapping named "'.$resultName.'" in "'.$entity.' requires a entity class name.');
227 227
     }
228 228
 
229 229
     /**
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
      */
235 235
     public static function missingResultSetMappingFieldName($entity, $resultName)
236 236
     {
237
-        return new self('Result set mapping named "' . $resultName . '" in "' . $entity . ' requires a field name.');
237
+        return new self('Result set mapping named "'.$resultName.'" in "'.$entity.' requires a field name.');
238 238
     }
239 239
 
240 240
     /**
@@ -281,8 +281,8 @@  discard block
 block discarded – undo
281 281
     {
282 282
         $message = sprintf("The mapping of field '%s' is invalid: The option '%s' is required.", $field, $expectedOption);
283 283
 
284
-        if (! empty($hint)) {
285
-            $message .= ' (Hint: ' . $hint . ')';
284
+        if ( ! empty($hint)) {
285
+            $message .= ' (Hint: '.$hint.')';
286 286
         }
287 287
 
288 288
         return new self($message);
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
      */
312 312
     public static function reflectionFailure($entity, \ReflectionException $previousException)
313 313
     {
314
-        return new self('An error occurred in ' . $entity, 0, $previousException);
314
+        return new self('An error occurred in '.$entity, 0, $previousException);
315 315
     }
316 316
 
317 317
     /**
@@ -322,8 +322,8 @@  discard block
 block discarded – undo
322 322
      */
323 323
     public static function joinColumnMustPointToMappedField($className, $joinColumn)
324 324
     {
325
-        return new self('The column ' . $joinColumn . ' must be mapped to a field in class '
326
-            . $className . ' since it is referenced by a join column of another class.');
325
+        return new self('The column '.$joinColumn.' must be mapped to a field in class '
326
+            . $className.' since it is referenced by a join column of another class.');
327 327
     }
328 328
 
329 329
     /**
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
      */
358 358
     public static function propertyTypeIsRequired($className, $propertyName)
359 359
     {
360
-        return new self("The attribute 'type' is required for the column description of property " . $className . '::$' . $propertyName . '.');
360
+        return new self("The attribute 'type' is required for the column description of property ".$className.'::$'.$propertyName.'.');
361 361
     }
362 362
 
363 363
     /**
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
      */
368 368
     public static function tableIdGeneratorNotImplemented($className)
369 369
     {
370
-        return new self('TableIdGenerator is not yet implemented for use with class ' . $className);
370
+        return new self('TableIdGenerator is not yet implemented for use with class '.$className);
371 371
     }
372 372
 
373 373
     /**
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
      */
394 394
     public static function duplicateQueryMapping($entity, $queryName)
395 395
     {
396
-        return new self('Query named "' . $queryName . '" in "' . $entity . '" was already declared, but it must be declared only once');
396
+        return new self('Query named "'.$queryName.'" in "'.$entity.'" was already declared, but it must be declared only once');
397 397
     }
398 398
 
399 399
     /**
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
      */
405 405
     public static function duplicateResultSetMapping($entity, $resultName)
406 406
     {
407
-        return new self('Result set mapping named "' . $resultName . '" in "' . $entity . '" was already declared, but it must be declared only once');
407
+        return new self('Result set mapping named "'.$resultName.'" in "'.$entity.'" was already declared, but it must be declared only once');
408 408
     }
409 409
 
410 410
     /**
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
      */
415 415
     public static function singleIdNotAllowedOnCompositePrimaryKey($entity)
416 416
     {
417
-        return new self('Single id is not allowed on composite primary key in entity ' . $entity);
417
+        return new self('Single id is not allowed on composite primary key in entity '.$entity);
418 418
     }
419 419
 
420 420
     /**
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
      */
425 425
     public static function noIdDefined($entity)
426 426
     {
427
-        return new self('No ID defined for entity ' . $entity);
427
+        return new self('No ID defined for entity '.$entity);
428 428
     }
429 429
 
430 430
     /**
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
      */
435 435
     public static function unsupportedOptimisticLockingType($unsupportedType)
436 436
     {
437
-        return new self('Locking type "' . $unsupportedType . '" is not supported by Doctrine.');
437
+        return new self('Locking type "'.$unsupportedType.'" is not supported by Doctrine.');
438 438
     }
439 439
 
440 440
     /**
@@ -444,13 +444,13 @@  discard block
 block discarded – undo
444 444
      */
445 445
     public static function fileMappingDriversRequireConfiguredDirectoryPath($path = null)
446 446
     {
447
-        if (! empty($path)) {
448
-            $path = '[' . $path . ']';
447
+        if ( ! empty($path)) {
448
+            $path = '['.$path.']';
449 449
         }
450 450
 
451 451
         return new self(
452
-            'File mapping drivers must have a valid directory path, ' .
453
-            'however the given path ' . $path . ' seems to be incorrect!'
452
+            'File mapping drivers must have a valid directory path, '.
453
+            'however the given path '.$path.' seems to be incorrect!'
454 454
         );
455 455
     }
456 456
 
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
     public static function invalidClassInDiscriminatorMap($className, $owningClass)
467 467
     {
468 468
         return new self(sprintf(
469
-            "Entity class '%s' used in the discriminator map of class '%s' " .
469
+            "Entity class '%s' used in the discriminator map of class '%s' ".
470 470
             'does not exist.',
471 471
             $className,
472 472
             $owningClass
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
     public static function sqlConversionNotAllowedForPrimaryKeyProperties($className, Property $property)
533 533
     {
534 534
         return new self(sprintf(
535
-            'It is not possible to set id field "%s" to type "%s" in entity class "%s". ' .
535
+            'It is not possible to set id field "%s" to type "%s" in entity class "%s". '.
536 536
             'The type "%s" requires conversion SQL which is not allowed for identifiers.',
537 537
             $property->getName(),
538 538
             $property->getTypeName(),
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
      */
569 569
     public static function duplicateColumnName($className, $columnName)
570 570
     {
571
-        return new self("Duplicate definition of column '" . $columnName . "' on entity '" . $className . "' in a field or discriminator column mapping.");
571
+        return new self("Duplicate definition of column '".$columnName."' on entity '".$className."' in a field or discriminator column mapping.");
572 572
     }
573 573
 
574 574
     /**
@@ -579,7 +579,7 @@  discard block
 block discarded – undo
579 579
      */
580 580
     public static function illegalToManyAssociationOnMappedSuperclass($className, $field)
581 581
     {
582
-        return new self("It is illegal to put an inverse side one-to-many or many-to-many association on mapped superclass '" . $className . '#' . $field . "'.");
582
+        return new self("It is illegal to put an inverse side one-to-many or many-to-many association on mapped superclass '".$className.'#'.$field."'.");
583 583
     }
584 584
 
585 585
     /**
@@ -591,8 +591,8 @@  discard block
 block discarded – undo
591 591
      */
592 592
     public static function cannotMapCompositePrimaryKeyEntitiesAsForeignId($className, $targetEntity, $targetField)
593 593
     {
594
-        return new self("It is not possible to map entity '" . $className . "' with a composite primary key " .
595
-            "as part of the primary key of another entity '" . $targetEntity . '#' . $targetField . "'.");
594
+        return new self("It is not possible to map entity '".$className."' with a composite primary key ".
595
+            "as part of the primary key of another entity '".$targetEntity.'#'.$targetField."'.");
596 596
     }
597 597
 
598 598
     /**
@@ -646,8 +646,8 @@  discard block
 block discarded – undo
646 646
      */
647 647
     public static function illegalOrphanRemoval($className, $field)
648 648
     {
649
-        return new self('Orphan removal is only allowed on one-to-one and one-to-many ' .
650
-            'associations, but ' . $className . '#' . $field . ' is not.');
649
+        return new self('Orphan removal is only allowed on one-to-one and one-to-many '.
650
+            'associations, but '.$className.'#'.$field.' is not.');
651 651
     }
652 652
 
653 653
     /**
@@ -679,7 +679,7 @@  discard block
 block discarded – undo
679 679
      */
680 680
     public static function noInheritanceOnMappedSuperClass($className)
681 681
     {
682
-        return new self("It is not supported to define inheritance information on a mapped superclass '" . $className . "'.");
682
+        return new self("It is not supported to define inheritance information on a mapped superclass '".$className."'.");
683 683
     }
684 684
 
685 685
     /**
@@ -691,8 +691,8 @@  discard block
 block discarded – undo
691 691
     public static function mappedClassNotPartOfDiscriminatorMap($className, $rootClassName)
692 692
     {
693 693
         return new self(
694
-            "Entity '" . $className . "' has to be part of the discriminator map of '" . $rootClassName . "' " .
695
-            "to be properly mapped in the inheritance hierarchy. Alternatively you can make '" . $className . "' an abstract class " .
694
+            "Entity '".$className."' has to be part of the discriminator map of '".$rootClassName."' ".
695
+            "to be properly mapped in the inheritance hierarchy. Alternatively you can make '".$className."' an abstract class ".
696 696
             'to avoid this exception from occurring.'
697 697
         );
698 698
     }
@@ -705,7 +705,7 @@  discard block
 block discarded – undo
705 705
      */
706 706
     public static function lifecycleCallbackMethodNotFound($className, $methodName)
707 707
     {
708
-        return new self("Entity '" . $className . "' has no method '" . $methodName . "' to be registered as lifecycle callback.");
708
+        return new self("Entity '".$className."' has no method '".$methodName."' to be registered as lifecycle callback.");
709 709
     }
710 710
 
711 711
     /**
@@ -751,7 +751,7 @@  discard block
 block discarded – undo
751 751
      */
752 752
     public static function invalidFetchMode($className, $annotation)
753 753
     {
754
-        return new self("Entity '" . $className . "' has a mapping with invalid fetch mode '" . $annotation . "'");
754
+        return new self("Entity '".$className."' has a mapping with invalid fetch mode '".$annotation."'");
755 755
     }
756 756
 
757 757
     /**
@@ -761,7 +761,7 @@  discard block
 block discarded – undo
761 761
      */
762 762
     public static function compositeKeyAssignedIdGeneratorRequired($className)
763 763
     {
764
-        return new self("Entity '" . $className . "' has a composite identifier but uses an ID generator other than manually assigning (Identity, Sequence). This is not supported.");
764
+        return new self("Entity '".$className."' has a composite identifier but uses an ID generator other than manually assigning (Identity, Sequence). This is not supported.");
765 765
     }
766 766
 
767 767
     /**
@@ -773,7 +773,7 @@  discard block
 block discarded – undo
773 773
      */
774 774
     public static function invalidTargetEntityClass($targetEntity, $sourceEntity, $associationName)
775 775
     {
776
-        return new self("The target-entity '" . $targetEntity . "' cannot be found in '" . $sourceEntity . '#' . $associationName . "'.");
776
+        return new self("The target-entity '".$targetEntity."' cannot be found in '".$sourceEntity.'#'.$associationName."'.");
777 777
     }
778 778
 
779 779
     /**
@@ -785,8 +785,8 @@  discard block
 block discarded – undo
785 785
      */
786 786
     public static function invalidCascadeOption(array $cascades, $className, $propertyName)
787 787
     {
788
-        $cascades = implode(', ', array_map(function ($e) {
789
-            return "'" . $e . "'";
788
+        $cascades = implode(', ', array_map(function($e) {
789
+            return "'".$e."'";
790 790
         }, $cascades));
791 791
 
792 792
         return new self(sprintf(
@@ -819,7 +819,7 @@  discard block
 block discarded – undo
819 819
     {
820 820
         return new self(
821 821
             sprintf(
822
-                'Infinite nesting detected for embedded property %s::%s. ' .
822
+                'Infinite nesting detected for embedded property %s::%s. '.
823 823
                 'You cannot embed an embeddable from the same type inside an embeddable.',
824 824
                 $className,
825 825
                 $propertyName
@@ -834,7 +834,7 @@  discard block
 block discarded – undo
834 834
     {
835 835
         return new self(
836 836
             sprintf(
837
-                'Class %s not found in namespaces %s.' .
837
+                'Class %s not found in namespaces %s.'.
838 838
                 $className,
839 839
                 implode(', ', $namespaces)
840 840
             )
Please login to merge, or discard this patch.