Skip to content

Commit

Permalink
Add more precise types for ElasticaAdapter (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
stof authored Dec 12, 2024
1 parent 07d9630 commit aca8768
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 13 deletions.
7 changes: 3 additions & 4 deletions lib/Adapter/Elastica/ElasticaAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Pagerfanta\Elastica;

use Elastica\Query;
use Elastica\Result;
use Elastica\ResultSet;
use Elastica\SearchableInterface;
use Pagerfanta\Adapter\AdapterInterface;
Expand All @@ -11,9 +12,7 @@
/**
* Adapter which calculates pagination from an Elastica Query.
*
* @template T
*
* @implements AdapterInterface<T>
* @implements AdapterInterface<Result>
*/
class ElasticaAdapter implements AdapterInterface
{
Expand Down Expand Up @@ -70,7 +69,7 @@ public function getNbResults(): int
* @param int<0, max> $offset
* @param int<0, max> $length
*
* @return iterable<array-key, T>
* @return iterable<int, Result>
*/
public function getSlice(int $offset, int $length): iterable
{
Expand Down
3 changes: 0 additions & 3 deletions lib/Adapter/Elastica/Tests/ElasticaAdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ final class ElasticaAdapterTest extends TestCase
*/
private array $options;

/**
* @var ElasticaAdapter<mixed>
*/
private ElasticaAdapter $adapter;

protected function setUp(): void
Expand Down
6 changes: 0 additions & 6 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,6 @@ parameters:
count: 2
path: lib/Adapter/Elastica/ElasticaAdapter.php

-
message: '#^Method Pagerfanta\\Elastica\\ElasticaAdapter\:\:getSlice\(\) should return iterable\<\(int\|string\), T\> but returns Elastica\\ResultSet\.$#'
identifier: return.type
count: 1
path: lib/Adapter/Elastica/ElasticaAdapter.php

-
message: '#^Method Pagerfanta\\Solarium\\SolariumAdapter\:\:getNbResults\(\) should return int\<0, max\> but returns int\|null\.$#'
identifier: return.type
Expand Down

0 comments on commit aca8768

Please sign in to comment.