Skip to content

Commit

Permalink
fix: perf regression with Symfony 6.3 (#5721)
Browse files Browse the repository at this point in the history
  • Loading branch information
dunglas committed Aug 4, 2023
1 parent e274585 commit 4dcfc16
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/Serializer/AbstractItemNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ public function supportsNormalization(mixed $data, string $format = null, array

public function getSupportedTypes(?string $format): array
{
return ['*' => true];
return [
'object' => true,
];
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/Hal/Serializer/ItemNormalizerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public function testSupportsNormalization(): void
$this->assertFalse($normalizer->supportsNormalization($dummy, 'xml'));
$this->assertFalse($normalizer->supportsNormalization($std, $normalizer::FORMAT));
$this->assertEmpty($normalizer->getSupportedTypes('xml'));
$this->assertSame(['*' => true], $normalizer->getSupportedTypes($normalizer::FORMAT));
$this->assertSame(['object' => true], $normalizer->getSupportedTypes($normalizer::FORMAT));

if (!method_exists(Serializer::class, 'getSupportedTypes')) {
$this->assertTrue($normalizer->hasCacheableSupportsMethod());
Expand Down
2 changes: 1 addition & 1 deletion tests/Serializer/AbstractItemNormalizerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function testSupportNormalizationAndSupportDenormalization(): void
$this->assertTrue($normalizer->supportsDenormalization($dummy, Dummy::class));
$this->assertFalse($normalizer->supportsDenormalization($std, \stdClass::class));
$this->assertFalse($normalizer->supportsNormalization([]));
$this->assertSame(['*' => true], $normalizer->getSupportedTypes('any'));
$this->assertSame(['object' => true], $normalizer->getSupportedTypes('any'));

if (!method_exists(Serializer::class, 'getSupportedTypes')) {
$this->assertTrue($normalizer->hasCacheableSupportsMethod());
Expand Down
2 changes: 1 addition & 1 deletion tests/Serializer/ItemNormalizerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function testSupportNormalization(): void
$this->assertTrue($normalizer->supportsDenormalization($dummy, Dummy::class));
$this->assertTrue($normalizer->supportsDenormalization($dummy, Dummy::class));
$this->assertFalse($normalizer->supportsDenormalization($std, \stdClass::class));
$this->assertSame(['*' => true], $normalizer->getSupportedTypes('any'));
$this->assertSame(['object' => true], $normalizer->getSupportedTypes('any'));

if (!method_exists(Serializer::class, 'getSupportedTypes')) {
$this->assertTrue($normalizer->hasCacheableSupportsMethod());
Expand Down

0 comments on commit 4dcfc16

Please sign in to comment.