setHint returning invalid type

Open
#463 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
42/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
php
Domain
devtools

Research direction

Start with the Doctrine query chain shown in the reproduction, comparing the inferred type with and without setHint(Query::HINT_FORCE_PARTIAL_LOAD, true). Check the related phpstan-doctrine issue #393 for context. Done means the reproduced getOneOrNullResult call no longer reports mixed while retaining setHint.

Written by the indexing model from the issue text.

Description

I am using doctrine/orm 2.14.1 and even though https://github.com/phpstan/phpstan-doctrine/issues/393 mentions it being fixed I think this was only for setLockMode.

Repro:

                ->getQuery()
                ->setHint(Query::HINT_FORCE_PARTIAL_LOAD, true)
                ->getOneOrNullResult(AbstractQuery::HYDRATE_OBJECT);

Dumped type: mixed

While removing setHint I see proper type.

Dominant language
PHP
Stars
678
Forks
122
Avg merge
5d 18h
Merged PRs (30d)
3

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from phpstan/phpstan-doctrine

All issues in phpstan/phpstan-doctrine

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.