Repository: symfony/symfony
File: src/Symfony/Component/HttpKernel/EventListener/CacheAttributeListener.php (PHP)

Code before:
    public function reset(): void
    {
    }

    private function evaluate(string|Expression|\Closure $closureOrExpression, array $variables): mixed
    {
        if ($closureOrExpression instanceof \Closure) {
            return $closureOrExpression($variables['args'], $variables['request'], $variables['this']);
        }

        return $this->getExpressionLanguage()->evaluate($closureOrExpression, $variables);
    }

    private function getVariables(Request $request, ControllerArgumentsEvent $event): array
    {
        $controller = $event->getController();
        $controllerObject = match (true) {
            \is_object($controller) => $controller,
            \is_array($controller) && \is_object($controller[0]) => $controller[0],
            default => null,
        };

        return array_merge([
            'request' => $request,
            'args' => $arguments = $event->getNamedArguments(),
        ], $request->attributes->all(), $arguments, $controllerObject ? ['this' => $controllerObject] : []);
    }

    private function getExpressionLanguage(): ExpressionLanguage
    {
        return $this->expressionLanguage ??= class_exists(ExpressionLanguage::class)
            ? new ExpressionLanguage()
            : throw new \LogicException('Unable to use expressions as the Symfony ExpressionLanguage component is not installed. Try running "composer require symfony/expression-language".');
    }

    private function toSeconds(int|string $time): int
    {
        if (!is_numeric($time)) {
            $now = time();
            $time = strtotime($time, $now) - $now;
        }

        return $time;
    }
}


Review comment (suggestion):
```suggestion
            'this' => $controllerObject,
        ], $request->attributes->all(), $arguments);
```

Code after:
    public function reset(): void
    {
    }

    private function evaluate(string|Expression|\Closure $closureOrExpression, array $variables): mixed
    {
        if ($closureOrExpression instanceof \Closure) {
            return $closureOrExpression($variables['args'], $variables['request'], $variables['this']);
        }

        return $this->getExpressionLanguage()->evaluate($closureOrExpression, $variables);
    }

    private function getVariables(Request $request, ControllerArgumentsEvent $event): array
    {
        $controller = $event->getController();
        $controller = match (true) {
            \is_object($controller) && !$controller instanceof \Closure => $controller,
            \is_array($controller) && \is_object($controller[0]) => $controller[0],
            default => null,
        };

        return array_merge([
            'request' => $request,
            'args' => $arguments = $event->getNamedArguments(),
            'this' => $controller,
        ], $request->attributes->all(), $arguments);
    }

    private function getExpressionLanguage(): ExpressionLanguage
    {
        return $this->expressionLanguage ??= class_exists(ExpressionLanguage::class)
            ? new ExpressionLanguage()
            : throw new \LogicException('Unable to use expressions as the Symfony ExpressionLanguage component is not installed. Try running "composer require symfony/expression-language".');
    }

    private function toSeconds(int|string $time): int
    {
        if (!is_numeric($time)) {
            $now = time();
            $time = strtotime($time, $now) - $now;
        }

        return $time;
    }
}