private static function compareParameterClasses(\ReflectionParameter $a, \ReflectionParameter $b) : int
    {
        $a = $a->getClass();
        $b = $b->getClass();

        if ($a && $b) {
            return $a->isSubclassOf($b->name) ? -1 : (int) $b->isSubclassOf($a->name);
        }

        return (int) !$a - (int) !$b;
    }