Skip to content
This repository was archived by the owner on Jul 24, 2023. It is now read-only.

Commit 4578285

Browse files
committed
Properly return null if false is returned on failed connection
1 parent 5f037bd commit 4578285

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/Resolvers/UserResolver.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ public function setConnection($connection)
5656
*/
5757
public function byId($identifier)
5858
{
59-
return $this->query()->findByGuid($identifier) ?? null;
59+
if ($user = $this->query()->findByGuid($identifier)) {
60+
return $user;
61+
}
6062
}
6163

6264
/**
@@ -75,8 +77,10 @@ public function byCredentials(array $credentials = [])
7577
$this->getLdapDiscoveryAttribute() :
7678
$this->getDatabaseUsernameColumn();
7779

78-
if (!array_key_exists($attribute, $credentials)) {
79-
throw new RuntimeException("The '$attribute' key is missing from the given credentials array.");
80+
if (! array_key_exists($attribute, $credentials)) {
81+
throw new RuntimeException(
82+
"The '$attribute' key is missing from the given credentials array."
83+
);
8084
}
8185

8286
return $this->query()->whereEquals(

0 commit comments

Comments
 (0)