Skip to content

Commit

Permalink
Simplify OAuthEventClass documentation (#678)
Browse files Browse the repository at this point in the history
As the `$event->getClient()` method [returns a ClientInterface](https://github.com/FriendsOfSymfony/FOSOAuthServerBundle/blob/master/Event/AbstractAuthorizationEvent.php#L59), there is no need to check that this value is not null
  • Loading branch information
jdeniau authored Apr 1, 2021
1 parent 446f0c5 commit 5940472
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions Resources/doc/the_oauth_event_class.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,9 @@ class OAuthEventListener
public function onPostAuthorization(PostAuthorizationEvent $event)
{
if ($event->isAuthorizedClient()) {
if (null !== $client = $event->getClient()) {
$user = $this->getUser($event);
$user->addClient($client);
$user->save();
}
$user = $this->getUser($event);
$user->addClient($event->getClient());
$user->save();
}
}

Expand Down

0 comments on commit 5940472

Please sign in to comment.