You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Argument 1 of Doctrine\ORM\QueryBuilder::setParameters expects Doctrine\Common\Collections\ArrayCollection<int, Doctrine\ORM\Query\Parameter>, but Doctrine\Common\Collections\ArrayCollection<int<0, 1>, Doctrine\ORM\Query\Parameter> provided (see https://psalm.dev/004)
->setParameters(new ArrayCollection(
[
new Parameter('customStringId', $customStringId->id),
new Parameter('license', $license),
],
))
Q
A
BC Break
yes
Version
from 2.19.3 to 3.1.3.
Previous behavior
QueryBuilder::setParamters() was accepting any type of array -- mixed[]
Current behavior
PHPDoc of QueryBuilder::setParamters() is too strict, asking exaclty for int as key and not allowed fixed length array to be used
How to reproduce
Call the method ->setParameters of Doctrine 3 passing as parameter an ArrayCollection() with an array of fixed with as paramter, then execute Psalm.
Solution
A templating should be used to allow a more "flexible" int datatype to be inferred from the input parameter
/** * @template TKey of int * * @psalm-param ArrayCollection<TKey, Parameter> $parameters * * @return $this */publicfunctionsetParameters(ArrayCollection$parameters): static {}
The text was updated successfully, but these errors were encountered:
BC Break Report
In our actual version (2.19.3),
QueryBuilder::setParamters()
was accepting a standard array as inputIn the latest version it wants an
ArrayCollection<int, Parameter>
.The problem here is that it is forcing the ArrayCollection to have
int
datatype as key, so it's not accepting an array of fixed width as this one:This is the error from Psalm:
Previous behavior
QueryBuilder::setParamters()
was accepting any type of array --mixed[]
Current behavior
PHPDoc of
QueryBuilder::setParamters()
is too strict, asking exaclty forint
as key and not allowed fixed length array to be usedHow to reproduce
Call the method
->setParameters
of Doctrine 3 passing as parameter an ArrayCollection() with an array of fixed with as paramter, then execute Psalm.Solution
A templating should be used to allow a more "flexible"
int
datatype to be inferred from the input parameterThe text was updated successfully, but these errors were encountered: