Skip to content

Commit a366d01

Browse files
authored
Removed "of object" from the template annotation of the RepositoryInterface (#508)
1 parent f2d32fb commit a366d01

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

src/FactoryInterface.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,12 @@ public function loader(
4141
): LoaderInterface;
4242

4343
/**
44+
* @template TEntity
45+
*
4446
* Create repository associated with given role.
47+
*
48+
* @param non-empty-string|class-string<TEntity> $role
49+
* @return ($role is class-string<TEntity> ? RepositoryInterface<TEntity> : RepositoryInterface<object>)
4550
*/
4651
public function repository(
4752
ORMInterface $orm,

src/RepositoryInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
/**
88
* Defines ability to locate entities based on scope parameters.
99
*
10-
* @template TEntity of object
10+
* @template TEntity
1111
*/
1212
interface RepositoryInterface
1313
{

src/Service/Implementation/RepositoryProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919
final class RepositoryProvider implements RepositoryProviderInterface
2020
{
21-
/** @var array<non-empty-string, RepositoryInterface> */
21+
/** @var array<non-empty-string, RepositoryInterface<object>> */
2222
private array $repositories = [];
2323

2424
public function __construct(

src/Service/RepositoryProviderInterface.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,12 @@
99
interface RepositoryProviderInterface
1010
{
1111
/**
12+
* @template TEntity of object
13+
*
1214
* Get repository associated with given entity role.
1315
*
14-
* @param non-empty-string $entity
16+
* @param class-string<TEntity>|non-empty-string $entity
17+
* @return ($entity is class-string<TEntity> ? RepositoryInterface<TEntity> : RepositoryInterface<object>)
1518
*/
1619
public function getRepository(string $entity): RepositoryInterface;
1720
}

0 commit comments

Comments
 (0)