8000 cs fix · symfony/symfony@7ba23e8 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7ba23e8

Browse files
cs fix
1 parent 3ed91c4 commit 7ba23e8

File tree

1 file changed

+17
-15
lines changed
  • src/Symfony/Component/Security/Http/Authenticator/Passport/Badge

1 file changed

+17
-15
lines changed

src/Symfony/Component/Security/Http/Authenticator/Passport/Badge/UserBadge.php

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -60,27 +60,29 @@ public function getUserIdentifier(): string
6060
*/
6161
public function getUser(): UserInterface
6262
{
63-
if (null === $this->user) {
64-
if (null === $this->userLoader) {
65-
throw new \LogicException(sprintf('No user loader is configured, did you forget to register the "%s" listener?', UserProviderListener::class));
66-
}
63+
if (null !== $this->user) {
64+
return $this->user;
65+
}
66+
67+
if (null === $this->userLoader) {
68+
throw new \LogicException(sprintf('No user loader is configured, did you forget to register the "%s" listener?', UserProviderListener::class));
69+
}
6770

68-
$this->user = ($this->userLoader)($this->userIdentifier);
71+
$user = ($this->userLoader)($this->userIdentifier);
6972

70-
// No user has been found via the $this->userLoader callback
71-
if (null === $this->user) {
72-
$exception = new UserNotFoundException();
73-
$exception->setUserIdentifier($this->userIdentifier);
73+
// No user has been found via the $this->userLoader callback
74+
if (null === $user) {
75+
$exception = new UserNotFoundException();
76+
$exception->setUserIdentifier($this->userIdentifier);
7477

75-
throw $exception;
76-
}
78+
throw $exception;
79+
}
7780

78-
if (!$this->user instanceof UserInterface) {
79-
throw new AuthenticationServiceException(sprintf('The user provider must return a UserInterface object, "%s" given.', get_debug_type($this->user)));
80-
}
81+
if (!$user instanceof UserInterface) {
82+
throw new AuthenticationServiceException(sprintf('The user provider must return a UserInterface object, "%s" given.', get_debug_type($user)));
8183
}
8284

83-
return $this->user;
85+
return $this->user = $user;
8486
}
8587

8688
public function getUserLoader(): ?callable

0 commit comments

Comments
 (0)
0