Closed jkabat closed 3 years ago
Hum, I think it's because we try to call getTranslatableEntityClass
directly on the TranslationInterface
interface, and PHPStan could not resolve it.
Maybe we can try to update the following methods https://github.com/KnpLabs/DoctrineBehaviors/blob/master/utils/phpstan-behaviors/src/Type/TranslationTypeHelper.php#L13-L34, by checking if we have to deal a TranslationInterface
. If it's the case, simply return an instance of TranslatableInterface
, and vice-versa.
I'm actually on vacation, but I can try to work on it this week.
I have a solution that works for Knp\DoctrineBehaviors\Contract\Entity\TranslationInterface
and Knp\DoctrineBehaviors\Contract\Entity\TranslatableInterface
base interfaces, but that won't work if you use custom Translation/Translatable interfaces.
I'm getting following error during PHPStan analyze:
Which is caused by this snippet:
What would you recommend to fix this error? @Kocal?