Failed Conditions
Push — develop ( 7b23d3...7f775d )
by Guilherme
63:14
created
lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -471,7 +471,7 @@
 block discarded – undo
471 471
      *
472 472
      * @todo guilhermeblanco Remove nullable typehint once embeddables are back
473 473
      *
474
-     * @return Mapping\Property|null
474
+     * @return Mapping\Property
475 475
      */
476 476
     private function convertPropertyAnnotationsToProperty(
477 477
         array $propertyAnnotations,
Please login to merge, or discard this patch.
Spacing   +40 added lines, -40 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\Mapping\Driver;
6 6
 
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
             return $this->classNames;
186 186
         }
187 187
 
188
-        if (!$this->paths) {
188
+        if ( ! $this->paths) {
189 189
             throw Mapping\MappingException::pathRequired();
190 190
         }
191 191
 
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
                     new \RecursiveDirectoryIterator($path, \FilesystemIterator::SKIP_DOTS),
203 203
                     \RecursiveIteratorIterator::LEAVES_ONLY
204 204
                 ),
205
-                '/^.+' . preg_quote($this->fileExtension) . '$/i',
205
+                '/^.+'.preg_quote($this->fileExtension).'$/i',
206 206
                 \RecursiveRegexIterator::GET_MATCH
207 207
             );
