public function accepts(Type $type) : bool
{
if ($type instanceof MixedType) {
return true;
}
if ($this->isNullable() && $type instanceof NullType) {
return true;
}
if ($type instanceof StaticType) {
return $this->checkSubclassAcceptability($type->getBaseClass());
}
if ($type->getClass() === null) {
return false;
}
return $this->checkSubclassAcceptability($type->getClass());
}