I have this code:
/**
* @ORM\Entity
* @ORM\Table(name="users")
*/
class User extends BaseUser
{
...
/**
* @return Collection|Email[]
*/
public function getEmails(): Collection
{
return $this->emails;
}
...
}
class OrderVoter extends Voter
{
...
/**
* @param Order $order
* @param User $user
*
* @return bool
*/
private function isBillee(Order $order, User $user): bool
{
return in_array($order->getSrcBillingEmail(), $user->getEmails(), true);
}
/**
* @param Order $order
* @param User $user
*
* @return bool
*/
private function isConsignee(Order $order, User $user): bool
{
return in_array($order->getSrcShippingEmail(), $user->getEmails(), true);
}
...
}
The errors I receive are those:
------ -------------------------------------------------------------------------------------------------------------------------------------
Line Security/RemoteOrderVoter.php
------ -------------------------------------------------------------------------------------------------------------------------------------
127 Parameter #2 $haystack of function in_array expects array, Doctrine\Common\Collections\Collection&iterable<App\Entity\Email> given.
138 Parameter #2 $haystack of function in_array expects array, Doctrine\Common\Collections\Collection&iterable<App\Entity\Email> given.
------ -------------------------------------------------------------------------------------------------------------------------------------
Lines refers to the two methods OrderVoter::isBillee() and OrderVoter::isConsignee().
I've tried to reproduce (for what is possible) the issue here:
https://phpstan.org/r/b7dfa46b-ba40-4f10-9720-093c0258ff19
Any ideas about how to solve those errors?
I'm using version 0.11.6 of PHPStan.
I have this code:
The errors I receive are those:
Lines refers to the two methods
OrderVoter::isBillee()andOrderVoter::isConsignee().I've tried to reproduce (for what is possible) the issue here:
https://phpstan.org/r/b7dfa46b-ba40-4f10-9720-093c0258ff19
Any ideas about how to solve those errors?
I'm using version 0.11.6 of PHPStan.