for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* @see https://github.com/ecphp
*/
declare(strict_types=1);
namespace EcPhp\CasBundle\Security\Core\User;
use EcPhp\CasLib\Contract\Response\Type\ServiceValidate as TypeServiceValidate;
use Psr\Http\Message\ResponseInterface;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
use Symfony\Component\Security\Core\User\UserInterface;
use function get_class;
final class CasUserProvider implements CasUserProviderInterface
{
public function loadUserByIdentifier($identifier): UserInterface
$identifier
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
public function loadUserByIdentifier(/** @scrutinizer ignore-unused */ $identifier): UserInterface
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
throw new UnsupportedUserException('Unsupported operation.');
}
public function loadUserByResponse(ResponseInterface $response): CasUserInterface
if ($response instanceof TypeServiceValidate) {
return new CasUser($response->getCredentials());
throw new AuthenticationException('Unable to load user from response.');
public function loadUserByUsername(string $username): UserInterface
throw new UnsupportedUserException(sprintf('Username "%s" does not exist.', $username));
public function refreshUser(UserInterface $user): UserInterface
if (!$user instanceof CasUserInterface) {
throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', get_class($user)));
return $user;
public function supportsClass(string $class): bool
return CasUser::class === $class;
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.