From 7d8abf11754060c406b00dfffb3bf1a45a5b68aa Mon Sep 17 00:00:00 2001 From: David Grudl Date: Sun, 10 Dec 2023 19:56:18 +0100 Subject: [PATCH] improved phpDoc --- src/DI/Autowiring.php | 1 + src/DI/Container.php | 2 +- src/DI/ContainerBuilder.php | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/DI/Autowiring.php b/src/DI/Autowiring.php index b70cfe446..b6683c2bc 100644 --- a/src/DI/Autowiring.php +++ b/src/DI/Autowiring.php @@ -41,6 +41,7 @@ public function __construct(ContainerBuilder $builder) /** * Resolves service name by type. * @param bool $throw exception if service not found? + * @return ($throw is true ? string : ?string) * @throws MissingServiceException when not found * @throws ServiceCreationException when multiple found */ diff --git a/src/DI/Container.php b/src/DI/Container.php index 2ecbf225f..88274b8be 100644 --- a/src/DI/Container.php +++ b/src/DI/Container.php @@ -247,7 +247,7 @@ public function createService(string $name, array $args = []): object * Resolves service by type. * @template T of object * @param class-string $type - * @return ?T + * @return ($throw is true ? T : ?T) * @throws MissingServiceException */ public function getByType(string $type, bool $throw = true): ?object diff --git a/src/DI/ContainerBuilder.php b/src/DI/ContainerBuilder.php index 8535575ff..ca05dd061 100644 --- a/src/DI/ContainerBuilder.php +++ b/src/DI/ContainerBuilder.php @@ -225,6 +225,7 @@ public function addExcludedClasses(array $types) /** * Resolves autowired service name by type. * @param bool $throw exception if service doesn't exist? + * @return ($throw is true ? string : ?string) * @throws MissingServiceException */ public function getByType(string $type, bool $throw = false): ?string