aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public
diff options
context:
space:
mode:
authorCarl Schwan <carl@carlschwan.eu>2022-05-13 16:14:01 +0200
committerCarl Schwan <carl@carlschwan.eu>2022-05-13 16:14:01 +0200
commit7f899b3bc8a4debcde2d4f4b81d9044221718292 (patch)
treedfa981a7a2aa28817b10b482f788e264aebd814f /lib/public
parentf4058a2432f748ffff6d7e45f2fb79ca383f8dd1 (diff)
downloadnextcloud-server-7f899b3bc8a4debcde2d4f4b81d9044221718292.tar.gz
nextcloud-server-7f899b3bc8a4debcde2d4f4b81d9044221718292.zip
Improve psalm annotation to make it stricter
Now using class-string<T> as input will only return T, and any other string will return mixed Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Diffstat (limited to 'lib/public')
-rw-r--r--lib/public/Server.php5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/public/Server.php b/lib/public/Server.php
index be6b6a49236..f4522e8ae10 100644
--- a/lib/public/Server.php
+++ b/lib/public/Server.php
@@ -41,8 +41,9 @@ use Psr\Container\NotFoundExceptionInterface;
final class Server {
/**
* @template T
- * @param class-string<T>|string $serviceName
- * @return T|mixed
+ * @template S as class-string<T>|string
+ * @param S $serviceName
+ * @return (S is class-string<T> ? T : mixed)
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
* @since 25.0.0