Repository: symfony/symfony
File: src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php (PHP)

Code before:
        foreach ($config as $key => $value) {
            $configAsString .= \sprintf("\n%s: %s", $key, $this->formatValue($value));
        }

        return trim($configAsString);
    }

    /**
     * @param array<string> $methods
     */
    private function formatMethods(array $methods): string
    {
        if (!$methods) {
            $methods = ['ANY'];
        }

        return implode('|', array_map(
            fn (string $method): string => '<fg='.self::VERB_COLORS[$method].'>'.$method.'</>',
            $methods
        ));
    }

    private function formatControllerLink(mixed $controller, string $anchorText, ?callable $getContainer = null): string
    {
        if (null === $this->fileLinkFormatter) {
            return $anchorText;
        }

        try {
            if (null === $controller) {
                return $anchorText;
            } elseif (\is_array($controller)) {
                $r = new \ReflectionMethod($controller[0], $controller[1]);
            } elseif ($controller instanceof \Closure) {
                $r = new \ReflectionFunction($controller);
            } elseif (method_exists($controller, '__invoke')) {
                $r = new \ReflectionMethod($controller, '__invoke');
            } elseif (!\is_string($controller)) {
                return $anchorText;
            } elseif (str_contains($controller, '::')) {
                $r = new \ReflectionMethod(...explode('::', $controller, 2));
            } else {
                $r = new \ReflectionFunction($controller);
            }
        } catch (\ReflectionException) {
            if (\is_array($controller)) {
                $controller = implode('::', $controller);
            }

            $id = $controller;
            $method = '__invoke';

Review comment (suggestion):
```suggestion
        return implode('|', array_map(fn ($method) => '<fg='.self::VERB_COLORS[$method].'>'.$method.'</>', $methods));
    }
```

Code after:
        }

        ksort($config);

        $configAsString = '';
        foreach ($config as $key => $value) {
            $configAsString .= \sprintf("\n%s: %s", $key, $this->formatValue($value));
        }

        return trim($configAsString);
    }

    /**
     * @param array<string> $methods
     */
    private function formatMethods(array $methods): string
    {
        if ([] === $methods) {
            $methods = ['ANY'];
        }

        return implode('|', array_map(
            fn (string $method): string => \sprintf('<fg=%s>%s</>', self::VERB_COLORS[$method] ?? 'default', $method),
            $methods
        ));
    }

    /**
     * @param (callable():ContainerBuilder)|null $getContainer
     */
    private function formatControllerLink(mixed $controller, string $anchorText, ?callable $getContainer = null): string
    {
        if (null === $this->fileLinkFormatter) {
            return $anchorText;
        }

        try {
            if (null === $controller) {
                return $anchorText;
            } elseif (\is_array($controller)) {
                $r = new \ReflectionMethod($controller[0], $controller[1]);
            } elseif ($controller instanceof \Closure) {
                $r = new \ReflectionFunction($controller);
            } elseif (method_exists($controller, '__invoke')) {
                $r = new \ReflectionMethod($controller, '__invoke');
            } elseif (!\is_string($controller)) {
                return $anchorText;
            } elseif (str_contains($controller, '::')) {
                $r = new \ReflectionMethod(...explode('::', $controller, 2));
            } else {
                $r = new \ReflectionFunction($controller);