]> source.dussan.org Git - nextcloud-server.git/commitdiff
Improve psalm annotation to make it stricter 32384/head
authorCarl Schwan <carl@carlschwan.eu>
Fri, 13 May 2022 14:14:01 +0000 (16:14 +0200)
committerCarl Schwan <carl@carlschwan.eu>
Fri, 13 May 2022 14:14:01 +0000 (16:14 +0200)
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>
build/psalm-baseline.xml
lib/public/Server.php

index c35d71a79aeabcb222ca97f5f38ac66ba81d1349..84030160d7b5ab976a772d410fb19ae20657ecab 100644 (file)
     </InvalidReturnType>
   </file>
   <file src="apps/files_external/lib/Lib/Storage/SMB.php">
-    <InvalidPropertyAssignmentValue occurrences="1"/>
     <InvalidScalarArgument occurrences="7">
       <code>$e-&gt;getCode()</code>
       <code>$e-&gt;getCode()</code>
index be6b6a49236a542e0f3162d3b9c929b754b06250..f4522e8ae1080a895d06b1073d7f50ed05e300ad 100644 (file)
@@ -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