From a55dc59eb89860dd3b15e58d70533dd1bbdfa5ef Mon Sep 17 00:00:00 2001 From: David Buchmann Date: Tue, 19 Sep 2023 18:58:04 +0200 Subject: [PATCH] fix invalid invocation of rows in tests --- lib/Doctrine/ODM/PHPCR/Query/Query.php | 8 +++++--- .../Tests/ODM/PHPCR/Functional/QueryBuilderTest.php | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/Doctrine/ODM/PHPCR/Query/Query.php b/lib/Doctrine/ODM/PHPCR/Query/Query.php index 6d111eef3..a00d00b51 100644 --- a/lib/Doctrine/ODM/PHPCR/Query/Query.php +++ b/lib/Doctrine/ODM/PHPCR/Query/Query.php @@ -5,6 +5,7 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\ODM\PHPCR\DocumentManagerInterface; use PHPCR\Query\QueryInterface; +use PHPCR\Query\QueryResultInterface; /** * Query @@ -228,7 +229,7 @@ public function getResult($hydrationMode = self::HYDRATE_DOCUMENT) * * Alias for execute(null, HYDRATE_PHPCR). * - * @return array + * @return QueryResultInterface */ public function getPhpcrNodeResult() { @@ -250,8 +251,9 @@ public function getOneOrNullResult($hydrationMode = null) if (count($result) > 1) { throw QueryException::nonUniqueResult(); - } elseif (count($result) <= 0) { - return; + } + if (count($result) <= 0) { + return null; } return $result->first(); diff --git a/tests/Doctrine/Tests/ODM/PHPCR/Functional/QueryBuilderTest.php b/tests/Doctrine/Tests/ODM/PHPCR/Functional/QueryBuilderTest.php index 2beb6088a..618a9f3e8 100644 --- a/tests/Doctrine/Tests/ODM/PHPCR/Functional/QueryBuilderTest.php +++ b/tests/Doctrine/Tests/ODM/PHPCR/Functional/QueryBuilderTest.php @@ -283,7 +283,7 @@ public function testSelect(): void $result = $qb->getQuery()->getPhpcrNodeResult(); $rows = $result->getRows(); - $values = $rows->current()->getValues('a'); + $values = $rows->current()->getValues(); $values = $this->cleanValues($values); $this->assertEquals(1, $rows->count()); @@ -306,7 +306,7 @@ public function testSelect(): void $result = $qb->getQuery()->getPhpcrNodeResult(); $rows = $result->getRows(); - $values = $rows->current()->getValues('a'); + $values = $rows->current()->getValues(); $values = $this->cleanValues($values); switch ($qb->getQuery()->getLanguage()) {