Skip to content
This repository was archived by the owner on Oct 15, 2025. It is now read-only.

Commit e55b467

Browse files
committed
fix(question): Use "single scalar result"
1 parent fcbdece commit e55b467

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/Repository/QuestionRepository.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,16 @@ public function getNextPage(int $page): ?int
2828
{
2929
try {
3030
$result = $this->createQueryBuilder('q')
31-
->select('q')
31+
->select('q.id')
3232
->where('q.id > :page')
3333
->orderBy('q.id', 'ASC')
3434
->setParameter('page', $page)
3535
->setMaxResults(1)
3636
->getQuery()
37-
->getOneOrNullResult()
37+
->getSingleScalarResult()
3838
;
3939

40-
\assert(\is_int($result) || null === $result, 'result should be an integer or null');
40+
\assert(\is_int($result), 'result should be an integer');
4141

4242
return $result;
4343
} catch (NoResultException) {
@@ -55,10 +55,10 @@ public function getPreviousPage(int $page): ?int
5555
->setParameter('page', $page)
5656
->setMaxResults(1)
5757
->getQuery()
58-
->getOneOrNullResult()
58+
->getSingleScalarResult()
5959
;
6060

61-
\assert(\is_int($result) || null === $result, 'result should be an integer or null');
61+
\assert(\is_int($result), 'result should be an integer');
6262

6363
return $result;
6464
} catch (NoResultException) {

0 commit comments

Comments
 (0)