Repository: symfony/symfony
File: src/Symfony/Bundle/SecurityBundle/Security.php (PHP)

Code before:
        return $this->container->get('security.authorization_checker')
            ->isGranted($attributes, $subject, $accessDecision);
    }

    public function accessDecision(mixed $attributes, mixed $subject = null, ?AccessDecision $accessDecision = null): AccessDecision
    {
        $accessDecision = $accessDecision ?? new AccessDecision();
        $this->isGranted($attributes, $subject, $accessDecision);

        return $accessDecision;
    }

    /**
     * Checks if the attribute is granted against the user and optionally supplied subject.
     *
     * This should be used over isGranted() when checking permissions against a user that is not currently logged in or while in a CLI context.
     */
    public function isGrantedForUser(UserInterface $user, mixed $attribute, mixed $subject = null, ?AccessDecision $accessDecision = null): bool
    {
        return $this->container->get('security.user_authorization_checker')
            ->isGrantedForUser($user, $attribute, $subject, $accessDecision);
    }

    public function accessDecisionForUser(UserInterface $user, mixed $attributes, mixed $subject = null, ?AccessDecision $accessDecision = null): AccessDecision
    {
        $accessDecision = $accessDecision ?? new AccessDecision();
        $this->isGrantedForUser($user, $attributes, $subject, $accessDecision);

        return $accessDecision;
    }


    public function getToken(): ?TokenInterface
    {
        return $this->container->get('security.token_storage')->getToken();
    }

    public function getFirewallConfig(Request $request): ?FirewallConfig
    {
        return $this->container->get('security.firewall.map')->getFirewallConfig($request);
    }

    /**
     * @param UserInterface        $user              The user to authenticate
     * @param string|null          $authenticatorName The authenticator name (e.g. "form_login") or service id (e.g. SomeApiKeyAuthenticator::class) - required only if multiple authenticators are configured
     * @param string|null          $firewallName      The firewall name - required only if multiple firewalls are configured
     * @param BadgeInterface[]     $badges            Badges to add to the user's passport
     * @param array<string, mixed> $attributes        Attributes to add to the user's passport
     *
     * @return Response|null The authenticator success response if any
     */

Review comment (suggestion):
```suggestion
    public function accessDecisionForUser(UserInterface $user, mixed $attributes, mixed $subject = null): AccessDecision
    {
        $accessDecision = new AccessDecision();
```

Code after:
        return $this->container->get('security.authorization_checker')
            ->isGranted($attributes, $subject, $accessDecision);
    }

    public function getAccessDecision(mixed $attributes, mixed $subject = null): AccessDecision
    {
        $accessDecision = new AccessDecision();
        $this->isGranted($attributes, $subject, $accessDecision);

        return $accessDecision;
    }

    /**
     * Checks if the attribute is granted against the user and optionally supplied subject.
     *
     * This should be used over isGranted() when checking permissions against a user that is not currently logged in or while in a CLI context.
     */
    public function isGrantedForUser(UserInterface $user, mixed $attribute, mixed $subject = null, ?AccessDecision $accessDecision = null): bool
    {
        return $this->container->get('security.user_authorization_checker')
            ->isGrantedForUser($user, $attribute, $subject, $accessDecision);
    }

    public function getAccessDecisionForUser(UserInterface $user, mixed $attributes, mixed $subject = null): AccessDecision
    {
        $accessDecision = new AccessDecision();
        $this->isGrantedForUser($user, $attributes, $subject, $accessDecision);

        return $accessDecision;
    }

    public function getToken(): ?TokenInterface
    {
        return $this->container->get('security.token_storage')->getToken();
    }

    public function getFirewallConfig(Request $request): ?FirewallConfig
    {
        return $this->container->get('security.firewall.map')->getFirewallConfig($request);
    }

    /**
     * @param UserInterface        $user              The user to authenticate
     * @param string|null          $authenticatorName The authenticator name (e.g. "form_login") or service id (e.g. SomeApiKeyAuthenticator::class) - required only if multiple authenticators are configured
     * @param string|null          $firewallName      The firewall name - required only if multiple firewalls are configured
     * @param BadgeInterface[]     $badges            Badges to add to the user's passport
     * @param array<string, mixed> $attributes        Attributes to add to the user's passport
     *
     * @return Response|null The authenticator success response if any
     */
    public function login(UserInterface $user, ?string $authenticatorName = null, ?string $firewallName = null, array $badges = [], array $attributes = []): ?Response