Closed simPod closed 1 year ago
Q | A |
---|---|
Bug fix? | yes |
Tests pass? | yes/no |
License | MIT |
v3.19 is broken since there's count()
called on null
value in DocBlockTypeResolver::getPropertyDocblockTypeHint()
@dgafka can you please have a look?
@simPod can you add test case for this, to show the error?
I'd not add tests to test types but keep it for phpstan https://github.com/schmittjoh/serializer/pull/1446
@dgafka yup, that will be covered by phpstan. Such tests, that can be replaced by SA, are basically a mess that is hard to get rid of then SA is enabled.
I think https://github.com/schmittjoh/serializer/blob/master/tests/Fixtures/ObjectWithPhpDocProperty.php needs to be extended with a property without a docblock and in https://github.com/schmittjoh/serializer/blob/master/tests/Metadata/Driver/DocBlockTypeResolverTest.php following test needs to be added:
public function testGetPropertyDocblockTypeHintDoesNotCrashOnAPropertyWithoutADocBlock(): void
{
$resolver = new DocBlockTypeResolver();
self::assertNull(
$resolver->getPropertyDocblockTypeHint(
new ReflectionProperty(ObjectWithPhpDocProperty::class, 'noneDocBlock')
)
);
}
Maybe but that's not relevant to this PR. I just fixed a wrong type in a private method.
ping @goetas
thank you!
@goetas can you release? :)