i mean wouldn't the following be equivalent?

``
if (!empty($className)
    && $nodeClassName !== $className
    && !is_subclass_of($nodeClassName, $className))
) {
    throw ClassMismatchException::incompatibleClasses($node->getPath(), $nodeClassName, $className);
}

$className = $nodeClassName;
``

or at the very least

``
if (!empty($className)
    || ($nodeClassName === $className || is_subclass_of($nodeClassName, $className)
) {
  $className = $nodeClassName;
} else {
  throw ClassMismatchException::incompatibleClasses($node->getPath(), $nodeClassName, $className);
}
``