Menu

← Back to doctrine.*

Error Identifier: doctrine.internalError

Every error reported by PHPStan has an error identifier. Here’s a list of all error identifiers. In PHPStan Pro you can see the error identifier next to each error and filter errors by their identifiers.

Code example #

<?php declare(strict_types = 1);

use Doctrine\ORM\EntityManagerInterface;

function getResults(EntityManagerInterface $em): mixed
{
	$qb = $em->createQueryBuilder()
		->select('a')
		->from('App\Entity\Article', 'a');

	return $qb->getQuery()->getResult();
}

Why is it reported? #

This error is reported by the phpstan-doctrine extension.

An internal error occurred while PHPStan was trying to analyse a Doctrine QueryBuilder query. This typically means an exception was thrown during DQL analysis when calling getQuery() on a QueryBuilder instance.

This can happen when the QueryBuilder is constructed in a way that leads to an unexpected error during static analysis of the resulting DQL.

How to fix it #

Verify that the QueryBuilder query is valid and can be executed at runtime. If the query works correctly at runtime but PHPStan reports this error, it may be a bug in the phpstan-doctrine extension. Consider reporting it.

Non-ignorable error #

This error cannot be ignored using @phpstan-ignore or the ignoreErrors configuration. Non-ignorable errors indicate code that would cause a crash or a fatal error at runtime, or a fundamental problem in the analysed code that must be addressed.

Rules that report this error #

  • PHPStan\Rules\Doctrine\ORM\QueryBuilderDqlRule [1] phpstan/phpstan-doctrine

Edit this page on GitHub

Theme
A
© 2026 PHPStan s.r.o.