diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index 2c35a8692..d89b10175 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -22,7 +22,7 @@ class Configuration implements ConfigurationInterface public function getConfigTreeBuilder() { $treeBuilder = new TreeBuilder('maker'); - if (\method_exists($treeBuilder, 'getRootNode')) { + if (method_exists($treeBuilder, 'getRootNode')) { $rootNode = $treeBuilder->getRootNode(); } else { // BC layer for symfony/config 4.1 and older diff --git a/src/Generator.php b/src/Generator.php index 0e0ae215e..b6e5c0000 100644 --- a/src/Generator.php +++ b/src/Generator.php @@ -221,7 +221,7 @@ public function generateController(string $controllerClassName, string $controll $controllerTemplatePath, $parameters + [ - 'parent_class_name' => \method_exists(AbstractController::class, 'getParameter') ? 'AbstractController' : 'Controller', + 'parent_class_name' => method_exists(AbstractController::class, 'getParameter') ? 'AbstractController' : 'Controller', ] ); } diff --git a/src/Resources/skeleton/authenticator/LoginFormAuthenticator.tpl.php b/src/Resources/skeleton/authenticator/LoginFormAuthenticator.tpl.php index 0843b4b16..b6e5566f3 100644 --- a/src/Resources/skeleton/authenticator/LoginFormAuthenticator.tpl.php +++ b/src/Resources/skeleton/authenticator/LoginFormAuthenticator.tpl.php @@ -6,7 +6,7 @@ use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\Routing\RouterInterface; +use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; use Symfony\Component\Security\Core\Exception\CustomUserMessageAuthenticationException; @@ -24,14 +24,14 @@ class extends AbstractFormLoginAuthenticator use TargetPathTrait; - private $router; + private $urlGenerator; private $csrfTokenManager; - public function __construct(RouterInterface $router, CsrfTokenManagerInterface $csrfTokenManager) + public function __construct(UrlGeneratorInterface $urlGenerator, CsrfTokenManagerInterface $csrfTokenManager) { entityManager = \$entityManager;\n" : null ?> - $this->router = $router; + $this->urlGenerator = $urlGenerator; $this->csrfTokenManager = $csrfTokenManager; passwordEncoder = \$passwordEncoder;\n" : null ?> } @@ -91,12 +91,12 @@ public function onAuthenticationSuccess(Request $request, TokenInterface $token, return new RedirectResponse($targetPath); } - // For example : return new RedirectResponse($this->router->generate('some_route')); + // For example : return new RedirectResponse($this->urlGenerator->generate('some_route')); throw new \Exception('TODO: provide a valid redirect inside '.__FILE__); } protected function getLoginUrl() { - return $this->router->generate('app_login'); + return $this->urlGenerator->generate('app_login'); } } diff --git a/src/Util/AutoloaderUtil.php b/src/Util/AutoloaderUtil.php index 39b065332..6d24355e9 100644 --- a/src/Util/AutoloaderUtil.php +++ b/src/Util/AutoloaderUtil.php @@ -35,7 +35,7 @@ public function __construct(ComposerAutoloaderFinder $autoloaderFinder) * * @param string $className * - * @return null|string + * @return string|null * * @throws \Exception */ diff --git a/tests/fixtures/MakeAuthenticatorLoginFormCustomUsernameField/tests/SecurityControllerTest.php b/tests/fixtures/MakeAuthenticatorLoginFormCustomUsernameField/tests/SecurityControllerTest.php index 7bbd8d765..9c0daca20 100644 --- a/tests/fixtures/MakeAuthenticatorLoginFormCustomUsernameField/tests/SecurityControllerTest.php +++ b/tests/fixtures/MakeAuthenticatorLoginFormCustomUsernameField/tests/SecurityControllerTest.php @@ -11,7 +11,7 @@ public function testCommand() { $authenticatorReflection = new \ReflectionClass(AppCustomAuthenticator::class); $constructorParameters = $authenticatorReflection->getConstructor()->getParameters(); - $this->assertSame('router', $constructorParameters[0]->getName()); + $this->assertSame('urlGenerator', $constructorParameters[0]->getName()); // assert authenticator is injected $this->assertEquals(3, \count($constructorParameters)); diff --git a/tests/fixtures/MakeAuthenticatorLoginFormUserNotEntity/tests/SecurityControllerTest.php b/tests/fixtures/MakeAuthenticatorLoginFormUserNotEntity/tests/SecurityControllerTest.php index facc7b7a5..9f8a27180 100644 --- a/tests/fixtures/MakeAuthenticatorLoginFormUserNotEntity/tests/SecurityControllerTest.php +++ b/tests/fixtures/MakeAuthenticatorLoginFormUserNotEntity/tests/SecurityControllerTest.php @@ -11,7 +11,7 @@ public function testCommand() { $authenticatorReflection = new \ReflectionClass(AppCustomAuthenticator::class); $constructorParameters = $authenticatorReflection->getConstructor()->getParameters(); - $this->assertSame('router', $constructorParameters[0]->getName()); + $this->assertSame('urlGenerator', $constructorParameters[0]->getName()); // assert authenticator is injected $this->assertEquals(3, \count($constructorParameters)); diff --git a/tests/fixtures/MakeAuthenticatorLoginFormUserNotEntityNoEncoder/tests/SecurityControllerTest.php b/tests/fixtures/MakeAuthenticatorLoginFormUserNotEntityNoEncoder/tests/SecurityControllerTest.php index 29362bf0d..12aff1d9d 100644 --- a/tests/fixtures/MakeAuthenticatorLoginFormUserNotEntityNoEncoder/tests/SecurityControllerTest.php +++ b/tests/fixtures/MakeAuthenticatorLoginFormUserNotEntityNoEncoder/tests/SecurityControllerTest.php @@ -11,7 +11,7 @@ public function testCommand() { $authenticatorReflection = new \ReflectionClass(AppCustomAuthenticator::class); $constructorParameters = $authenticatorReflection->getConstructor()->getParameters(); - $this->assertSame('router', $constructorParameters[0]->getName()); + $this->assertSame('urlGenerator', $constructorParameters[0]->getName()); // assert authenticator is *not* injected $this->assertEquals(2, \count($constructorParameters));