You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ERROR: MixedReturnTypeCoercion - ProfileRepository.php:22:16 - The declared return type 'array<array-key, Profile>' for ProfileRepository::getProfiles is more specific than the inferred return type 'list<mixed>' (see https://psalm.dev/197)
* @return array<Profile>
With this Repo (simple example of using QueryBuilder):
/**
* @template-extends ServiceEntityRepository<Profile>
*/
class ProfileRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Profile::class);
}
/**
* @return array<Profile>
*/
public function getProfiles(): array
{
return $this->createQueryBuilder('p')->getQuery()->getResult();
}
}
So I'm questioning myself: Should EntityRepository->createQueryBuilder() return a Query with the templated type Profile instead of mixed? Right now Query can be templated thanks to this plugin but the QueryBuilder cannot pass this information to the Query right now so it returns mixed. But if we maybe add the template annotation to the QueryBuilder we could pass it to Query. I tried to update the stubs for QueryBuilder but this was of course not sufficient. So i tried to update the plugin with an hook like the Collection hook already provided but failed to get it working. So first, i wanted to check if this route is the right before putting more work into it. So what do you think?
The text was updated successfully, but these errors were encountered:
I get this error:
With this Repo (simple example of using QueryBuilder):
So I'm questioning myself: Should
EntityRepository->createQueryBuilder()
return aQuery
with the templated typeProfile
instead ofmixed
? Right nowQuery
can be templated thanks to this plugin but theQueryBuilder
cannot pass this information to theQuery
right now so it returnsmixed
. But if we maybe add the template annotation to theQueryBuilder
we could pass it toQuery
. I tried to update the stubs forQueryBuilder
but this was of course not sufficient. So i tried to update the plugin with an hook like the Collection hook already provided but failed to get it working. So first, i wanted to check if this route is the right before putting more work into it. So what do you think?The text was updated successfully, but these errors were encountered: