Completed
Pull Request — 2.7 (#6728)
by Luís
11:01
created
lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 
167 167
         if (isset($xmlRoot['inheritance-type'])) {
168 168
             $inheritanceType = (string) $xmlRoot['inheritance-type'];
169
-            $metadata->setInheritanceType(constant('Doctrine\ORM\Mapping\ClassMetadata::INHERITANCE_TYPE_' . $inheritanceType));
169
+            $metadata->setInheritanceType(constant('Doctrine\ORM\Mapping\ClassMetadata::INHERITANCE_TYPE_'.$inheritanceType));
170 170
 
171 171
             if ($metadata->inheritanceType != Metadata::INHERITANCE_TYPE_NONE) {
172 172
                 // Evaluate <discriminator-column...>
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
                 }
369 369
 
370 370
                 if (isset($oneToOneElement['fetch'])) {
371
-                    $mapping['fetch'] = constant('Doctrine\ORM\Mapping\ClassMetadata::FETCH_' . (string) $oneToOneElement['fetch']);
371
+                    $mapping['fetch'] = constant('Doctrine\ORM\Mapping\ClassMetadata::FETCH_'.(string) $oneToOneElement['fetch']);
372 372
                 }
373 373
 
374 374
                 if (isset($oneToOneElement['mapped-by'])) {
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
                 ];
418 418
 
419 419
                 if (isset($oneToManyElement['fetch'])) {
420
-                    $mapping['fetch'] = constant('Doctrine\ORM\Mapping\ClassMetadata::FETCH_' . (string) $oneToManyElement['fetch']);
420
+                    $mapping['fetch'] = constant('Doctrine\ORM\Mapping\ClassMetadata::FETCH_'.(string) $oneToManyElement['fetch']);
421 421
                 }
422 422
 
423 423
                 if (isset($oneToManyElement->cascade)) {
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
                 }
468 468
 
469 469
                 if (isset($manyToOneElement['fetch'])) {
470
-                    $mapping['fetch'] = constant('Doctrine\ORM\Mapping\ClassMetadata::FETCH_' . (string) $manyToOneElement['fetch']);
470
+                    $mapping['fetch'] = constant('Doctrine\ORM\Mapping\ClassMetadata::FETCH_'.(string) $manyToOneElement['fetch']);
471 471
                 }
472 472
 
473 473
                 if (isset($manyToOneElement['inversed-by'])) {
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
                 ];
510 510
 
511 511
                 if (isset($manyToManyElement['fetch'])) {
512
-                    $mapping['fetch'] = constant('Doctrine\ORM\Mapping\ClassMetadata::FETCH_' . (string) $manyToManyElement['fetch']);
512
+                    $mapping['fetch'] = constant('Doctrine\ORM\Mapping\ClassMetadata::FETCH_'.(string) $manyToManyElement['fetch']);
513 513
                 }
514 514
 
515 515
                 if (isset($manyToManyElement['orphan-removal'])) {
@@ -629,7 +629,7 @@  discard block
 block discarded – undo
629 629
 
630 630
                 // Check for `fetch`
631 631
                 if (isset($overrideElement['fetch'])) {
632
-                    $override['fetch'] = constant(Metadata::class . '::FETCH_' . (string) $overrideElement['fetch']);
632
+                    $override['fetch'] = constant(Metadata::class.'::FETCH_'.(string) $overrideElement['fetch']);
633 633
                 }
634 634
 
635 635
                 $metadata->setAssociationOverride($fieldName, $override);
@@ -639,7 +639,7 @@  discard block
 block discarded – undo
639 639
         // Evaluate <lifecycle-callbacks...>
640 640
         if (isset($xmlRoot->{'lifecycle-callbacks'})) {
641 641
             foreach ($xmlRoot->{'lifecycle-callbacks'}->{'lifecycle-callback'} as $lifecycleCallback) {
642
-                $metadata->addLifecycleCallback((string) $lifecycleCallback['method'], constant('Doctrine\ORM\Events::' . (string) $lifecycleCallback['type']));
642
+                $metadata->addLifecycleCallback((string) $lifecycleCallback['method'], constant('Doctrine\ORM\Events::'.(string) $lifecycleCallback['type']));
643 643
             }
644 644
         }
645 645
 
@@ -800,12 +800,12 @@  discard block
 block discarded – undo
800 800
         $region = isset($cacheMapping['region']) ? (string) $cacheMapping['region'] : null;
801 801
         $usage  = isset($cacheMapping['usage']) ? strtoupper($cacheMapping['usage']) : null;
802 802
 
803
-        if ($usage && ! defined('Doctrine\ORM\Mapping\ClassMetadata::CACHE_USAGE_' . $usage)) {
803
+        if ($usage && ! defined('Doctrine\ORM\Mapping\ClassMetadata::CACHE_USAGE_'.$usage)) {
804 804
             throw new \InvalidArgumentException(sprintf('Invalid cache usage "%s"', $usage));
805 805
         }
806 806
 
807 807
         if ($usage) {
808
-            $usage = constant('Doctrine\ORM\Mapping\ClassMetadata::CACHE_USAGE_' . $usage);
808
+            $usage = constant('Doctrine\ORM\Mapping\ClassMetadata::CACHE_USAGE_'.$usage);
809 809
         }
810 810
 
811 811
         return [
@@ -875,7 +875,7 @@  discard block
 block discarded – undo
875 875
         $document->load($file);
876 876
 
877 877
         try {
878
-            if ( ! $document->schemaValidate(__DIR__ . '/../../../../../doctrine-mapping.xsd')) {
878
+            if ( ! $document->schemaValidate(__DIR__.'/../../../../../doctrine-mapping.xsd')) {
879 879
                 throw MappingException::fromLibXmlErrors(libxml_get_errors());
880 880
             }
881 881
         } finally {
Please login to merge, or discard this patch.
lib/Doctrine/ORM/Mapping/MappingException.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
         $message = "The mapping of field '{$field}' is invalid: The option '{$expectedOption}' is required.";
287 287
 
288 288
         if ( ! empty($hint)) {
289
-            $message .= ' (Hint: ' . $hint . ')';
289
+            $message .= ' (Hint: '.$hint.')';
290 290
         }
291 291
 
292 292
         return new self($message);
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
      */
317 317
     public static function reflectionFailure($entity, \ReflectionException $previousException)
318 318
     {
319
-        return new self('An error occurred in ' . $entity, 0, $previousException);
319
+        return new self('An error occurred in '.$entity, 0, $previousException);
320 320
     }
321 321
 
322 322
     /**
@@ -327,8 +327,8 @@  discard block
 block discarded – undo
327 327
      */
328 328
     public static function joinColumnMustPointToMappedField($className, $joinColumn)
329 329
     {
330
-        return new self('The column ' . $joinColumn . ' must be mapped to a field in class '
331
-            . $className . ' since it is referenced by a join column of another class.');
330
+        return new self('The column '.$joinColumn.' must be mapped to a field in class '
331
+            . $className.' since it is referenced by a join column of another class.');
332 332
     }
333 333
 
334 334
     /**
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
      */
434 434
     public static function noIdDefined($entity)
435 435
     {
436
-        return new self('No ID defined for entity ' . $entity);
436
+        return new self('No ID defined for entity '.$entity);
437 437
     }
438 438
 
439 439
     /**
@@ -458,12 +458,12 @@  discard block
 block discarded – undo
458 458
     public static function fileMappingDriversRequireConfiguredDirectoryPath($path = null)
459 459
     {
460 460
         if ( ! empty($path)) {
461
-            $path = '[' . $path . ']';
461
+            $path = '['.$path.']';
462 462
         }
463 463
 
464 464
         return new self(
465
-            'File mapping drivers must have a valid directory path, ' .
466
-            'however the given path ' . $path . ' seems to be incorrect!'
465
+            'File mapping drivers must have a valid directory path, '.
466
+            'however the given path '.$path.' seems to be incorrect!'
467 467
         );
468 468
     }
469 469
 
@@ -494,11 +494,11 @@  discard block
 block discarded – undo
494 494
     public static function duplicateDiscriminatorEntry($className, array $entries, array $map)
495 495
     {
496 496
         return new self(
497
-            "The entries " . implode(', ', $entries) . " in discriminator map of class '" . $className . "' is duplicated. " .
498
-            "If the discriminator map is automatically generated you have to convert it to an explicit discriminator map now. " .
499
-            "The entries of the current map are: @DiscriminatorMap({" . implode(', ', array_map(
497
+            "The entries ".implode(', ', $entries)." in discriminator map of class '".$className."' is duplicated. ".
498
+            "If the discriminator map is automatically generated you have to convert it to an explicit discriminator map now. ".
499
+            "The entries of the current map are: @DiscriminatorMap({".implode(', ', array_map(
500 500
                 function($a, $b) { return "'$a': '$b'"; }, array_keys($map), array_values($map)
501
-            )) . "})"
501
+            ))."})"
502 502
         );
503 503
     }
504 504
 
@@ -645,7 +645,7 @@  discard block
 block discarded – undo
645 645
     public static function illegalOrphanRemoval($className, $field)
646 646
     {
647 647
         return new self("Orphan removal is only allowed on one-to-one and one-to-many ".
648
-            "associations, but " . $className."#" .$field . " is not.");
648
+            "associations, but ".$className."#".$field." is not.");
649 649
     }
650 650
 
651 651
     /**
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
      */
678 678
     public static function noInheritanceOnMappedSuperClass($className)
679 679
     {
680
-        return new self("It is not supported to define inheritance information on a mapped superclass '" . $className . "'.");
680
+        return new self("It is not supported to define inheritance information on a mapped superclass '".$className."'.");
681 681
     }
682 682
 
683 683
     /**
@@ -689,8 +689,8 @@  discard block
 block discarded – undo
689 689
     public static function mappedClassNotPartOfDiscriminatorMap($className, $rootClassName)
690 690
     {
691 691
         return new self(
692
-            "Entity '" . $className . "' has to be part of the discriminator map of '" . $rootClassName . "' " .
693
-            "to be properly mapped in the inheritance hierarchy. Alternatively you can make '".$className."' an abstract class " .
692
+            "Entity '".$className."' has to be part of the discriminator map of '".$rootClassName."' ".
693
+            "to be properly mapped in the inheritance hierarchy. Alternatively you can make '".$className."' an abstract class ".
694 694
             "to avoid this exception from occurring."
695 695
         );
696 696
     }
@@ -703,7 +703,7 @@  discard block
 block discarded – undo
703 703
      */
704 704
     public static function lifecycleCallbackMethodNotFound($className, $methodName)
705 705
     {
706
-        return new self("Entity '" . $className . "' has no method '" . $methodName . "' to be registered as lifecycle callback.");
706
+        return new self("Entity '".$className."' has no method '".$methodName."' to be registered as lifecycle callback.");
707 707
     }
708 708
 
709 709
     /**
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
      */
750 750
     public static function invalidFetchMode($className, $annotation)
751 751
     {
752
-        return new self("Entity '" . $className . "' has a mapping with invalid fetch mode '" . $annotation . "'");
752
+        return new self("Entity '".$className."' has a mapping with invalid fetch mode '".$annotation."'");
753 753
     }
754 754
 
755 755
     /**
@@ -759,7 +759,7 @@  discard block
 block discarded – undo
759 759
      */
760 760
     public static function compositeKeyAssignedIdGeneratorRequired($className)
761 761
     {
762
-        return new self("Entity '". $className . "' has a composite identifier but uses an ID generator other than manually assigning (Identity, Sequence). This is not supported.");
762
+        return new self("Entity '".$className."' has a composite identifier but uses an ID generator other than manually assigning (Identity, Sequence). This is not supported.");
763 763
     }
764 764
 
765 765
     /**
@@ -771,7 +771,7 @@  discard block
 block discarded – undo
771 771
      */
772 772
     public static function invalidTargetEntityClass($targetEntity, $sourceEntity, $associationName)
773 773
     {
774
-        return new self("The target-entity " . $targetEntity . " cannot be found in '" . $sourceEntity."#".$associationName."'.");
774
+        return new self("The target-entity ".$targetEntity." cannot be found in '".$sourceEntity."#".$associationName."'.");
775 775
     }
776 776
 
777 777
     /**
@@ -783,7 +783,7 @@  discard block
 block discarded – undo
783 783
      */
784 784
     public static function invalidCascadeOption(array $cascades, $className, $propertyName)
785 785
     {
786
-        $cascades = implode(", ", array_map(function ($e) { return "'" . $e . "'"; }, $cascades));
786
+        $cascades = implode(", ", array_map(function($e) { return "'".$e."'"; }, $cascades));
787 787
 
788 788
         return new self(sprintf(
789 789
             "You have specified invalid cascade options for %s::$%s: %s; available options: 'remove', 'persist', 'refresh', 'merge', and 'detach'",
@@ -815,7 +815,7 @@  discard block
 block discarded – undo
815 815
     {
816 816
         return new self(
817 817
             sprintf(
818
-                'Infinite nesting detected for embedded property %s::%s. ' .
818
+                'Infinite nesting detected for embedded property %s::%s. '.
819 819
                 'You cannot embed an embeddable from the same type inside an embeddable.',
820 820
                 $className,
821 821
                 $propertyName
@@ -828,7 +828,7 @@  discard block
 block discarded – undo
828 828
      */
829 829
     public static function fromLibXmlErrors(array $errors) : self
830 830
     {
831
-        $formatter = function (LibXMLError $error): string {
831
+        $formatter = function(LibXMLError $error): string {
832 832
             return sprintf(
833 833
                 'libxml error: %s%s:%d',
834 834
                 $error->message,
Please login to merge, or discard this patch.