We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
setLockMode
setHint
When using setLockMode() or setHint() on a Query, PHPStan stop inferring the result type.
setLockMode()
setHint()
Query
$user = $entityManager ->getRepository(User::class) ->createQueryBuilder('user') ->where('user.id = :userId') ->getQuery() ->getResult(); \PHPStan\dumpType($user); // -> Dumped type: array<App\User>
$user = $entityManager ->getRepository(User::class) ->createQueryBuilder('user') ->where('user.id = :userId') ->getQuery() ->setLockMode(LockMode::PESSIMISTIC_READ) // <- Add this line ->getResult(); \PHPStan\dumpType($user); // -> Dumped type: mixed
The text was updated successfully, but these errors were encountered:
Hi @noemi-salaun, this can be fixed directly on doctrine/orm.
The return type is self but the phpdoc should be more precise. https://github.com/doctrine/orm/blob/2.13.x/lib/Doctrine/ORM/Query.php#L775 Adding /** @return $this */ will solve the issue.
self
/** @return $this */
I opened the PR doctrine/orm#10238
Sorry, something went wrong.
This will be fixed in 2.14 version of doctrine
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
No branches or pull requests
When using
setLockMode()
orsetHint()
on aQuery
, PHPStan stop inferring the result type.GOOD TYPE
MIXED TYPE
The text was updated successfully, but these errors were encountered: