diff --git a/session/SessionHandler.php b/session/SessionHandler.php index b5fa29fc..3f9d82e4 100644 --- a/session/SessionHandler.php +++ b/session/SessionHandler.php @@ -43,7 +43,7 @@ interface SessionHandlerInterface * Sessions that have not updated for * the last maxlifetime seconds will be removed. *
- * @return bool+ * @return int|bool
* The return value (usually TRUE on success, FALSE on failure). * Note this value is returned internally to PHP for processing. *
@@ -71,7 +71,7 @@ interface SessionHandlerInterface * Read session data * @link https://php.net/manual/en/sessionhandlerinterface.read.php * @param string $id The session id to read data for. - * @return string+ * @return string|false
* Returns an encoded string of the read data. * If nothing was read, it must return an empty string. * Note this value is returned internally to PHP for processing. @@ -113,7 +113,9 @@ interface SessionIdInterface /** * Create session ID * @link https://php.net/manual/en/sessionidinterface.create-sid.php - * @return string + * @return string
+ * The new session ID. Note that this value is returned internally to PHP for processing. + *
*/ public function create_sid(); } @@ -129,6 +131,7 @@ interface SessionUpdateTimestampHandlerInterface { /** * Validate session id + * @link https://www.php.net/manual/sessionupdatetimestamphandlerinterface.validateid * @param string $id The session id * @return bool* Note this value is returned internally to PHP for processing. @@ -138,6 +141,7 @@ interface SessionUpdateTimestampHandlerInterface /** * Update timestamp of a session + * @link https://www.php.net/manual/sessionupdatetimestamphandlerinterface.updatetimestamp.php * @param string $id The session id * @param string $data
* The encoded session data. This data is the @@ -206,7 +210,7 @@ class SessionHandler implements SessionHandlerInterface, SessionIdInterface * Sessions that have not updated for * the last maxlifetime seconds will be removed. *
- * @return bool+ * @return int|bool
* The return value (usually TRUE on success, FALSE on failure). * Note this value is returned internally to PHP for processing. *
@@ -234,7 +238,7 @@ class SessionHandler implements SessionHandlerInterface, SessionIdInterface * Read session data * @link https://php.net/manual/en/sessionhandler.read.php * @param string $id The session id to read data for. - * @return string+ * @return string|false
* Returns an encoded string of the read data. * If nothing was read, it must return an empty string. * Note this value is returned internally to PHP for processing. diff --git a/session/session.php b/session/session.php index 6c65768c..75120080 100644 --- a/session/session.php +++ b/session/session.php @@ -25,7 +25,8 @@ use JetBrains\PhpStorm\Internal\LanguageLevelTypeAware; *
* @return string|false the name of the current session. */ -function session_name(?string $name): string|false {} +#[LanguageLevelTypeAware(['8.0' => 'string|false'], default: 'string')] +function session_name(#[LanguageLevelTypeAware(['8.0' => 'null|string'], default: 'string')] $name) {} /** * Get and/or set the current session module.This callback is executed when a new session ID is required. * No parameters are provided, and the return value should be a string that is a valid * session ID for your handler.
- * @param callable $validate_sid [optional] - * @param callable $update_timestamp [optional] + * @param callable|null $validate_sid [optional] + * @param callable|null $update_timestamp [optional] * @return bool true on success or false on failure. */ -function session_set_save_handler(callable $open, callable $close, callable $read, callable $write, callable $destroy, callable $gc, $create_sid, $validate_sid, $update_timestamp): bool {} +function session_set_save_handler(callable $open, callable $close, callable $read, callable $write, callable $destroy, callable $gc, ?callable $create_sid = null, ?callable $validate_sid = null, ?callable $update_timestamp = null): bool {} /** * (PHP 5.4)+ * @param array $lifetime_or_options
* An associative array which may have any of the keys lifetime, path, domain, * secure, httponly and samesite. The values have the same meaning as described * for the parameters with the same name. The value of the samesite element @@ -348,12 +358,12 @@ function session_cache_expire(?int $value): int|false {} * @return bool returns true on success or false on failure. * @since 7.3 */ -function session_set_cookie_params(array $options): bool {} +function session_set_cookie_params(array $lifetime_or_options): bool {} /** * Set the session cookie parameters * @link https://php.net/manual/en/function.session-set-cookie-params.php - * @param array|int $lifetime_or_options
+ * @param int $lifetime_or_options
* Lifetime of the * session cookie, defined in seconds. *
@@ -379,7 +389,7 @@ function session_set_cookie_params(array $options): bool {} * @return void|bool since 7.2.0 returns true on success or false on failure. */ #[LanguageLevelTypeAware(["7.2" => "bool"], default: "void")] -function session_set_cookie_params(array|int $lifetime_or_options, ?string $path, ?string $domain, ?bool $secure = false, ?bool $httponly = false) {} +function session_set_cookie_params(int $lifetime_or_options, ?string $path = null, ?string $domain = null, ?bool $secure = null, ?bool $httponly = null) {} /** * Get the session cookie parameters