public function getDuplicates(): array
    {
        $dupes = [];
        foreach ($this->visitor->getCounts() as $type => $names) {
            foreach ($names as $name => $count) {
                if ($count > 1) {
                    $dupes[] = [
                        'type' => $type,
                        'name' => $type === 'globals' ? '$' . $name : ltrim($name, '\\'),
                        'count' => $count,
                    ];
                }
            }
        }

        usort($dupes, function (array $a, array $b): int {
            return $a['type'] <=> $b['type'] ?: $a['name'] <=> $b['name'];
        });

        return $dupes;
    }