Skip to content

Commit 21c3294

Browse files
Merge branch '4.4' into 5.4
* 4.4: [HttpClient] Fix seeking in not-yet-initialized requests [Serializer] Allow getting discriminated type by class name
2 parents 4c0f1f5 + 6e01d63 commit 21c3294

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

Mapping/ClassDiscriminatorMapping.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function getClassForType(string $type): ?string
5353
public function getMappedObjectType($object): ?string
5454
{
5555
foreach ($this->typesMapping as $type => $typeClass) {
56-
if (is_a($object, $typeClass)) {
56+
if (is_a($object, $typeClass, true)) {
5757
return $type;
5858
}
5959
}

Tests/Mapping/ClassDiscriminatorMappingTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public function testMappedObjectType()
3939
'third' => AbstractDummyThirdChild::class,
4040
]);
4141

42+
$this->assertEquals('first', $mapping->getMappedObjectType(AbstractDummyFirstChild::class));
4243
$this->assertEquals('first', $mapping->getMappedObjectType(new AbstractDummyFirstChild()));
4344
$this->assertNull($mapping->getMappedObjectType(new AbstractDummySecondChild()));
4445
$this->assertSame('third', $mapping->getMappedObjectType(new AbstractDummyThirdChild()));

0 commit comments

Comments
 (0)