PHPStan\Type\IterableIterableType::accepts PHP Method

accepts() public method

public accepts ( PHPStan\Type\Type $type ) : boolean
$type PHPStan\Type\Type
return boolean
    public function accepts(Type $type) : bool
    {
        if ($type instanceof IterableType) {
            return $this->getItemType()->accepts($type->getItemType());
        }
        if ($type->getClass() !== null && $this->exists($type->getClass())) {
            $classReflection = new \ReflectionClass($type->getClass());
            return $classReflection->implementsInterface(\Traversable::class);
        }
        if ($type instanceof MixedType) {
            return true;
        }
        if ($this->isNullable() && $type instanceof NullType) {
            return true;
        }
        return false;
    }