Skip to content

Commit 0d3b547

Browse files
committed
PHP 8.4 deprecation: fix cases of implicitly marked nullable
1 parent e3c1480 commit 0d3b547

4 files changed

Lines changed: 7 additions & 7 deletions

File tree

src/SimpleSAML/Error/Exception.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class Exception extends \Exception
5353
* @param int $code Error code
5454
* @param \Throwable|null $cause The cause of this exception.
5555
*/
56-
public function __construct(string $message, int $code = 0, Throwable $cause = null)
56+
public function __construct(string $message, int $code = 0, ?Throwable $cause = null)
5757
{
5858
parent::__construct($message, $code);
5959

src/SimpleSAML/Session.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ public static function getSessionFromRequest(): Session
344344
* @return \SimpleSAML\Session|null The session that is stored in the session handler,
345345
* or null if the session wasn't found.
346346
*/
347-
public static function getSession(string $sessionId = null): ?Session
347+
public static function getSession(?string $sessionId = null): ?Session
348348
{
349349
$sh = SessionHandler::getSessionHandler();
350350

@@ -587,7 +587,7 @@ public function getRememberMeExpire(): ?int
587587
*
588588
* @param int $lifetime Number of seconds after when remember me session cookies expire.
589589
*/
590-
public function setRememberMeExpire(int $lifetime = null): void
590+
public function setRememberMeExpire(?int $lifetime = null): void
591591
{
592592
if ($lifetime === null) {
593593
$lifetime = self::$config->getOptionalInteger('session.rememberme.lifetime', 14 * 86400);
@@ -817,7 +817,7 @@ public function updateSessionCookies(array $params = []): void
817817
* @param string $authority The authentication source we are setting expire time for.
818818
* @param int $expire The number of seconds authentication source is valid.
819819
*/
820-
public function setAuthorityExpire(string $authority, int $expire = null): void
820+
public function setAuthorityExpire(string $authority, ?int $expire = null): void
821821
{
822822
$this->markDirty();
823823

src/SimpleSAML/SessionHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ abstract public function hasSessionCookie(): bool;
120120
*
121121
* @throws \SimpleSAML\Error\CannotSetCookie If we can't set the cookie.
122122
*/
123-
abstract public function setCookie(string $sessionName, ?string $sessionID, array $cookieParams = null): void;
123+
abstract public function setCookie(string $sessionName, ?string $sessionID, ?array $cookieParams = null): void;
124124

125125

126126
/**

src/SimpleSAML/SessionHandlerPHP.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ public function saveSession(Session $session): void
247247
* @throws \SimpleSAML\Error\Exception If it wasn't possible to disable session cookies or we are trying to load a
248248
* PHP session with a specific identifier and it doesn't match with the current session identifier.
249249
*/
250-
public function loadSession(string $sessionId = null): ?Session
250+
public function loadSession(?string $sessionId = null): ?Session
251251
{
252252
if ($sessionId !== session_id()) {
253253
throw new Error\Exception('Cannot load PHP session with a specific ID.');
@@ -331,7 +331,7 @@ public function getCookieParams(): array
331331
*
332332
* @throws \SimpleSAML\Error\CannotSetCookie If we can't set the cookie.
333333
*/
334-
public function setCookie(string $sessionName, ?string $sessionID, array $cookieParams = null): void
334+
public function setCookie(string $sessionName, ?string $sessionID, ?array $cookieParams = null): void
335335
{
336336
if ($cookieParams === null) {
337337
$cookieParams = session_get_cookie_params();

0 commit comments

Comments
 (0)