[FrameworkBundle] make `KernelBrowser::loginUser()` session available for updating after login

by @arderyp

Some issues have been detected in this pull request

Issues that can be fixed by applying a patch

Review the proposed patch then download it to apply it manually or execute the following command from the repository root directory:

curl https://fabbot.io/patch/symfony/symfony/47001/60ff65aea0db42c4bf2cab83c7ab315dd0407210/cs.diff | patch -p0
diff -ru src/Symfony/Bundle/FrameworkBundle/KernelBrowser.php src/Symfony/Bundle/FrameworkBundle/KernelBrowser.php
--- src/Symfony/Bundle/FrameworkBundle/KernelBrowser.php	2025-02-11 19:22:59.660362120 +0000
+++ src/Symfony/Bundle/FrameworkBundle/KernelBrowser.php	2025-02-11 19:23:00.230363238 +0000
@@ -36,9 +36,6 @@
     private bool $reboot = true;
     private SessionInterface $session;
 
-    /**
-     * {@inheritdoc}
-     */
     public function __construct(KernelInterface $kernel, array $server = [], History $history = null, CookieJar $cookieJar = null)
     {
         parent::__construct($kernel, $server, $history, $cookieJar);
@@ -113,11 +110,11 @@
     public function loginUser(object $user, string $firewallContext = 'main'): static
     {
         if (!interface_exists(UserInterface::class)) {
-            throw new \LogicException(sprintf('"%s" requires symfony/security-core to be installed.', __METHOD__));
+            throw new \LogicException(\sprintf('"%s" requires symfony/security-core to be installed.', __METHOD__));
         }
 
         if (!$user instanceof UserInterface) {
-            throw new \LogicException(sprintf('The first argument of "%s" must be instance of "%s", "%s" provided.', __METHOD__, UserInterface::class, get_debug_type($user)));
+            throw new \LogicException(\sprintf('The first argument of "%s" must be instance of "%s", "%s" provided.', __METHOD__, UserInterface::class, get_debug_type($user)));
         }
 
         $token = new TestBrowserToken($user->getRoles(), $user, $firewallContext);
@@ -150,8 +147,6 @@
     /**
      * Set value on session initialized by loginUser().
      *
-     * @param mixed $value
-     *
      * @return $this
      */
     protected function setLoginSessionValue(string $name, $value): self
@@ -159,14 +154,13 @@
         if (isset($this->session)) {
             $this->session->set($name, $value);
             $this->session->save();
+
             return $this;
         }
-        throw new \LogicException("loginUser() must be called to initialize session");
+        throw new \LogicException('loginUser() must be called to initialize session');
     }
 
     /**
-     * {@inheritdoc}
-     *
      * @param Request $request
      */
     protected function doRequest(object $request): Response
@@ -191,8 +185,6 @@
     }
 
     /**
-     * {@inheritdoc}
-     *
      * @param Request $request
      */
     protected function doRequestInProcess(object $request): Response

0
Common Typos

0
License Headers

0
Pull Request Contributor Headers

0
File Permissions

0
Merge Commits

Issues that can be fixed by applying a patch

Review the proposed patch then download it to apply it manually or execute the following command from the repository root directory:

curl https://fabbot.io/patch/symfony/symfony/47001/60ff65aea0db42c4bf2cab83c7ab315dd0407210/exception_messages.diff | patch -p0
diff -ru src/Symfony/Bundle/FrameworkBundle/KernelBrowser.php src/Symfony/Bundle/FrameworkBundle/KernelBrowser.php
--- src/Symfony/Bundle/FrameworkBundle/KernelBrowser.php	2025-02-11 19:22:59.660362120 +0000
+++ src/Symfony/Bundle/FrameworkBundle/KernelBrowser.php	2025-02-11 19:23:00.623364008 +0000
@@ -161,7 +161,7 @@
             $this->session->save();
             return $this;
         }
-        throw new \LogicException("loginUser() must be called to initialize session");
+        throw new \LogicException("loginUser() must be called to initialize session.");
     }
 
     /**

0
Usage of void in test files

0
Use ::class whenever possible

0
Deprecation Messages