Skip to content

Commit 08369a9

Browse files
authored
Merge pull request #1654 from deguif/type-hint-pager-provider-signatures
Add type-hints on signatures of pager-provider methods
2 parents 985e7a5 + 0b31095 commit 08369a9

File tree

6 files changed

+9
-8
lines changed

6 files changed

+9
-8
lines changed

CHANGELOG-6.0.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ in 6.0 versions.
1414
* Removed `FOS\ElasticaBundle\Exception\InvalidArgumentTypeException`
1515
* [BC break] Signature of method `FOS\ElasticaBundle\Finder\FinderInterface::find()` was changed.
1616
* [BC break] Signature of method `FOS\ElasticaBundle\Persister\ObjectPersisterInterface::handlesObject()` was changed.
17+
* [BC break] Signature of method `FOS\ElasticaBundle\Provider\PagerProviderInterface::provider()` was changed.
1718
* [BC break] Signature of methods `getPager`, `getOptions` and `getObjectPersister` from interface `FOS\ElasticaBundle\Persister\Event\PersistEvent` were changed.
1819
* [BC break] Signature of methods `getNbResults`, `getNbPages`, `getCurrentPage`, `setCurrentPage`, `getMaxPerPage` and `setMaxPerPage` from interface `FOS\ElasticaBundle\Provider\PagerInterface` were changed.
1920
* [BC break] Signature of methods `findPaginated`, `createPaginatorAdapter` and `createRawPaginatorAdapter` from interface `FOS\ElasticaBundle\Finder\PaginatedFinderInterface` were changed.

src/Doctrine/MongoDBPagerProvider.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Doctrine\Persistence\ManagerRegistry;
1515
use FOS\ElasticaBundle\Provider\PagerfantaPager;
16+
use FOS\ElasticaBundle\Provider\PagerInterface;
1617
use FOS\ElasticaBundle\Provider\PagerProviderInterface;
1718
use Pagerfanta\Adapter\DoctrineODMMongoDBAdapter;
1819
use Pagerfanta\Pagerfanta;
@@ -53,7 +54,7 @@ public function __construct(ManagerRegistry $doctrine, RegisterListenersService
5354
/**
5455
* {@inheritdoc}
5556
*/
56-
public function provide(array $options = [])
57+
public function provide(array $options = []): PagerInterface
5758
{
5859
$options = array_replace($this->baseOptions, $options);
5960

src/Doctrine/ORMPagerProvider.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Doctrine\ORM\QueryBuilder;
1616
use Doctrine\Persistence\ManagerRegistry;
1717
use FOS\ElasticaBundle\Provider\PagerfantaPager;
18+
use FOS\ElasticaBundle\Provider\PagerInterface;
1819
use FOS\ElasticaBundle\Provider\PagerProviderInterface;
1920
use Pagerfanta\Adapter\DoctrineORMAdapter;
2021
use Pagerfanta\Pagerfanta;
@@ -57,7 +58,7 @@ public function __construct(ManagerRegistry $doctrine, RegisterListenersService
5758
/**
5859
* {@inheritdoc}
5960
*/
60-
public function provide(array $options = [])
61+
public function provide(array $options = []): PagerInterface
6162
{
6263
$options = array_replace($this->baseOptions, $options);
6364

src/Doctrine/PHPCRPagerProvider.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Doctrine\Persistence\ManagerRegistry;
1515
use FOS\ElasticaBundle\Provider\PagerfantaPager;
16+
use FOS\ElasticaBundle\Provider\PagerInterface;
1617
use FOS\ElasticaBundle\Provider\PagerProviderInterface;
1718
use Pagerfanta\Adapter\DoctrineODMPhpcrAdapter;
1819
use Pagerfanta\Pagerfanta;
@@ -55,7 +56,7 @@ public function __construct(ManagerRegistry $doctrine, RegisterListenersService
5556
/**
5657
* {@inheritdoc}
5758
*/
58-
public function provide(array $options = [])
59+
public function provide(array $options = []): PagerInterface
5960
{
6061
$options = array_replace($this->baseOptions, $options);
6162

src/Provider/PagerProviderInterface.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,5 @@
1313

1414
interface PagerProviderInterface
1515
{
16-
/**
17-
* @return PagerInterface
18-
*/
19-
public function provide(array $options = []);
16+
public function provide(array $options = []): PagerInterface;
2017
}

src/Provider/PagerProviderRegistry.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function getProviders()
4545
*
4646
* @throws \InvalidArgumentException if no provider was registered for the index and type
4747
*/
48-
public function getProvider(string $index): ?PagerProviderInterface
48+
public function getProvider(string $index): PagerProviderInterface
4949
{
5050
if (!$this->providers->has($index)) {
5151
throw new \InvalidArgumentException(sprintf('No provider was registered for index "%s".', $index));

0 commit comments

Comments
 (0)