Skip to content

Commit

Permalink
Support PHP 8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
spaze committed Nov 30, 2021
1 parent 9de3076 commit b29e364
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 14 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ jobs:
strategy:
matrix:
php-version:
- 7.4
- 8.0
- 8.1

steps:
- uses: actions/checkout@v2
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,17 @@ Custom PHP session handler for [Nette Framework](http://nette.org/) that uses My
- [nette/database](https://github.com/nette/database) 3.1+
- [nette/di](https://github.com/nette/utils) 3.0+
- [nette/utils](https://github.com/nette/utils) 3.2+
- PHP 7.4+
- PHP 8.1+

<details>
<summary>Requirements for previous versions</summary>

*Requirements for 2.2*
- [nette/database](https://github.com/nette/database) 3.1+
- [nette/di](https://github.com/nette/utils) 3.0+
- [nette/utils](https://github.com/nette/utils) 3.2+
- PHP 7.4+

*Requirements for 2.1 (not supported anymore)*
- [nette/database](https://github.com/nette/database) 2.4+
- [nette/di](https://github.com/nette/utils) 2.4+
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
}
],
"require": {
"php": "^7.4 || ^8.0",
"php": "^8.1",
"nette/database": "^3.1",
"nette/di": "^3.0",
"nette/utils": "^3.2"
Expand All @@ -23,8 +23,8 @@
"nette/schema": "^1.2",
"php-parallel-lint/php-parallel-lint": "^1.3",
"php-parallel-lint/php-console-highlighter": "^0.5.0",
"phpstan/phpstan": "^0.12.99",
"phpstan/phpstan-nette": "^0.12.21",
"phpstan/phpstan": "^1.2",
"phpstan/phpstan-nette": "^1.0",
"spaze/coding-standard": "^0.0",
"spaze/encryption": "^0.4.0"
},
Expand Down
10 changes: 2 additions & 8 deletions src/MysqlSessionHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,7 @@ public function write($sessionId, $sessionData): bool
}


/**
* @param int $maxLifeTime
* @return bool
*/
public function gc($maxLifeTime): bool
public function gc(int $maxLifeTime): int|false
{
$maxTimestamp = \time() - $maxLifeTime;

Expand All @@ -235,11 +231,9 @@ public function gc($maxLifeTime): bool
$maxTimestamp -= ($row->serverId - 1) * \max(86400, $maxLifeTime / 10);
}

$this->explorer->table($this->tableName)
return $this->explorer->table($this->tableName)
->where('timestamp < ?', $maxTimestamp)
->delete();

return true;
}

}

0 comments on commit b29e364

Please sign in to comment.