fix:更新已知bug,优化代码
This commit is contained in:
@@ -18,8 +18,8 @@ namespace Symfony\Component\HttpFoundation\Session\Storage\Handler;
|
||||
*/
|
||||
class StrictSessionHandler extends AbstractSessionHandler
|
||||
{
|
||||
private $handler;
|
||||
private $doDestroy;
|
||||
private \SessionHandlerInterface $handler;
|
||||
private bool $doDestroy;
|
||||
|
||||
public function __construct(\SessionHandlerInterface $handler)
|
||||
{
|
||||
@@ -31,10 +31,16 @@ class StrictSessionHandler extends AbstractSessionHandler
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
* Returns true if this handler wraps an internal PHP session save handler using \SessionHandler.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function open($savePath, $sessionName)
|
||||
public function isWrapper(): bool
|
||||
{
|
||||
return $this->handler instanceof \SessionHandler;
|
||||
}
|
||||
|
||||
public function open(string $savePath, string $sessionName): bool
|
||||
{
|
||||
parent::open($savePath, $sessionName);
|
||||
|
||||
@@ -44,16 +50,12 @@ class StrictSessionHandler extends AbstractSessionHandler
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doRead(string $sessionId)
|
||||
protected function doRead(string $sessionId): string
|
||||
{
|
||||
return $this->handler->read($sessionId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function updateTimestamp($sessionId, $data)
|
||||
public function updateTimestamp(string $sessionId, string $data): bool
|
||||
{
|
||||
return $this->write($sessionId, $data);
|
||||
}
|
||||
@@ -61,16 +63,12 @@ class StrictSessionHandler extends AbstractSessionHandler
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doWrite(string $sessionId, string $data)
|
||||
protected function doWrite(string $sessionId, string $data): bool
|
||||
{
|
||||
return $this->handler->write($sessionId, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function destroy($sessionId)
|
||||
public function destroy(string $sessionId): bool
|
||||
{
|
||||
$this->doDestroy = true;
|
||||
$destroyed = parent::destroy($sessionId);
|
||||
@@ -81,27 +79,19 @@ class StrictSessionHandler extends AbstractSessionHandler
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function doDestroy(string $sessionId)
|
||||
protected function doDestroy(string $sessionId): bool
|
||||
{
|
||||
$this->doDestroy = false;
|
||||
|
||||
return $this->handler->destroy($sessionId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function close()
|
||||
public function close(): bool
|
||||
{
|
||||
return $this->handler->close();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int|false
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function gc($maxlifetime)
|
||||
public function gc(int $maxlifetime): int|false
|
||||
{
|
||||
return $this->handler->gc($maxlifetime);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user