Skip to content

Commit

Permalink
fix(property-info): make sure that SerializerExtractor returns null f…
Browse files Browse the repository at this point in the history
…or invalid class metadata
  • Loading branch information
wuchen90 committed Jan 7, 2025
1 parent c4cc4d5 commit 7bc832e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function getProperties(string $class, array $context = []): ?array
return null;
}

if (!$this->classMetadataFactory->getMetadataFor($class)) {
if (!$this->classMetadataFactory->hasMetadataFor($class)) {
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,9 @@ public function testGetPropertiesWithAnyGroup()
{
$this->assertSame(['analyses', 'feet'], $this->extractor->getProperties(AdderRemoverDummy::class, ['serializer_groups' => null]));
}

public function testGetPropertiesWithNonExistentClassReturnsNull()
{
$this->assertSame(null, $this->extractor->getProperties('NonExistent'));
}
}

0 comments on commit 7bc832e

Please sign in to comment.