Skip to content
This repository was archived by the owner on Jul 31, 2025. It is now read-only.

Commit bdf2272

Browse files
committed
Remove obsolete Laravel 10 test workflow, update PHPUnit schema, and refactor MongoDbSessionHandler
- Delete the GitHub Actions workflow for running Laravel 10 tests as it is no longer needed. - Update the PHPUnit XML schema location to version 12.0 for compatibility. - Refactor `MongoDbSessionHandler` class constructor and method signatures to use type hints for improved type safety and clarity.
1 parent ae48d90 commit bdf2272

File tree

4 files changed

+11
-81
lines changed

4 files changed

+11
-81
lines changed

.github/workflows/run-tests-l10.yml

Lines changed: 0 additions & 67 deletions
This file was deleted.

.github/workflows/run-tests-l12.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
laravel: [ 12.* ]
3131
include:
3232
- laravel: 12.*
33-
testbench: 12.*
33+
testbench: 10.*
3434

3535
name: P${{ matrix.php }} - L${{ matrix.laravel }}
3636

phpunit.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
colors="true"
77
processIsolation="false"
88
stopOnFailure="false"
9-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd"
9+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/12.0/phpunit.xsd"
1010
cacheDirectory=".phpunit.cache"
1111
backupStaticProperties="false"
1212
>
@@ -24,4 +24,4 @@
2424
<env name="MONGODB_PORT" value="27017"/>
2525
<env name="MONGODB_DATABASE" value="laravel_session_test"/>
2626
</php>
27-
</phpunit>
27+
</phpunit>

src/MongoDbSessionHandler.php

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,20 @@
22

33
namespace ForFit\Session;
44

5+
use Illuminate\Database\ConnectionInterface;
6+
use Illuminate\Database\Query\Builder;
57
use MongoDB\BSON\Binary;
68
use MongoDB\BSON\UTCDateTime;
79
use MongoDB\Driver\Exception\BulkWriteException;
810
use SessionHandlerInterface;
911

1012
class MongoDbSessionHandler implements SessionHandlerInterface
1113
{
12-
protected $connection;
13-
protected $minutes;
14-
protected $table;
14+
protected ConnectionInterface $connection;
15+
protected int $minutes;
16+
protected string $table;
1517

16-
/**
17-
* @param \Illuminate\Database\ConnectionInterface $connection
18-
* @param string $table
19-
* @param integer $minutes
20-
*/
21-
public function __construct($connection, $table = 'sessions', $minutes = 60)
18+
public function __construct(ConnectionInterface $connection, string $table = 'sessions', int $minutes = 60)
2219
{
2320
$this->connection = $connection;
2421
$this->minutes = (int)$minutes;
@@ -89,7 +86,7 @@ public function gc($max_lifetime): false|int
8986
* Returns the query builder
9087
*
9188
*/
92-
protected function query()
89+
protected function query(): Builder
9390
{
9491
return $this->connection->table($this->table);
9592
}
@@ -100,7 +97,7 @@ protected function query()
10097
* @param string|null $data
10198
* @return array
10299
*/
103-
protected function buildPayload($data)
100+
protected function buildPayload($data): array
104101
{
105102
return [
106103
'payload' => new Binary($data, Binary::TYPE_OLD_BINARY),

0 commit comments

Comments
 (0)