diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index e48e141..f07d7ca 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -10,8 +10,7 @@ jobs: strategy: matrix: php-version: - - 7.4 - - 8.0 + - 8.1 steps: - uses: actions/checkout@v2 diff --git a/README.md b/README.md index 6a31205..c25d8da 100644 --- a/README.md +++ b/README.md @@ -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+
Requirements for previous versions +*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+ diff --git a/composer.json b/composer.json index 80cf9bc..5303776 100644 --- a/composer.json +++ b/composer.json @@ -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" @@ -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" }, diff --git a/src/MysqlSessionHandler.php b/src/MysqlSessionHandler.php index e4c7de9..ea10a0b 100644 --- a/src/MysqlSessionHandler.php +++ b/src/MysqlSessionHandler.php @@ -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; @@ -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; } }