diff --git a/src/FactoryInterface.php b/src/FactoryInterface.php index 70a73c03..1f48526e 100644 --- a/src/FactoryInterface.php +++ b/src/FactoryInterface.php @@ -41,7 +41,12 @@ public function loader( ): LoaderInterface; /** + * @template TEntity + * * Create repository associated with given role. + * + * @param non-empty-string|class-string $role + * @return ($role is class-string ? RepositoryInterface : RepositoryInterface) */ public function repository( ORMInterface $orm, diff --git a/src/RepositoryInterface.php b/src/RepositoryInterface.php index 6d33fbe4..422cb9c5 100644 --- a/src/RepositoryInterface.php +++ b/src/RepositoryInterface.php @@ -7,7 +7,7 @@ /** * Defines ability to locate entities based on scope parameters. * - * @template TEntity of object + * @template TEntity */ interface RepositoryInterface { diff --git a/src/Service/Implementation/RepositoryProvider.php b/src/Service/Implementation/RepositoryProvider.php index 90ebec26..b8c074bd 100644 --- a/src/Service/Implementation/RepositoryProvider.php +++ b/src/Service/Implementation/RepositoryProvider.php @@ -18,7 +18,7 @@ */ final class RepositoryProvider implements RepositoryProviderInterface { - /** @var array */ + /** @var array> */ private array $repositories = []; public function __construct( diff --git a/src/Service/RepositoryProviderInterface.php b/src/Service/RepositoryProviderInterface.php index 12a04640..af6565bc 100644 --- a/src/Service/RepositoryProviderInterface.php +++ b/src/Service/RepositoryProviderInterface.php @@ -9,9 +9,12 @@ interface RepositoryProviderInterface { /** + * @template TEntity of object + * * Get repository associated with given entity role. * - * @param non-empty-string $entity + * @param class-string|non-empty-string $entity + * @return ($entity is class-string ? RepositoryInterface : RepositoryInterface) */ public function getRepository(string $entity): RepositoryInterface; }