Narrow return types for AbstractQuery::getSingleScalarResult()#10721
Conversation
9855225 to
af3071a
Compare
greg0ire
left a comment
There was a problem hiding this comment.
There should be 2 commits if you are doing unrelated things. Also, mixed is technically correct, so the commit about changing the phpdoc should target 2.16.x (while the other commit should target 2.15.x to reduce differences, since it does not touch lib).
I've noticed that scalar is a type that exist for static analysis: https://psalm.dev/docs/annotating_code/type_syntax/scalar_types/#scalar
I'm undecided on whether we should use it or not, I would be OK with any solution.
TIL, I never created a PR with commits targeting different branches.
I didn't used |
af3071a to
6b70699
Compare
6b70699 to
be297b9
Compare
|
Thanks @phansys ! |
Tests were also improved:QueryTest::testGetSingleScalarResultThrowsExceptionOnNonUniqueResult()was updated to ensureNonUniqueResultExceptionis thrown only on results with multiple rows;<- These changes were moved to Fix and improve functional test cases expectingQueryTest::testGetSingleScalarResultThrowsExceptionOnSingleRowWithMultipleColumns()was added to ensureNonUniqueResultExceptionis thrown only on results with multiple columns;NonUniqueResultExceptionfromAbstractQuery::getSingleScalarResult()#10722 (see Narrow return types forAbstractQuery::getSingleScalarResult()#10721 (review)).Closes #10695