diff --git a/.github/workflows/run-tests-l10.yml b/.github/workflows/run-tests-l11.yml similarity index 88% rename from .github/workflows/run-tests-l10.yml rename to .github/workflows/run-tests-l11.yml index dacb918..9abc30c 100644 --- a/.github/workflows/run-tests-l10.yml +++ b/.github/workflows/run-tests-l11.yml @@ -1,11 +1,11 @@ -name: "Run Tests - Laravel 10" +name: "Run Tests - Laravel 11" on: push: - branches: [ v5.x, master ] + branches: [ v6.x, master ] pull_request: - branches: [ v5.x, master ] + branches: [ v6.x, master ] jobs: tests: @@ -26,11 +26,11 @@ jobs: strategy: fail-fast: false matrix: - php: [ 8.1 ] - laravel: [ 10.* ] + php: [ 8.2 ] + laravel: [ 11.* ] include: - - laravel: 10.* - testbench: 10.* + - laravel: 11.* + testbench: 11.* name: P${{ matrix.php }} - L${{ matrix.laravel }} diff --git a/.phprc b/.phprc index 6e3833a..a5a984f 100644 --- a/.phprc +++ b/.phprc @@ -1 +1 @@ -php8.1 +php8.2 diff --git a/README.md b/README.md index 3fb89ec..32a0f6f 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ A MongoDB session driver for Laravel | **Laravel
Version** | **Package
Version** | **Install using
this command** | |-------------------------|-------------------------|---------------------------------------------------| +| 11.x | 6.x.x | composer require 1ff/laravel-mongodb-session:^6.0 | | 10.x | 5.x.x | composer require 1ff/laravel-mongodb-session:^5.0 | | 9.x | 4.x.x | composer require 1ff/laravel-mongodb-session:^4.0 | | 8.x | 3.x.x | composer require 1ff/laravel-mongodb-session:^3.0 | diff --git a/composer.json b/composer.json index 6ef049a..2f1f80f 100644 --- a/composer.json +++ b/composer.json @@ -3,14 +3,14 @@ "description": "A mongodb session driver for laravel", "type": "library", "require": { - "php": "^8.1", - "illuminate/session": "^10.0", + "php": "^8.2", + "illuminate/session": "^11.0", "mongodb/laravel-mongodb": "^5.0", "ext-mongodb": "*" }, "require-dev": { - "phpunit/phpunit": "^10.0", - "orchestra/testbench": "^8.0" + "phpunit/phpunit": "^11.0", + "orchestra/testbench": "^9.0" }, "license": "MIT", "authors": [ @@ -42,6 +42,6 @@ } }, "scripts": { - "test": "vendor/bin/phpunit" + "test": "$(head -1 .phprc) ./vendor/bin/phpunit" } } diff --git a/phpunit.xml b/phpunit.xml index 41f3b6a..2f53548 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -6,7 +6,7 @@ colors="true" processIsolation="false" stopOnFailure="false" - xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd" + xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.0/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false" > @@ -24,4 +24,4 @@ - \ No newline at end of file + diff --git a/src/MongoDbSessionHandler.php b/src/MongoDbSessionHandler.php index 507fc46..00465c3 100644 --- a/src/MongoDbSessionHandler.php +++ b/src/MongoDbSessionHandler.php @@ -2,6 +2,8 @@ namespace ForFit\Session; +use Illuminate\Database\ConnectionInterface; +use Illuminate\Database\Query\Builder; use MongoDB\BSON\Binary; use MongoDB\BSON\UTCDateTime; use MongoDB\Driver\Exception\BulkWriteException; @@ -9,16 +11,11 @@ class MongoDbSessionHandler implements SessionHandlerInterface { - protected $connection; - protected $minutes; - protected $table; + protected ConnectionInterface $connection; + protected int $minutes; + protected string $table; - /** - * @param \Illuminate\Database\ConnectionInterface $connection - * @param string $table - * @param integer $minutes - */ - public function __construct($connection, $table = 'sessions', $minutes = 60) + public function __construct(ConnectionInterface $connection, string $table = 'sessions', int $minutes = 60) { $this->connection = $connection; $this->minutes = (int)$minutes; @@ -89,7 +86,7 @@ public function gc($max_lifetime): false|int * Returns the query builder * */ - protected function query() + protected function query(): Builder { return $this->connection->table($this->table); } @@ -100,7 +97,7 @@ protected function query() * @param string|null $data * @return array */ - protected function buildPayload($data) + protected function buildPayload($data): array { return [ 'payload' => new Binary($data, Binary::TYPE_OLD_BINARY), diff --git a/src/SessionServiceProvider.php b/src/SessionServiceProvider.php index f9d75fe..9242b7d 100644 --- a/src/SessionServiceProvider.php +++ b/src/SessionServiceProvider.php @@ -13,10 +13,9 @@ class SessionServiceProvider extends ParentServiceProvider * Register any application services. * * @throws \Exception - * @return void * */ - public function boot() + public function boot(): void { if (config('session.driver') !== 'mongodb') { return;