Skip to content

Commit dd4b27a

Browse files
committed
Declare conditional return types
1 parent 7cd9986 commit dd4b27a

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
@@ -220,6 +220,7 @@ public function setSchemasPath($path)
220220
* Process the SAML Response sent by the IdP.
221221
*
222222
* @param string|null $requestId The ID of the AuthNRequest sent by this SP to the IdP
223+
* @phpstan-return ($stay is true ? string : never)
223224
*
224225
* @throws Error
225226
* @throws ValidationError
@@ -270,6 +271,7 @@ public function processResponse($requestId = null)
270271
* @param bool $stay True if we want to stay (returns the url string) False to redirect
271272
*
272273
* @return string|null
274+
* @phpstan-return ($stay is true ? string : never)
273275
*
274276
* @throws Error
275277
*/
@@ -352,6 +354,7 @@ public function processSLO($keepLocalSession = false, $requestId = null, $retrie
352354
* @param bool $stay True if we want to stay (returns the url string) False to redirect
353355
*
354356
* @return string|null
357+
* @phpstan-return ($stay is true ? string : never)
355358
*/
356359
public function redirectTo($url = '', array $parameters = array(), $stay = false)
357360
{
@@ -533,6 +536,7 @@ public function getAttributeWithFriendlyName($friendlyName)
533536
* @param string $nameIdValueReq Indicates to the IdP the subject that should be authenticated
534537
*
535538
* @return string|null If $stay is True, it return a string with the SLO URL + LogoutRequest + parameters
539+
* @phpstan-return ($stay is true ? string : never)
536540
*
537541
* @throws Error
538542
*/
@@ -573,6 +577,7 @@ public function login($returnTo = null, array $parameters = array(), $forceAuthn
573577
* @param string|null $nameIdNameQualifier The NameID NameQualifier will be set in the LogoutRequest.
574578
*
575579
* @return string|null If $stay is True, it return a string with the SLO URL + LogoutRequest + parameters
580+
* @phpstan-return ($stay is true ? string : never)
576581
*
577582
* @throws Error
578583
*/

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)