From c3b26d40347b285477beac2389ce0d78281a6489 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Tue, 23 Apr 2024 09:26:12 +0200 Subject: [PATCH 1/2] Declare conditional return type --- lib/Saml2/Utils.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/Saml2/Utils.php b/lib/Saml2/Utils.php index 24ecbd58..1a7f85f3 100644 --- a/lib/Saml2/Utils.php +++ b/lib/Saml2/Utils.php @@ -300,6 +300,7 @@ public static function getStringBetween($str, $start, $end) * @param bool $stay True if we want to stay (returns the url string) False to redirect * * @return string|null $url + * @phpstan-return ($stay is true ? string : never) * * @throws OneLogin_Saml2_Error */ From 1d2d16e1bc76f05bdeae47664a84b7f5b9a0e6ce Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Tue, 23 Apr 2024 09:28:34 +0200 Subject: [PATCH 2/2] Declare conditional return types in Auth --- lib/Saml2/Auth.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/Saml2/Auth.php b/lib/Saml2/Auth.php index c8a1c6f0..bb882cd0 100644 --- a/lib/Saml2/Auth.php +++ b/lib/Saml2/Auth.php @@ -246,6 +246,7 @@ public function processResponse($requestId = null) * @param bool $stay True if we want to stay (returns the url string) False to redirect * * @return string|null + * @phpstan-return ($stay is true ? string : never) * * @throws OneLogin_Saml2_Error */ @@ -498,6 +499,7 @@ public function getAttributeWithFriendlyName($friendlyName) * @param string $nameIdValueReq Indicates to the IdP the subject that should be authenticated * * @return string|null If $stay is True, it return a string with the SLO URL + LogoutRequest + parameters + * @phpstan-return ($stay is true ? string : never) * * @throws OneLogin_Saml2_Error */ @@ -540,6 +542,7 @@ public function login($returnTo = null, $parameters = array(), $forceAuthn = fal * @param string|null $nameIdNameQualifier The NameID NameQualifier will be set in the LogoutRequest. * * @return string|null If $stay is True, it return a string with the SLO URL + LogoutRequest + parameters + * @phpstan-return ($stay is true ? string : never) * * @throws OneLogin_Saml2_Error */