Skip to content

Commit f438520

Browse files
committed
return type is not nullable, when no result found, exception DocumentNotFound is thrown
1 parent 99f352d commit f438520

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Diff for: src/EntityManager.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ public function __construct(
2424
* @template T of \Spameri\Elastic\Entity\AbstractElasticEntity
2525
* @param class-string<T> $class
2626
* @param string $id
27-
* @return T|null
27+
* @return T
2828
*/
2929
public function find(
3030
string $id,
3131
string $class,
32-
)
32+
): \Spameri\Elastic\Entity\AbstractElasticEntity
3333
{
3434
$entity = $this->identityMap->get(
3535
class: $class,
@@ -54,12 +54,12 @@ class: $class,
5454
/**
5555
* @template T of \Spameri\Elastic\Entity\AbstractElasticEntity
5656
* @param class-string<T> $class
57-
* @return T|null
57+
* @return T
5858
*/
5959
public function findOneBy(
6060
\Spameri\ElasticQuery\ElasticQuery $elasticQuery,
6161
string $class,
62-
)
62+
): \Spameri\Elastic\Entity\AbstractElasticEntity
6363
{
6464
$elasticQuery->options()->changeSize(1);
6565

0 commit comments

Comments
 (0)