Bug Report
| Subject |
Details |
| Rector version |
2.2.1 |
I'm trying to raise my TypeCoverageDocblockLevel from Rector 2.2, thanks for that great feature!
AddParamArrayDocblockFromDimFetchAccessRector adds a @param to a method, but that leads to this phpstan error:
Parameter #3 $context (array<string, mixed>) of method App\Services\Attachment\AttachmentNormalizer::supportsNormalization() should be contravariant with parameter $context (array) of method Symfony\Component\Serializer\Normalizer\NormalizerInterface::supportsNormalization()
\Symfony\Component\Serializer\Normalizer\NormalizerInterface::supportsNormalization has just array as type, without extra info from a docblock.
Minimal PHP Code Causing Issue
+ /**
+ * @param array<string, mixed> $context
+ */
#[\Override]
public function supportsNormalization(mixed $data, ?string $format = null, array $context = []) : bool
{
return $data instanceof Attachment && in_array('foobar', $context['groups'], true);
}
Expected Behaviour
I've got similar problems with other Rectors, such as DocblockVarArrayFromPropertyDefaultsRector. Maybe there should be an option to exclude adding/updating docblocks if a method implements an interface (or extends a class) that's in the vendor dir?
Bug Report
I'm trying to raise my
TypeCoverageDocblockLevelfrom Rector 2.2, thanks for that great feature!AddParamArrayDocblockFromDimFetchAccessRectoradds a@paramto a method, but that leads to this phpstan error:\Symfony\Component\Serializer\Normalizer\NormalizerInterface::supportsNormalizationhas justarrayas type, without extra info from a docblock.Minimal PHP Code Causing Issue
Expected Behaviour
I've got similar problems with other Rectors, such as
DocblockVarArrayFromPropertyDefaultsRector. Maybe there should be an option to exclude adding/updating docblocks if a method implements an interface (or extends a class) that's in the vendor dir?