Repository: symfony/symfony
File: src/Symfony/Component/Security/Core/User/ChainUserProvider.php (PHP)

Code before:
    /**
     * @return UserProviderInterface[]
     */
    public function getProviders(): array
    {
        if ($this->providers instanceof \Traversable) {
            return iterator_to_array($this->providers);
        }

        return $this->providers;
    }

    /**
     * @internal for compatibility with Symfony 5.4
     */
    public function loadUserByUsername(string $username): UserInterface
    {
        return $this->loadUserByIdentifier($username);
    }

    public function loadUserByIdentifier(string $identifier/*, array $attributes = []*/): UserInterface
    {
        foreach ($this->providers as $provider) {
            try {
                if ($provider instanceof AttributesBasedUserProviderInterface) {
                    return $provider->loadUserByIdentifier($identifier, func_get_args()[1] ?? []);
                }

                return $provider->loadUserByIdentifier($identifier);
            } catch (UserNotFoundException) {
                // try next one
            }
        }

        $ex = new UserNotFoundException(\sprintf('There is no user with identifier "%s".', $identifier));
        $ex->setUserIdentifier($identifier);
        throw $ex;
    }

    public function refreshUser(UserInterface $user): UserInterface
    {
        $supportedUserFound = false;

        foreach ($this->providers as $provider) {
            try {
                if (!$provider->supportsClass(get_debug_type($user))) {
                    continue;
                }

                return $provider->refreshUser($user);
            } catch (UnsupportedUserException) {

Review comment (suggestion):
```suggestion
    /**
     * @param array $attributes
     */
    public function loadUserByIdentifier(string $identifier/* , array $attributes = [] */): UserInterface
    {
        $attributes = \func_num_args() > 1 ? func_get_arg(1) : [];
        foreach ($this->providers as $provider) {
        try {
                if ($provider instanceof AttributesBasedUserProviderInterface) {
                    return $provider->loadUserByIdentifier($identifier, $attributes);
```

Code after:
    /**
     * @return UserProviderInterface[]
     */
    public function getProviders(): array
    {
        if ($this->providers instanceof \Traversable) {
            return iterator_to_array($this->providers);
        }

        return $this->providers;
    }

    /**
     * @internal for compatibility with Symfony 5.4
     */
    public function loadUserByUsername(string $username): UserInterface
    {
        return $this->loadUserByIdentifier($username);
    }

    /**
     * @param array $attributes
     */
    public function loadUserByIdentifier(string $identifier/* , array $attributes = [] */): UserInterface
    {
        $attributes = \func_num_args() > 1 ? func_get_arg(1) : [];
        foreach ($this->providers as $provider) {
            try {
                if ($provider instanceof AttributesBasedUserProviderInterface) {
                    return $provider->loadUserByIdentifier($identifier, $attributes);
                }

                return $provider->loadUserByIdentifier($identifier);
            } catch (UserNotFoundException) {
                // try next one
            }
        }

        $ex = new UserNotFoundException(\sprintf('There is no user with identifier "%s".', $identifier));
        $ex->setUserIdentifier($identifier);
        throw $ex;
    }

    public function refreshUser(UserInterface $user): UserInterface
    {
        $supportedUserFound = false;

        foreach ($this->providers as $provider) {
            try {
                if (!$provider->supportsClass(get_debug_type($user))) {
                    continue;