208 208
 
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
     {
255 255
         $reflectionClass = $metadata->getReflectionClass();
256 256
 
257
-        if (! $reflectionClass) {
257
+        if ( ! $reflectionClass) {
258 258
             // this happens when running annotation driver in combination with
259 259
             // static reflection services. This is not the nicest fix
260 260
             $reflectionClass = new \ReflectionClass($metadata->getClassName());
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
                 $classMetadata
290 290
             );
291 291
 
292
-            if (! $property) {
292
+            if ( ! $property) {
293 293
                 continue;
294 294
             }
295 295
 
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
     )
363 363
     {
364 364
         /** @var Annotation\Entity $entityAnnot */
365
-        $entityAnnot  = $classAnnotations[Annotation\Entity::class];
365
+        $entityAnnot = $classAnnotations[Annotation\Entity::class];
366 366
 
367 367
         if ($entityAnnot->repositoryClass !== null) {
368 368
             $metadata->setCustomRepositoryClassName(
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
         array $propertyAnnotations,
478 478
         \ReflectionProperty $reflectionProperty,
479 479
         Mapping\ClassMetadata $metadata
480
-    ) : ?Mapping\Property
480
+    ) : ? Mapping\Property
481 481
     {
482 482
         switch (true) {
483 483
             case isset($propertyAnnotations[Annotation\Column::class]):
@@ -603,11 +603,11 @@  discard block
 block discarded – undo
603 603
         $assocMetadata->setOrphanRemoval($oneToOneAnnot->orphanRemoval);
604 604
         $assocMetadata->setFetchMode($this->getFetchMode($className, $oneToOneAnnot->fetch));
605 605
 
606
-        if (! empty($oneToOneAnnot->mappedBy)) {
606
+        if ( ! empty($oneToOneAnnot->mappedBy)) {
607 607
             $assocMetadata->setMappedBy($oneToOneAnnot->mappedBy);
608 608
         }
609 609
 
610
-        if (! empty($oneToOneAnnot->inversedBy)) {
610
+        if ( ! empty($oneToOneAnnot->inversedBy)) {
611 611
             $assocMetadata->setInversedBy($oneToOneAnnot->inversedBy);
612 612
         }
613 613
 
@@ -660,13 +660,13 @@  discard block
 block discarded – undo
660 660
         $fieldName      = $reflProperty->getName();
661 661
         $manyToOneAnnot = $propertyAnnotations[Annotation\ManyToOne::class];
662 662
         $assocMetadata  = new Mapping\ManyToOneAssociationMetadata($fieldName);
663
-        $targetEntity  = $metadata->fullyQualifiedClassName($manyToOneAnnot->targetEntity);
663
+        $targetEntity = $metadata->fullyQualifiedClassName($manyToOneAnnot->targetEntity);
664 664
 
665 665
         $assocMetadata->setTargetEntity($targetEntity);
666 666
         $assocMetadata->setCascade($this->getCascade($className, $fieldName, $manyToOneAnnot->cascade));
667 667
         $assocMetadata->setFetchMode($this->getFetchMode($className, $manyToOneAnnot->fetch));
668 668
 
669
-        if (! empty($manyToOneAnnot->inversedBy)) {
669
+        if ( ! empty($manyToOneAnnot->inversedBy)) {
670 670
             $assocMetadata->setInversedBy($manyToOneAnnot->inversedBy);
671 671
         }
672 672
 
@@ -719,18 +719,18 @@  discard block
 block discarded – undo
719 719
         $fieldName      = $reflProperty->getName();
720 720
         $oneToManyAnnot = $propertyAnnotations[Annotation\OneToMany::class];
721 721
         $assocMetadata  = new Mapping\OneToManyAssociationMetadata($fieldName);
722
-        $targetEntity  = $metadata->fullyQualifiedClassName($oneToManyAnnot->targetEntity);
722
+        $targetEntity = $metadata->fullyQualifiedClassName($oneToManyAnnot->targetEntity);
723 723
 
724 724
         $assocMetadata->setTargetEntity($targetEntity);
725 725
         $assocMetadata->setCascade($this->getCascade($className, $fieldName, $oneToManyAnnot->cascade));
726 726
         $assocMetadata->setOrphanRemoval($oneToManyAnnot->orphanRemoval);
727 727
         $assocMetadata->setFetchMode($this->getFetchMode($className, $oneToManyAnnot->fetch));
728 728
 
729
-        if (! empty($oneToManyAnnot->mappedBy)) {
729
+        if ( ! empty($oneToManyAnnot->mappedBy)) {
730 730
             $assocMetadata->setMappedBy($oneToManyAnnot->mappedBy);
731 731
         }
732 732
 
733
-        if (! empty($oneToManyAnnot->indexBy)) {
733
+        if ( ! empty($oneToManyAnnot->indexBy)) {
734 734
             $assocMetadata->setIndexedBy($oneToManyAnnot->indexBy);
735 735
         }
736 736
 
@@ -774,15 +774,15 @@  discard block
 block discarded – undo
774 774
         $assocMetadata->setOrphanRemoval($manyToManyAnnot->orphanRemoval);
775 775
         $assocMetadata->setFetchMode($this->getFetchMode($className, $manyToManyAnnot->fetch));
776 776
 
777
-        if (! empty($manyToManyAnnot->mappedBy)) {
777
+        if ( ! empty($manyToManyAnnot->mappedBy)) {
778 778
             $assocMetadata->setMappedBy($manyToManyAnnot->mappedBy);
779 779
         }
780 780
 
781
-        if (! empty($manyToManyAnnot->inversedBy)) {
781
+        if ( ! empty($manyToManyAnnot->inversedBy)) {
782 782
             $assocMetadata->setInversedBy($manyToManyAnnot->inversedBy);
783 783
         }
784 784
 
785
-        if (! empty($manyToManyAnnot->indexBy)) {
785
+        if ( ! empty($manyToManyAnnot->indexBy)) {
786 786
             $assocMetadata->setIndexedBy($manyToManyAnnot->indexBy);
787 787
         }
788 788
 
@@ -839,15 +839,15 @@  discard block
 block discarded – undo
839 839
 
840 840
         $fieldMetadata->setType(Type::getType($columnAnnot->type));
841 841
 
842
-        if (! empty($columnAnnot->name)) {
842
+        if ( ! empty($columnAnnot->name)) {
843 843
             $fieldMetadata->setColumnName($columnAnnot->name);
844 844
         }
845 845
 
846
-        if (! empty($columnAnnot->columnDefinition)) {
846
+        if ( ! empty($columnAnnot->columnDefinition)) {
847 847
             $fieldMetadata->setColumnDefinition($columnAnnot->columnDefinition);
848 848
         }
849 849
 
850
-        if (! empty($columnAnnot->length)) {
850
+        if ( ! empty($columnAnnot->length)) {
851 851
             $fieldMetadata->setLength($columnAnnot->length);
852 852
         }
853 853
 
@@ -876,11 +876,11 @@  discard block
 block discarded – undo
876 876
     {
877 877
         $table = new Mapping\TableMetadata();
878 878
 
879
-        if (! empty($tableAnnot->name)) {
879
+        if ( ! empty($tableAnnot->name)) {
880 880
             $table->setName($tableAnnot->name);
881 881
         }
882 882
 
883
-        if (! empty($tableAnnot->schema)) {
883
+        if ( ! empty($tableAnnot->schema)) {
884 884
             $table->setSchema($tableAnnot->schema);
885 885
         }
886 886
 
@@ -923,11 +923,11 @@  discard block
 block discarded – undo
923 923
     {
924 924
         $joinTable = new Mapping\JoinTableMetadata();
925 925
 
926
-        if (! empty($joinTableAnnot->name)) {
926
+        if ( ! empty($joinTableAnnot->name)) {
927 927
             $joinTable->setName($joinTableAnnot->name);
928 928
         }
929 929
 
930
-        if (! empty($joinTableAnnot->schema)) {
930
+        if ( ! empty($joinTableAnnot->schema)) {
931 931
             $joinTable->setSchema($joinTableAnnot->schema);
932 932
         }
933 933
 
@@ -960,22 +960,22 @@  discard block
 block discarded – undo
960 960
         $joinColumn = new Mapping\JoinColumnMetadata();
961 961
 
962 962
         // @todo Remove conditionals for name and referencedColumnName once naming strategy is brought into drivers
963
-        if (! empty($joinColumnAnnot->name)) {
963
+        if ( ! empty($joinColumnAnnot->name)) {
964 964
             $joinColumn->setColumnName($joinColumnAnnot->name);
965 965
         }
966 966
 
967
-        if (! empty($joinColumnAnnot->referencedColumnName)) {
967
+        if ( ! empty($joinColumnAnnot->referencedColumnName)) {
968 968
             $joinColumn->setReferencedColumnName($joinColumnAnnot->referencedColumnName);
969 969
         }
970 970
 
971 971
         $joinColumn->setNullable($joinColumnAnnot->nullable);
972 972
         $joinColumn->setUnique($joinColumnAnnot->unique);
973 973
 
974
-        if (! empty($joinColumnAnnot->fieldName)) {
974
+        if ( ! empty($joinColumnAnnot->fieldName)) {
975 975
             $joinColumn->setAliasedName($joinColumnAnnot->fieldName);
976 976
         }
977 977
 
978
-        if (! empty($joinColumnAnnot->columnDefinition)) {
978
+        if ( ! empty($joinColumnAnnot->columnDefinition)) {
979 979
             $joinColumn->setColumnDefinition($joinColumnAnnot->columnDefinition);
980 980
         }
981 981
 
@@ -1002,7 +1002,7 @@  discard block
 block discarded – undo
1002 1002
     ) : Mapping\CacheMetadata
1003 1003
     {
1004 1004
         $baseRegion    = strtolower(str_replace('\\', '_', $metadata->getRootClassName()));
1005
-        $defaultRegion = $baseRegion . ($fieldName ? '__' . $fieldName : '');
1005
+        $defaultRegion = $baseRegion.($fieldName ? '__'.$fieldName : '');
1006 1006
 
1007 1007
         $usage = constant(sprintf('%s::%s', Mapping\CacheUsage::class, $cacheAnnot->usage));
1008 1008
         $region = $cacheAnnot->region ?: $defaultRegion;
@@ -1084,11 +1084,11 @@  discard block
 block discarded – undo
1084 1084
             $discriminatorColumn->setType(Type::getType($typeName));
1085 1085
             $discriminatorColumn->setColumnName($discriminatorColumnAnnotation->name);
1086 1086
 
1087
-            if (! empty($discriminatorColumnAnnotation->columnDefinition)) {
1087
+            if ( ! empty($discriminatorColumnAnnotation->columnDefinition)) {
1088 1088
                 $discriminatorColumn->setColumnDefinition($discriminatorColumnAnnotation->columnDefinition);
1089 1089
             }
1090 1090
 
1091
-            if (! empty($discriminatorColumnAnnotation->length)) {
1091
+            if ( ! empty($discriminatorColumnAnnotation->length)) {
1092 1092
                 $discriminatorColumn->setLength($discriminatorColumnAnnotation->length);
1093 1093
             }
1094 1094
         }
@@ -1099,7 +1099,7 @@  discard block
 block discarded – undo
1099 1099
         if (isset($classAnnotations[Annotation\DiscriminatorMap::class])) {
1100 1100
             $discriminatorMapAnnotation = $classAnnotations[Annotation\DiscriminatorMap::class];
1101 1101
             $discriminatorMap           = array_map(
1102
-                function ($className) use ($metadata) {
1102
+                function($className) use ($metadata) {
1103 1103
                     return $metadata->fullyQualifiedClassName($className);
1104 1104
                 },
1105 1105
                 $discriminatorMapAnnotation->value
@@ -1129,12 +1129,12 @@  discard block
 block discarded – undo
1129 1129
         if (isset($classAnnotations[Annotation\NamedQueries::class])) {
1130 1130
             $namedQueriesAnnot = $classAnnotations[Annotation\NamedQueries::class];
1131 1131
 
1132
-            if (! is_array($namedQueriesAnnot->value)) {
1132
+            if ( ! is_array($namedQueriesAnnot->value)) {
1133 1133
                 throw new \UnexpectedValueException("@NamedQueries should contain an array of @NamedQuery annotations.");
1134 1134
             }
1135 1135
 
1136 1136
             foreach ($namedQueriesAnnot->value as $namedQuery) {
1137
-                if (! ($namedQuery instanceof Annotation\NamedQuery)) {
1137
+                if ( ! ($namedQuery instanceof Annotation\NamedQuery)) {
1138 1138
                     throw new \UnexpectedValueException("@NamedQueries should contain an array of @NamedQuery annotations.");
1139 1139
                 }
1140 1140
 
@@ -1232,7 +1232,7 @@  discard block
 block discarded – undo
1232 1232
             foreach ($entityListenersAnnot->value as $item) {
1233 1233
                 $listenerClassName = $metadata->fullyQualifiedClassName($item);
1234 1234
 
1235
-                if (! class_exists($listenerClassName)) {
1235
+                if ( ! class_exists($listenerClassName)) {
1236 1236
                     throw Mapping\MappingException::entityListenerClassNotFound(
1237 1237
                         $listenerClassName,
1238 1238
                         $metadata->getClassName()
@@ -1274,7 +1274,7 @@  discard block
 block discarded – undo
1274 1274
                 $fieldName = $associationOverride->name;
1275 1275
                 $property  = $metadata->getProperty($fieldName);
1276 1276
 
1277
-                if (! $property) {
1277
+                if ( ! $property) {
1278 1278
                     throw Mapping\MappingException::invalidOverrideFieldName($metadata->getClassName(), $fieldName);
1279 1279
                 }
1280 1280
 
@@ -1308,7 +1308,7 @@  discard block
 block discarded – undo
1308 1308
                 // Check for fetch
1309 1309
                 if ($associationOverride->fetch) {
1310 1310
                     $override->setFetchMode(
1311
-                        constant(Mapping\FetchMode::class . '::' . $associationOverride->fetch)
1311
+                        constant(Mapping\FetchMode::class.'::'.$associationOverride->fetch)
1312 1312
                     );
1313 1313
                 }
1314 1314
 
@@ -1425,7 +1425,7 @@  discard block
 block discarded – undo
1425 1425
         $classAnnotations = $this->reader->getClassAnnotations($reflectionClass);
1426 1426
 
1427 1427
         foreach ($classAnnotations as $key => $annot) {
1428
-            if (! is_numeric($key)) {
1428
+            if ( ! is_numeric($key)) {
1429 1429
                 continue;
1430 1430
             }
1431 1431
 
@@ -1445,7 +1445,7 @@  discard block
 block discarded – undo
1445 1445
         $propertyAnnotations = $this->reader->getPropertyAnnotations($reflectionProperty);
1446 1446
 
1447 1447
         foreach ($propertyAnnotations as $key => $annot) {
1448
-            if (! is_numeric($key)) {
1448
+            if ( ! is_numeric($key)) {
1449 1449
                 continue;
1450 1450
             }
1451 1451
 
@@ -1465,7 +1465,7 @@  discard block
 block discarded – undo
1465 1465
         $methodAnnotations = $this->reader->getMethodAnnotations($reflectionMethod);
1466 1466
 
1467 1467
         foreach ($methodAnnotations as $key => $annot) {
1468
-            if (! is_numeric($key)) {
1468
+            if ( ! is_numeric($key)) {
1469 1469
                 continue;
1470 1470
             }
1471 1471
 
Please login to merge, or discard this patch.
tests/Doctrine/Tests/ORM/Mapping/AnnotationDriverTest.php 1 patch
Spacing   +4 added lines, -4 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\Tests\ORM\Mapping;
6 6
 
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
     protected function loadDriverForCMSModels()
120 120
     {
121 121
         $annotationDriver = $this->loadDriver();
122
-        $annotationDriver->addPaths([__DIR__ . '/../../Models/CMS/']);
122
+        $annotationDriver->addPaths([__DIR__.'/../../Models/CMS/']);
123 123
         return $annotationDriver;
124 124
     }
125 125
 
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
     public function testJoinTablesWithMappedSuperclassForAnnotationDriver()
142 142
     {
143 143
         $annotationDriver = $this->loadDriver();
144
-        $annotationDriver->addPaths([__DIR__ . '/../../Models/DirectoryTree/']);
144
+        $annotationDriver->addPaths([__DIR__.'/../../Models/DirectoryTree/']);
145 145
 
146 146
         $em = $this->getTestEntityManager();
147 147
         $em->getConfiguration()->setMetadataDriverImpl($annotationDriver);
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 
172 172
         $this->expectException(MappingException::class);
173 173
         $this->expectExceptionMessage(
174
-            "It is illegal to put an inverse side one-to-many or many-to-many association on " .
174
+            "It is illegal to put an inverse side one-to-many or many-to-many association on ".
175 175
             "mapped superclass 'Doctrine\Tests\ORM\Mapping\InvalidMappedSuperClass#users'"
176 176
         );
177 177
 
Please login to merge, or discard this patch.