Closed
Description
See current behaviour:
class Foo {
public function notWorking()
{
$queryBuilder = $this->createQueryBuilder();
$queryBuilder->andWhere('1 = 1');
$queryBuilder->getQuery()->getResult(); // mixed[]
}
public function working()
{
$queryBuilder = $this->createQueryBuilder()
->andWhere('1 = 1');
$queryBuilder->getQuery()->getResult(); // list<Entity>
}
}
This is because QueryBuilderMethodDynamicReturnTypeExtension
detects only calls over QueryBuilder
(second case) and optionally dives into the initial "other method" call to detect what happened there.
This could be fixed if I added some DynamicMethodReturnTypeExtension
that is hooked to object
and decided based on its return type (QueryBuilder) if OtherMethodQueryBuilderParser
can be used to infer the enhanced QueryBuilderType
. But no such thing is possible (hooking DynamicMethodReturnTypeExtension
to any class).
Would you accept such PRs to accomplish this?
Metadata
Metadata
Assignees
Labels
No labels