mirror of
https://github.com/maxpozdeev/mytinytodo.git
synced 2026-03-11 08:55:27 +00:00
use ReturnTypeWillChange attributes to avoid PHP 8.1 deprecation notices in MTTSessionHandler (until PHP 9)
This commit is contained in:
parent
3b33781e16
commit
01c02ba4f6
1 changed files with 6 additions and 4 deletions
|
|
@ -13,14 +13,14 @@ class MTTSessionHandler implements SessionHandlerInterface
|
|||
* @return bool
|
||||
* @throws Exception
|
||||
*/
|
||||
public function open($path, $name)
|
||||
public function open($path, $name): bool
|
||||
{
|
||||
$this->db = DBConnection::instance();
|
||||
return true;
|
||||
}
|
||||
|
||||
/** @return bool */
|
||||
public function close()
|
||||
public function close(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
@ -30,6 +30,7 @@ class MTTSessionHandler implements SessionHandlerInterface
|
|||
* @return string
|
||||
* @throws Exception
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function read($id)
|
||||
{
|
||||
// read session data if not expired
|
||||
|
|
@ -54,7 +55,7 @@ class MTTSessionHandler implements SessionHandlerInterface
|
|||
* @return bool
|
||||
* @throws Exception
|
||||
*/
|
||||
public function write($id, $data)
|
||||
public function write($id, $data): bool
|
||||
{
|
||||
$exists = $this->db->sq("SELECT COUNT(*) FROM {$this->db->prefix}sessions WHERE id = ?", $id);
|
||||
if (!$exists) {
|
||||
|
|
@ -76,7 +77,7 @@ class MTTSessionHandler implements SessionHandlerInterface
|
|||
* @return bool
|
||||
* @throws Exception
|
||||
*/
|
||||
public function destroy($id)
|
||||
public function destroy($id): bool
|
||||
{
|
||||
$this->db->ex("DELETE FROM {$this->db->prefix}sessions WHERE id = ?", $id);
|
||||
return true;
|
||||
|
|
@ -86,6 +87,7 @@ class MTTSessionHandler implements SessionHandlerInterface
|
|||
* @param int $max_lifetime
|
||||
* @return int|false
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function gc($max_lifetime)
|
||||
{
|
||||
// We ignore php runtime 'session.gc_maxlifetime'
|
||||
|
|
|
|||
Loading…
Reference in a new issue