-
-
Notifications
You must be signed in to change notification settings - Fork 933
Closed
Labels
Milestone
Description
Bug report
When assigning a wrong new value to a variable of type ArrayAccess, the error is not reported if the type of the variable includes an intersection with another type.
Code snippet that reproduces the problem
class Foo
{
/** @var \ArrayAccess<int, string> */
private $collection1;
/** @var \ArrayAccess<int, string>&\Countable */
private $collection2;
public function foo(): void
{
$this->collection1[] = 1;
$this->collection2[] = 2;
}
}https://phpstan.org/r/8142895e-0a04-44b6-82c9-e1eed898da54
Expected output
Both assignations should be reported as they don't accept int.