Skip to content

Commit 6399e3f

Browse files
chore: provider generics phpdoc (#4868)
1 parent 7ecb56f commit 6399e3f

File tree

5 files changed

+18
-3
lines changed

5 files changed

+18
-3
lines changed

src/Doctrine/Orm/Extension/QueryResultCollectionExtensionInterface.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,15 @@
2222
*
2323
* @author Samuel ROZE <[email protected]>
2424
* @author Kévin Dunglas <[email protected]>
25+
*
26+
* @template T of object
2527
*/
2628
interface QueryResultCollectionExtensionInterface extends QueryCollectionExtensionInterface
2729
{
2830
public function supportsResult(string $resourceClass, Operation $operation = null, array $context = []): bool;
2931

3032
/**
31-
* @return iterable
33+
* @return iterable<T>
3234
*/
3335
public function getResult(QueryBuilder $queryBuilder, string $resourceClass = null, Operation $operation = null, array $context = []);
3436
}

src/Doctrine/Orm/Extension/QueryResultItemExtensionInterface.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,15 @@
2121
* for specific cases such as Query alteration.
2222
*
2323
* @author Antoine BLUCHET <[email protected]>
24+
*
25+
* @template T of object
2426
*/
2527
interface QueryResultItemExtensionInterface extends QueryItemExtensionInterface
2628
{
2729
public function supportsResult(string $resourceClass, Operation $operation = null, array $context = []): bool;
2830

2931
/**
30-
* @return object|null
32+
* @return T|null
3133
*/
3234
public function getResult(QueryBuilder $queryBuilder, string $resourceClass = null, Operation $operation = null, array $context = []);
3335
}

src/State/Pagination/PaginatorInterface.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
* current page, as an integer.
1919
*
2020
* @author Kévin Dunglas <[email protected]>
21+
*
22+
* @template T of object
23+
*
24+
* @extends PartialPaginatorInterface<T>
2125
*/
2226
interface PaginatorInterface extends PartialPaginatorInterface
2327
{

src/State/Pagination/PartialPaginatorInterface.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
* Partial Paginator Interface.
1818
*
1919
* @author Baptiste Meyer <[email protected]>
20+
*
21+
* @template T of object
22+
*
23+
* @extends \Traversable<T>
2024
*/
2125
interface PartialPaginatorInterface extends \Traversable, \Countable
2226
{

src/State/ProviderInterface.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,22 @@
1414
namespace ApiPlatform\State;
1515

1616
use ApiPlatform\Metadata\Operation;
17+
use ApiPlatform\State\Pagination\PartialPaginatorInterface;
1718

1819
/**
1920
* Retrieves data from a persistence layer.
2021
*
2122
* @author Antoine Bluchet <[email protected]>
2223
* @experimental
24+
*
25+
* @template T of object
2326
*/
2427
interface ProviderInterface
2528
{
2629
/**
2730
* Provides data.
2831
*
29-
* @return object|array|null
32+
* @return T|PartialPaginatorInterface<T>|iterable<T>|null
3033
*/
3134
public function provide(Operation $operation, array $uriVariables = [], array $context = []);
3235
}

0 commit comments

Comments
 (0)