Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ea1da07

Browse files
Fix psalm error
1 parent 7d20596 commit ea1da07

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/SignatureAlgorithmFactory.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,27 +25,25 @@ final class SignatureAlgorithmFactory
2525
{
2626
public static function create(string $algorithm): AlgorithmInterface
2727
{
28+
$algorithmFqcn = Algorithm::class.'\\'.$algorithm;
29+
2830
switch ($algorithm) {
2931
case 'ES256':
3032
case 'ES384':
3133
case 'ES512':
32-
if (!class_exists(Algorithm::class.'\\'.$algorithm)) {
34+
if (!class_exists($algorithmFqcn)) {
3335
throw new \LogicException(sprintf('You cannot use the "%s" signature algorithm since "web-token/jwt-signature-algorithm-ecdsa" is not installed. Try running "composer require web-token/jwt-signature-algorithm-ecdsa".', $algorithm));
3436
}
35-
36-
$algorithm = Algorithm::class.'\\'.$algorithm;
3737
break;
3838
case 'RS256':
39-
if (!class_exists(Algorithm::class.'\\'.$algorithm)) {
39+
if (!class_exists($algorithmFqcn)) {
4040
throw new \LogicException(sprintf('You cannot use the "%s" signature algorithm since "web-token/jwt-signature-algorithm-rsa" is not installed. Try running "composer require web-token/jwt-signature-algorithm-rsa".', $algorithm));
4141
}
42-
43-
$algorithm = Algorithm::class.'\\'.$algorithm;
4442
break;
4543
default:
4644
throw new InvalidArgumentException(sprintf('Unsupported signature algorithm "%s". Only ES* and RS256 algorithms are supported. If you want to use another algorithm, create your TokenHandler as a service.', $algorithm));
4745
}
4846

49-
return new $algorithm();
47+
return new $algorithmFqcn();
5048
}
5149
}

0 commit comments

Comments
 (0)