phpstan-doctrine icon indicating copy to clipboard operation
phpstan-doctrine copied to clipboard

Type infering breaks when groupBy omits table alias

Open janedbal opened this issue 3 years ago • 0 comments

See following example, not sure this is possible to support or not.

$query = $em->createQueryBuilder()
	->addSelect('COUNT(m.id) AS count, m.intColumn')
	->from(Many::class, 'm')
	->join('m.one', 'o')
	->groupBy('intColumn'); // m.intColumn works

assertType(
	'array<array{count: int<0, max>|numeric-string, intColumn: int}>', // fails, is mixed
	$query->getQuery()->getResult()
);

cc @arnaud-lb

janedbal avatar Feb 01 '22 08:02 janedbal