public function accepts(Type $type) : bool
{
if ($type instanceof self) {
return true;
}
if ($this->isNullable() && $type instanceof NullType) {
return true;
}
if ($type instanceof ArrayType && $type->isPossiblyCallable()) {
return true;
}
if ($type->getClass() === 'Closure') {
return true;
}
return $type instanceof MixedType;
}