public function applyUnion(ClassNameIndex $classNameIndex): void
    {
        if (count($this->classNames) > count($classNameIndex->classNames)) {
            foreach ($classNameIndex->classNames as $className => $value) {
                $this->classNames[$className] = true;
            }
        } else {
            $unionClassNames = $classNameIndex->classNames;
            foreach ($this->classNames as $className => $value) {
                $unionClassNames[$className] = true;
            }
            $this->classNames = $unionClassNames;
        }
    }