Failed Conditions
Push — master ( 148895...b07393 )
by Guilherme
09:59
created
tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 use function strtoupper;
37 37
 use function unserialize;
38 38
 
39
-require_once __DIR__ . '/../../Models/Global/GlobalNamespaceModel.php';
39
+require_once __DIR__.'/../../Models/Global/GlobalNamespaceModel.php';
40 40
 
41 41
 class ClassMetadataTest extends OrmTestCase
42 42
 {
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
      */
166 166
     public function testMapAssociationInGlobalNamespace() : void
167 167
     {
168
-        require_once __DIR__ . '/../../Models/Global/GlobalNamespaceModel.php';
168
+        require_once __DIR__.'/../../Models/Global/GlobalNamespaceModel.php';
169 169
 
170 170
         $cm = new ClassMetadata(DoctrineGlobalArticle::class, null);
171 171
         $cm->setTable(new Mapping\TableMetadata('doctrine_global_article'));
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
      */
266 266
     public function testSetDiscriminatorMapInGlobalNamespace() : void
267 267
     {
268
-        require_once __DIR__ . '/../../Models/Global/GlobalNamespaceModel.php';
268
+        require_once __DIR__.'/../../Models/Global/GlobalNamespaceModel.php';
269 269
 
270 270
         $cm = new ClassMetadata('DoctrineGlobalUser', null);
271 271
         $cm->setTable(new Mapping\TableMetadata('doctrine_global_user'));
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
      */
282 282
     public function testSetSubClassesInGlobalNamespace() : void
283 283
     {
284
-        require_once __DIR__ . '/../../Models/Global/GlobalNamespaceModel.php';
284
+        require_once __DIR__.'/../../Models/Global/GlobalNamespaceModel.php';
285 285
 
286 286
         $cm = new ClassMetadata('DoctrineGlobalUser', null);
287 287
         $cm->setTable(new Mapping\TableMetadata('doctrine_global_user'));
@@ -767,7 +767,7 @@  discard block
 block discarded – undo
767 767
     public function testEmptyFieldNameThrowsException() : void
768 768
     {
769 769
         $this->expectException(MappingException::class);
770
-        $this->expectExceptionMessage("The field or association mapping misses the 'fieldName' attribute in entity '" . CMS\CmsUser::class . "'.");
770
+        $this->expectExceptionMessage("The field or association mapping misses the 'fieldName' attribute in entity '".CMS\CmsUser::class."'.");
771 771
 
772 772
         $cm = new ClassMetadata(CMS\CmsUser::class, null);
773 773
         $cm->setTable(new Mapping\TableMetadata('cms_users'));
@@ -819,7 +819,7 @@  discard block
 block discarded – undo
819 819
         $cm->addLifecycleCallback('postLoad', 'notfound');
820 820
 
821 821
         $this->expectException(MappingException::class);
822
-        $this->expectExceptionMessage("Entity '" . CMS\CmsUser::class . "' has no public method 'notfound' to be registered as lifecycle callback.");
822
+        $this->expectExceptionMessage("Entity '".CMS\CmsUser::class."' has no public method 'notfound' to be registered as lifecycle callback.");
823 823
 
824 824
         $cm->validateLifecycleCallbacks(new RuntimeReflectionService());
825 825
     }
@@ -841,7 +841,7 @@  discard block
 block discarded – undo
841 841
         $cm->addProperty($association);
842 842
 
843 843
         $this->expectException(MappingException::class);
844
-        $this->expectExceptionMessage("The target-entity 'UnknownClass' cannot be found in '" . CMS\CmsUser::class . "#address'.");
844
+        $this->expectExceptionMessage("The target-entity 'UnknownClass' cannot be found in '".CMS\CmsUser::class."#address'.");
845 845
 
846 846
         $cm->validateAssociations();
847 847
     }
@@ -1089,6 +1089,6 @@  discard block
 block discarded – undo
1089 1089
      */
1090 1090
     public function propertyToColumnName(string $propertyName, ?string $className = null) : string
1091 1091
     {
1092
-        return strtolower($this->classToTableName($className)) . '_' . $propertyName;
1092
+        return strtolower($this->classToTableName($className)).'_'.$propertyName;
1093 1093
     }
1094 1094
 }
Please login to merge, or discard this patch.
lib/Doctrine/ORM/Mapping/ClassMetadata.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -220,11 +220,11 @@  discard block
 block discarded – undo
220 220
             $this->setCache(clone $parent->cache);
221 221
         }
222 222
 
223
-        if (! empty($parent->lifecycleCallbacks)) {
223
+        if ( ! empty($parent->lifecycleCallbacks)) {
224 224
             $this->lifecycleCallbacks = $parent->lifecycleCallbacks;
225 225
         }
226 226
 
227
-        if (! empty($parent->entityListeners)) {
227
+        if ( ! empty($parent->entityListeners)) {
228 228
             $this->entityListeners = $parent->entityListeners;
229 229
         }
230 230
     }
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
      */
292 292
     public function __toString()
293 293
     {
294
-        return self::class . '@' . spl_object_id($this);
294
+        return self::class.'@'.spl_object_id($this);
295 295
     }
296 296
 
297 297
     /**
@@ -387,11 +387,11 @@  discard block
 block discarded – undo
387 387
      */
388 388
     public function isIdentifier(string $fieldName) : bool
389 389
     {
390
-        if (! $this->identifier) {
390
+        if ( ! $this->identifier) {
391 391
             return false;
392 392
         }
393 393
 
394
-        if (! $this->isIdentifierComposite()) {
394
+        if ( ! $this->isIdentifierComposite()) {
395 395
             return $fieldName === $this->identifier[0];
396 396
         }
397 397
 
@@ -415,11 +415,11 @@  discard block
 block discarded – undo
415 415
         }
416 416
 
417 417
         // Verify & complete identifier mapping
418
-        if (! $this->identifier) {
418
+        if ( ! $this->identifier) {
419 419
             throw MappingException::identifierRequired($this->className);
420 420
         }
421 421
 
422
-        $explicitlyGeneratedProperties = array_filter($this->properties, static function (Property $property) : bool {
422
+        $explicitlyGeneratedProperties = array_filter($this->properties, static function(Property $property) : bool {
423 423
             return $property instanceof FieldMetadata
424 424
                 && $property->isPrimaryKey()
425 425
                 && $property->hasValueGenerator();
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
         foreach ($this->lifecycleCallbacks as $callbacks) {
441 441
             /** @var array $callbacks */
442 442
             foreach ($callbacks as $callbackFuncName) {
443
-                if (! $reflectionService->hasPublicMethod($this->className, $callbackFuncName)) {
443
+                if ( ! $reflectionService->hasPublicMethod($this->className, $callbackFuncName)) {
444 444
                     throw MappingException::lifecycleCallbackMethodNotFound($this->className, $callbackFuncName);
445 445
                 }
446 446
             }
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
             throw MappingException::singleIdNotAllowedOnCompositePrimaryKey($this->className);
470 470
         }
471 471
 
472
-        if (! isset($this->identifier[0])) {
472
+        if ( ! isset($this->identifier[0])) {
473 473
             throw MappingException::noIdDefined($this->className);
474 474
         }
475 475
 
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
             // Association defined as Id field
529 529
             $targetClass = $em->getClassMetadata($property->getTargetEntity());
530 530
 
531
-            if (! $property->isOwningSide()) {
531
+            if ( ! $property->isOwningSide()) {
532 532
                 $property    = $targetClass->getProperty($property->getMappedBy());
533 533
                 $targetClass = $em->getClassMetadata($property->getTargetEntity());
534 534
             }
@@ -542,7 +542,7 @@  discard block
 block discarded – undo
542 542
                 $columnName           = $joinColumn->getColumnName();
543 543
                 $referencedColumnName = $joinColumn->getReferencedColumnName();
544 544
 
545
-                if (! $joinColumn->getType()) {
545
+                if ( ! $joinColumn->getType()) {
546 546
                     $joinColumn->setType(PersisterHelper::getTypeOfColumn($referencedColumnName, $targetClass, $em));
547 547
                 }
548 548
 
@@ -576,10 +576,10 @@  discard block
 block discarded – undo
576 576
     {
577 577
         $schema = $this->getSchemaName() === null
578 578
             ? ''
579
-            : $this->getSchemaName() . '_';
579
+            : $this->getSchemaName().'_';
580 580
 
581 581
         // replace dots with underscores because PostgreSQL creates temporary tables in a special schema
582
-        return $schema . $this->getTableName() . '_id_tmp';
582
+        return $schema.$this->getTableName().'_id_tmp';
583 583
     }
584 584
 
585 585
     /**
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
      */
614 614
     public function setInheritanceType($type) : void
615 615
     {
616
-        if (! $this->isInheritanceType($type)) {
616
+        if ( ! $this->isInheritanceType($type)) {
617 617
             throw MappingException::invalidInheritanceType($this->className, $type);
618 618
         }
619 619
 
@@ -631,7 +631,7 @@  discard block
 block discarded – undo
631 631
     {
632 632
         $fieldName = $property->getName();
633 633
 
634
-        if (! isset($this->properties[$fieldName])) {
634
+        if ( ! isset($this->properties[$fieldName])) {
635 635
             throw MappingException::invalidOverrideFieldName($this->className, $fieldName);
636 636
         }
637 637
 
@@ -825,7 +825,7 @@  discard block
 block discarded – undo
825 825
         $inheritedProperty = $declaringClass->isMappedSuperclass ? clone $property : $property;
826 826
 
827 827
         if ($inheritedProperty instanceof FieldMetadata) {
828
-            if (! $declaringClass->isMappedSuperclass) {
828
+            if ( ! $declaringClass->isMappedSuperclass) {
829 829
                 $inheritedProperty->setTableName($property->getTableName());
830 830
             }
831 831
 
@@ -918,11 +918,11 @@  discard block
 block discarded – undo
918 918
             'method' => $methodName,
919 919
         ];
920 920
 
921
-        if (! class_exists($class)) {
921
+        if ( ! class_exists($class)) {
922 922
             throw MappingException::entityListenerClassNotFound($class, $this->className);
923 923
         }
924 924
 
925
-        if (! method_exists($class, $methodName)) {
925
+        if ( ! method_exists($class, $methodName)) {
926 926
             throw MappingException::entityListenerMethodNotFound($class, $methodName, $this->className);
927 927
         }
928 928
 
@@ -990,7 +990,7 @@  discard block
 block discarded – undo
990 990
             return;
991 991
         }
992 992
 
993
-        if (! (class_exists($className) || interface_exists($className))) {
993
+        if ( ! (class_exists($className) || interface_exists($className))) {
994 994
             throw MappingException::invalidClassInDiscriminatorMap($className, $this->className);
995 995
         }
996 996
 
Please login to merge, or discard this patch.
lib/Doctrine/ORM/Mapping/Driver/DatabaseDriver.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -145,8 +145,8 @@  discard block
 block discarded – undo
145 145
     ) : Mapping\ComponentMetadata {
146 146
         $this->reverseEngineerMappingFromDatabase();
147 147
 
148
-        if (! isset($this->classToTableNames[$className])) {
149
-            throw new InvalidArgumentException('Unknown class ' . $className);
148
+        if ( ! isset($this->classToTableNames[$className])) {
149
+            throw new InvalidArgumentException('Unknown class '.$className);
150 150
         }
151 151
 
152 152
         $metadata = new Mapping\ClassMetadata($className, $parent);
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
                     }
176 176
                 }
177 177
 
178
-                if (! $otherFk) {
178
+                if ( ! $otherFk) {
179 179
                     // the definition of this many to many table does not contain
180 180
                     // enough foreign key information to continue reverse engineering.
181 181
                     continue;
@@ -258,9 +258,9 @@  discard block
 block discarded – undo
258 258
                 $allForeignKeyColumns = array_merge($allForeignKeyColumns, $foreignKey->getLocalColumns());
259 259
             }
260 260
 
261
-            if (! $table->hasPrimaryKey()) {
261
+            if ( ! $table->hasPrimaryKey()) {
262 262
                 throw new Mapping\MappingException(
263
-                    'Table ' . $table->getName() . ' has no primary key. Doctrine does not ' .
263
+                    'Table '.$table->getName().' has no primary key. Doctrine does not '.
264 264
                     "support reverse engineering from tables that don't have a primary key."
265 265
                 );
266 266
             }
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
             }
458 458
 
459 459
             // Here we need to check if $fkColumns are the same as $primaryKeys
460
-            if (! array_diff($fkColumns, $primaryKeys)) {
460
+            if ( ! array_diff($fkColumns, $primaryKeys)) {
461 461
                 $metadata->addProperty($associationMapping);
462 462
             } else {
463 463
                 $metadata->addProperty($associationMapping);
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
      */
503 503
     private function getClassNameForTable($tableName)
504 504
     {
505
-        return $this->namespace . (
505
+        return $this->namespace.(
506 506
             $this->classNamesForTables[$tableName]
507 507
                 ?? Inflector::classify(strtolower($tableName))
508 508
         );
Please login to merge, or discard this patch.
lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
             return $this->classNames;
206 206
         }
207 207
 
208
-        if (! $this->paths) {
208
+        if ( ! $this->paths) {
209 209
             throw Mapping\MappingException::pathRequired();
210 210
         }
211 211
 
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
         $includedFiles = [];
214 214
 
215 215
         foreach ($this->paths as $path) {
216
-            if (! is_dir($path)) {
216
+            if ( ! is_dir($path)) {
217 217
                 throw Mapping\MappingException::fileMappingDriversRequireConfiguredDirectoryPath($path);
218 218
             }
219 219
 
@@ -222,14 +222,14 @@  discard block
 block discarded – undo
222 222
                     new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS),
223 223
                     RecursiveIteratorIterator::LEAVES_ONLY
224 224
                 ),
225
-                '/^.+' . preg_quote($this->fileExtension) . '$/i',
225
+                '/^.+'.preg_quote($this->fileExtension).'$/i',
226 226
                 RecursiveRegexIterator::GET_MATCH
227 227
             );
228 228
 
229 229
             foreach ($iterator as $file) {
230 230
                 $sourceFile = $file[0];
231 231
 
232
-                if (! preg_match('(^phar:)i', $sourceFile)) {
232
+                if ( ! preg_match('(^phar:)i', $sourceFile)) {
233 233
                     $sourceFile = realpath($sourceFile);
234 234
                 }
235 235
 
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
         if ($parent && $parent->inheritanceType === Mapping\InheritanceType::SINGLE_TABLE) {
408 408
             // Handle the case where a middle mapped super class inherits from a single table inheritance tree.
409 409
             do {
410
-                if (! $parent->isMappedSuperclass) {
410
+                if ( ! $parent->isMappedSuperclass) {
411 411
                     $metadata->setTable($parent->table);
412 412
 
413 413
                     break;
@@ -692,7 +692,7 @@  discard block
 block discarded – undo
692 692
             ];
693 693
 
694 694
             foreach ($entityListenersAnnot->value as $listenerClassName) {
695
-                if (! class_exists($listenerClassName)) {
695
+                if ( ! class_exists($listenerClassName)) {
696 696
                     throw Mapping\MappingException::entityListenerClassNotFound(
697 697
                         $listenerClassName,
698 698
                         $metadata->getClassName()
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
                 $fieldName = $associationOverrideAnnotation->name;
735 735
                 $property  = $metadata->getProperty($fieldName);
736 736
 
737
-                if (! $property) {
737
+                if ( ! $property) {
738 738
                     throw Mapping\MappingException::invalidOverrideFieldName($metadata->getClassName(), $fieldName);
739 739
                 }
740 740
 
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
 
792 792
                 // Check for fetch
793 793
                 if ($associationOverrideAnnotation->fetch) {
794
-                    $override->setFetchMode(constant(Mapping\FetchMode::class . '::' . $associationOverrideAnnotation->fetch));
794
+                    $override->setFetchMode(constant(Mapping\FetchMode::class.'::'.$associationOverrideAnnotation->fetch));
795 795
                 }
796 796
 
797 797
                 $metadata->setPropertyOverride($override);
@@ -812,7 +812,7 @@  discard block
 block discarded – undo
812 812
                 $fieldName = $attributeOverrideAnnotation->name;
813 813
                 $property  = $metadata->getProperty($fieldName);
814 814
 
815
-                if (! $property) {
815
+                if ( ! $property) {
816 816
                     throw Mapping\MappingException::invalidOverrideFieldName($metadata->getClassName(), $fieldName);
817 817
                 }
818 818
 
@@ -843,7 +843,7 @@  discard block
 block discarded – undo
843 843
         $classAnnotations = $this->reader->getClassAnnotations($reflectionClass);
844 844
 
845 845
         foreach ($classAnnotations as $key => $annot) {
846
-            if (! is_numeric($key)) {
846
+            if ( ! is_numeric($key)) {
847 847
                 continue;
848 848
             }
849 849
 
@@ -861,7 +861,7 @@  discard block
 block discarded – undo
861 861
         $propertyAnnotations = $this->reader->getPropertyAnnotations($reflectionProperty);
862 862
 
863 863
         foreach ($propertyAnnotations as $key => $annot) {
864
-            if (! is_numeric($key)) {
864
+            if ( ! is_numeric($key)) {
865 865
                 continue;
866 866
             }
867 867
 
@@ -879,7 +879,7 @@  discard block
 block discarded – undo
879 879
         $methodAnnotations = $this->reader->getMethodAnnotations($reflectionMethod);
880 880
 
881 881
         foreach ($methodAnnotations as $key => $annot) {
882
-            if (! is_numeric($key)) {
882
+            if ( ! is_numeric($key)) {
883 883
                 continue;
884 884
             }
885 885
 
Please login to merge, or discard this patch.
lib/Doctrine/ORM/Mapping/ComponentMetadata.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@
 block discarded – undo
58 58
         // Restore ReflectionClass and properties
59 59
         $this->reflectionClass = $reflectionService->getClass($this->className);
60 60
 
61
-        if (! $this->reflectionClass) {
61
+        if ( ! $this->reflectionClass) {
62 62
             return;
63 63
         }
64 64
 
Please login to merge, or discard this patch.