fix:更新已知bug,优化代码

This commit is contained in:
Ying
2022-11-28 19:11:12 +08:00
parent f6aee95cfc
commit 9445b206a2
1378 changed files with 53759 additions and 20789 deletions

View File

@@ -23,18 +23,14 @@ interface SessionInterface
/**
* Starts the session storage.
*
* @return bool
*
* @throws \RuntimeException if session fails to start
*/
public function start();
public function start(): bool;
/**
* Returns the session ID.
*
* @return string
*/
public function getId();
public function getId(): string;
/**
* Sets the session ID.
@@ -43,10 +39,8 @@ interface SessionInterface
/**
* Returns the session name.
*
* @return string
*/
public function getName();
public function getName(): string;
/**
* Sets the session name.
@@ -63,10 +57,8 @@ interface SessionInterface
* will leave the system settings unchanged, 0 sets the cookie
* to expire with browser session. Time is in seconds, and is
* not a Unix timestamp.
*
* @return bool
*/
public function invalidate(int $lifetime = null);
public function invalidate(int $lifetime = null): bool;
/**
* Migrates the current session to a new session id while maintaining all
@@ -77,10 +69,8 @@ interface SessionInterface
* will leave the system settings unchanged, 0 sets the cookie
* to expire with browser session. Time is in seconds, and is
* not a Unix timestamp.
*
* @return bool
*/
public function migrate(bool $destroy = false, int $lifetime = null);
public function migrate(bool $destroy = false, int $lifetime = null): bool;
/**
* Force the session to be saved and closed.
@@ -93,33 +83,23 @@ interface SessionInterface
/**
* Checks if an attribute is defined.
*
* @return bool
*/
public function has(string $name);
public function has(string $name): bool;
/**
* Returns an attribute.
*
* @param mixed $default The default value if not found
*
* @return mixed
*/
public function get(string $name, $default = null);
public function get(string $name, mixed $default = null): mixed;
/**
* Sets an attribute.
*
* @param mixed $value
*/
public function set(string $name, $value);
public function set(string $name, mixed $value);
/**
* Returns attributes.
*
* @return array
*/
public function all();
public function all(): array;
/**
* Sets attributes.
@@ -131,7 +111,7 @@ interface SessionInterface
*
* @return mixed The removed value or null when it does not exist
*/
public function remove(string $name);
public function remove(string $name): mixed;
/**
* Clears all attributes.
@@ -140,10 +120,8 @@ interface SessionInterface
/**
* Checks if the session was started.
*
* @return bool
*/
public function isStarted();
public function isStarted(): bool;
/**
* Registers a SessionBagInterface with the session.
@@ -152,15 +130,11 @@ interface SessionInterface
/**
* Gets a bag instance by name.
*
* @return SessionBagInterface
*/
public function getBag(string $name);
public function getBag(string $name): SessionBagInterface;
/**
* Gets session meta.
*
* @return MetadataBag
*/
public function getMetadataBag();
public function getMetadataBag(): MetadataBag;
}