Skip to content

Commit a562997

Browse files
committed
Declare conditional return types
1 parent ab761e5 commit a562997

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/Saml2/Auth.php

+5
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ public function setSchemasPath($path)
223223
* Process the SAML Response sent by the IdP.
224224
*
225225
* @param string|null $requestId The ID of the AuthNRequest sent by this SP to the IdP
226+
* @phpstan-return ($stay is true ? string : never)
226227
*
227228
* @throws Error
228229
* @throws ValidationError
@@ -273,6 +274,7 @@ public function processResponse($requestId = null)
273274
* @param bool $stay True if we want to stay (returns the url string) False to redirect
274275
*
275276
* @return string|null
277+
* @phpstan-return ($stay is true ? string : never)
276278
*
277279
* @throws Error
278280
*/
@@ -355,6 +357,7 @@ public function processSLO($keepLocalSession = false, $requestId = null, $retrie
355357
* @param bool $stay True if we want to stay (returns the url string) False to redirect
356358
*
357359
* @return string|null
360+
* @phpstan-return ($stay is true ? string : never)
358361
*/
359362
public function redirectTo($url = '', array $parameters = array(), $stay = false)
360363
{
@@ -536,6 +539,7 @@ public function getAttributeWithFriendlyName($friendlyName)
536539
* @param string $nameIdValueReq Indicates to the IdP the subject that should be authenticated
537540
*
538541
* @return string|null If $stay is True, it return a string with the SLO URL + LogoutRequest + parameters
542+
* @phpstan-return ($stay is true ? string : never)
539543
*
540544
* @throws Error
541545
*/
@@ -576,6 +580,7 @@ public function login($returnTo = null, array $parameters = array(), $forceAuthn
576580
* @param string|null $nameIdNameQualifier The NameID NameQualifier will be set in the LogoutRequest.
577581
*
578582
* @return string|null If $stay is True, it return a string with the SLO URL + LogoutRequest + parameters
583+
* @phpstan-return ($stay is true ? string : never)
579584
*
580585
* @throws Error
581586
*/

src/Saml2/Utils.php

+2
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ public static function getStringBetween($str, $start, $end)
310310
* @param bool $stay True if we want to stay (returns the url string) False to redirect
311311
*
312312
* @return string|null $url
313+
* @phpstan-return ($stay is true ? string : never)
313314
*
314315
* @throws Error
315316
*/
@@ -916,6 +917,7 @@ public static function parseDuration($duration, $timestamp = null)
916917
* @param string|int|null $validUntil The valid until date, as a string or as a timestamp
917918
*
918919
* @return int|null $expireTime The expiration time.
920+
* @phpstan-return ($cacheDuration is true ? string : never)
919921
*
920922
* @throws Exception
921923
*/

0 commit comments

Comments
 (0)