@@ -727,10 +727,8 @@ public function testDefaultStorageStrategyOfEmbeddedDocumentFields(): void
727727 public $ many ;
728728 };
729729
730- $ cm = new ClassMetadata ($ object ::class);
731- $ reflectionProp = new ReflectionProperty (ClassMetadata::class, 'isEmbeddedDocument ' );
732- $ reflectionProp ->setAccessible (true );
733- $ reflectionProp ->setValue ($ cm , true );
730+ $ cm = new ClassMetadata ($ object ::class);
731+ new ReflectionProperty (ClassMetadata::class, 'isEmbeddedDocument ' )->setValue ($ cm , true );
734732
735733 $ mapping = $ cm ->mapField ([
736734 'fieldName ' => 'many ' ,
@@ -750,10 +748,8 @@ public function testOwningAndInversedRefsNeedTargetDocument(array $config): void
750748 'strategy ' => ClassMetadata::STORAGE_STRATEGY_ATOMIC_SET ,
751749 ]);
752750
753- $ cm = new ClassMetadata ('stdClass ' );
754- $ reflectionProp = new ReflectionProperty (ClassMetadata::class, 'isEmbeddedDocument ' );
755- $ reflectionProp ->setAccessible (true );
756- $ reflectionProp ->setValue ($ cm , true );
751+ $ cm = new ClassMetadata ('stdClass ' );
752+ new ReflectionProperty (ClassMetadata::class, 'isEmbeddedDocument ' )->setValue ($ cm , true );
757753 $ this ->expectException (MappingException::class);
758754 $ cm ->mapField ($ config );
759755 }
@@ -827,10 +823,11 @@ public function testSetShardKeyForClassWithoutInheritance(): void
827823
828824 public function testSetShardKeyForClassWithSingleCollectionInheritance (): void
829825 {
830- $ cm = new ClassMetadata ('stdClass ' );
831- $ reflectionProp = new ReflectionProperty (ClassMetadata::class, 'inheritanceType ' );
832- $ reflectionProp ->setAccessible (true );
833- $ reflectionProp ->setValue ($ cm , ClassMetadata::INHERITANCE_TYPE_SINGLE_COLLECTION );
826+ $ cm = new ClassMetadata ('stdClass ' );
827+ new ReflectionProperty (ClassMetadata::class, 'inheritanceType ' )->setValue (
828+ $ cm ,
829+ ClassMetadata::INHERITANCE_TYPE_SINGLE_COLLECTION ,
830+ );
834831 $ cm ->setShardKey (['id ' => 'asc ' ]);
835832
836833 $ shardKey = $ cm ->getShardKey ();
@@ -842,9 +839,10 @@ public function testSetShardKeyForClassWithSingleCollectionInheritanceWhichAlrea
842839 {
843840 $ cm = new ClassMetadata ('stdClass ' );
844841 $ cm ->setShardKey (['id ' => 'asc ' ]);
845- $ reflectionProp = new ReflectionProperty (ClassMetadata::class, 'inheritanceType ' );
846- $ reflectionProp ->setAccessible (true );
847- $ reflectionProp ->setValue ($ cm , ClassMetadata::INHERITANCE_TYPE_SINGLE_COLLECTION );
842+ new ReflectionProperty (ClassMetadata::class, 'inheritanceType ' )->setValue (
843+ $ cm ,
844+ ClassMetadata::INHERITANCE_TYPE_SINGLE_COLLECTION ,
845+ );
848846
849847 $ this ->expectException (MappingException::class);
850848 $ this ->expectExceptionMessage ('Shard key overriding in subclass is forbidden for single collection inheritance ' );
@@ -853,10 +851,11 @@ public function testSetShardKeyForClassWithSingleCollectionInheritanceWhichAlrea
853851
854852 public function testSetShardKeyForClassWithCollPerClassInheritance (): void
855853 {
856- $ cm = new ClassMetadata ('stdClass ' );
857- $ reflectionProp = new ReflectionProperty (ClassMetadata::class, 'inheritanceType ' );
858- $ reflectionProp ->setAccessible (true );
859- $ reflectionProp ->setValue ($ cm , ClassMetadata::INHERITANCE_TYPE_COLLECTION_PER_CLASS );
854+ $ cm = new ClassMetadata ('stdClass ' );
855+ new ReflectionProperty (ClassMetadata::class, 'inheritanceType ' )->setValue (
856+ $ cm ,
857+ ClassMetadata::INHERITANCE_TYPE_COLLECTION_PER_CLASS ,
858+ );
860859 $ cm ->setShardKey (['id ' => 'asc ' ]);
861860
862861 $ shardKey = $ cm ->getShardKey ();
0 commit comments