-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BUGFIX] Fix return type of findByUid()
On access restricted pages an exception is thrown as the user is null. (If logged in via backend)
- Loading branch information
Showing
1 changed file
with
3 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,14 +32,13 @@ public function findByUsergroup(int $uid): QueryResultInterface | |
* @param int $uid | ||
* @return User | ||
*/ | ||
public function findByUid($uid): User | ||
public function findByUid($uid): ?User | ||
{ | ||
$query = $this->createQuery(); | ||
$query->getQuerySettings()->setRespectStoragePage(false); | ||
$query->matching($query->equals('uid', $uid)); | ||
/** @var User $user */ | ||
$user = $query->execute()->getFirst(); | ||
return $user; | ||
/** @var User|null $user */ | ||
return $query->execute()->getFirst(); | ||
Check failure on line 41 in Classes/Domain/Repository/UserRepository.php GitHub Actions / PHPstan
Check failure on line 41 in Classes/Domain/Repository/UserRepository.php GitHub Actions / PHPstan
|
||
} | ||
|
||
/** | ||
|