-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
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
Incompatibility between getArrayResult()
new type hint and use of indexBy()
#8503
Comments
I can confirm this issue. The updated return annotation released with 2.8.2 conflicts with my own annotation and causes Psalm to report some (false) issues. |
@stlrnz The case reported by @benjamintoussaint about |
Yeah, I already noticed this. Sorry for the confusion. |
@benjamintoussaint or we could simply do this: |
Is this a breaking change? so no semantic versioning? |
@ovidals that was a mistake when making the phpdoc types more precise (combined with an API where the precise return type depends on the query being executed). that was not an intentional breaking change (and it has already been fixed) |
@stof I see in the 2.8.4 there is another BC. I say that because we upgraded today from 2.8.1 to 2.8.4 and the app crashed due to an yml (it was? can't remember) error. |
if you have another problem, please open a new issue to report it |
@stlrnz Did you get $this->createQueryBuilder('a', 'a.month')
->select('SUM(a.amount)')
->groupBy('a.month')
->getQuery()
->getArrayResult()
; Actual result:
Desired result:
EDIT: Just found out myself: It needs to be included in the select: |
Cs fixes1 #8475 brought this change of
AbstractQuery
which I find incompatible with the use ofindexBy()
:f833222#diff-65b30cb7319fd94159051fe212c87565a4ffd15a796fa0db4983c477076b88c8R798
@return array@return array<int,mixed>
The new type hint is incompatible with a result indexed with a string property:
I noticed the same issue with the same change for
getScalarResult()
.I have thought of no alternative but to revert the change.
What do you think about this?
The text was updated successfully, but these errors were encountered: