Skip to content

Commit 7d3ae73

Browse files
committed
Use ::class instead of FQCN
1 parent af66819 commit 7d3ae73

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

DependencyInjection/Compiler/RegisterCsrfFeaturesPass.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
1515
use Symfony\Component\DependencyInjection\ContainerBuilder;
1616
use Symfony\Component\DependencyInjection\Reference;
17+
use Symfony\Component\Security\Csrf\TokenStorage\ClearableTokenStorageInterface;
1718
use Symfony\Component\Security\Http\EventListener\CsrfProtectionListener;
1819
use Symfony\Component\Security\Http\EventListener\CsrfTokenClearingLogoutListener;
1920

@@ -52,7 +53,7 @@ protected function registerLogoutHandler(ContainerBuilder $container)
5253
$csrfTokenStorage = $container->findDefinition('security.csrf.token_storage');
5354
$csrfTokenStorageClass = $container->getParameterBag()->resolveValue($csrfTokenStorage->getClass());
5455

55-
if (!is_subclass_of($csrfTokenStorageClass, 'Symfony\Component\Security\Csrf\TokenStorage\ClearableTokenStorageInterface')) {
56+
if (!is_subclass_of($csrfTokenStorageClass, ClearableTokenStorageInterface::class)) {
5657
return;
5758
}
5859

DependencyInjection/SecurityExtension.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@
3030
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
3131
use Symfony\Component\DependencyInjection\Reference;
3232
use Symfony\Component\EventDispatcher\EventDispatcher;
33+
use Symfony\Component\ExpressionLanguage\Expression;
3334
use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
35+
use Symfony\Component\HttpFoundation\RequestMatcher;
3436
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
3537
use Symfony\Component\HttpKernel\KernelEvents;
3638
use Symfony\Component\PasswordHasher\Hasher\NativePasswordHasher;
@@ -43,6 +45,7 @@
4345
use Symfony\Component\Security\Core\Authorization\Strategy\UnanimousStrategy;
4446
use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface;
4547
use Symfony\Component\Security\Core\User\ChainUserProvider;
48+
use Symfony\Component\Security\Core\User\UserCheckerInterface;
4649
use Symfony\Component\Security\Core\User\UserProviderInterface;
4750
use Symfony\Component\Security\Http\Authenticator\Debug\TraceableAuthenticatorManagerListener;
4851
use Symfony\Component\Security\Http\Event\CheckPassportEvent;
@@ -306,7 +309,7 @@ private function createFirewalls(array $config, ContainerBuilder $container)
306309

307310
// register an autowire alias for the UserCheckerInterface if no custom user checker service is configured
308311
if (!$customUserChecker) {
309-
$container->setAlias('Symfony\Component\Security\Core\User\UserCheckerInterface', new Alias('security.user_checker', false));
312+
$container->setAlias(UserCheckerInterface::class, new Alias('security.user_checker', false));
310313
}
311314
}
312315

@@ -842,7 +845,7 @@ private function createExpression(ContainerBuilder $container, string $expressio
842845
}
843846

844847
$container
845-
->register($id, 'Symfony\Component\ExpressionLanguage\Expression')
848+
->register($id, Expression::class)
846849
->setPublic(false)
847850
->addArgument($expression)
848851
;
@@ -881,7 +884,7 @@ private function createRequestMatcher(ContainerBuilder $container, string $path
881884
}
882885

883886
$container
884-
->register($id, 'Symfony\Component\HttpFoundation\RequestMatcher')
887+
->register($id, RequestMatcher::class)
885888
->setPublic(false)
886889
->setArguments($arguments)
887890
;

0 commit comments

Comments
 (0)