Given the following code:
public function x(\Iterable $foo)
{
if (!$foo instanceof Foo) {
throw new \InvalidArgumentException('$foo must also be a Foo.');
}
// From this point on $foo is now a union of \Iterable|Foo.
foreach ($foo as $_) { ; } // "Can not iterate Foo (must implement one of Iterator interfaces)"
}
Once $foo becomes a union type the inspection fails on the non-iterable type, ignoring the fact that it is still a union of a perfectly valid iterable type.
Fixed
And to clarify: Foo class might be defined still, as it often used in UTs =)