From 68f9e0d2174fb1c40a5068c89d8ec2c2d41864e0 Mon Sep 17 00:00:00 2001 From: brendt Date: Thu, 29 Oct 2026 13:35:13 +0100 Subject: [PATCH 1/2] fmt --- packages/auth/tests/SessionAuthenticatorTest.php | 1 + .../src/Builder/QueryBuilders/InsertQueryBuilder.php | 2 +- packages/http/src/Session/Managers/FileSessionManager.php | 5 ++++- tests/Integration/Http/FileSessionTest.php | 3 +++ tests/Integration/Http/ManageSessionMiddlewareTest.php | 2 +- 5 files changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/auth/tests/SessionAuthenticatorTest.php b/packages/auth/tests/SessionAuthenticatorTest.php index 172add2a7e..69b096f5a2 100644 --- a/packages/auth/tests/SessionAuthenticatorTest.php +++ b/packages/auth/tests/SessionAuthenticatorTest.php @@ -164,6 +164,7 @@ public function deauthenticate_regenerates_the_session_identifier_and_discards_t $session->set(SessionAuthenticator::AUTHENTICATABLE_KEY, 1); $session->set(SessionAuthenticator::AUTHENTICATABLE_CLASS, MemoizedAuthenticatable::class); $session->set('key', 'value'); + $sessionManager = new TestingSessionManager(); $authenticator = new SessionAuthenticator( diff --git a/packages/database/src/Builder/QueryBuilders/InsertQueryBuilder.php b/packages/database/src/Builder/QueryBuilders/InsertQueryBuilder.php index 1343a89c66..42223df978 100644 --- a/packages/database/src/Builder/QueryBuilders/InsertQueryBuilder.php +++ b/packages/database/src/Builder/QueryBuilders/InsertQueryBuilder.php @@ -413,7 +413,7 @@ private function resolveIterableData(iterable $model): array $primaryKey = $this->model->getPrimaryKey(); if ($primaryKey !== null && $this->model->hasUuidPrimaryKey() && ! isset($entry[$primaryKey])) { - $entry = [$primaryKey => Random\uuid(), ...$entry]; + return [$primaryKey => Random\uuid(), ...$entry]; } return $entry; diff --git a/packages/http/src/Session/Managers/FileSessionManager.php b/packages/http/src/Session/Managers/FileSessionManager.php index ee220a8544..cbe570027a 100644 --- a/packages/http/src/Session/Managers/FileSessionManager.php +++ b/packages/http/src/Session/Managers/FileSessionManager.php @@ -104,8 +104,11 @@ public function deleteExpiredSessions(): void foreach ($sessionFiles as $sessionFile) { $lastActiveAt = @filemtime($sessionFile); + if ($lastActiveAt === false) { + continue; + } - if ($lastActiveAt === false || $lastActiveAt > $expiredBefore) { + if ($lastActiveAt > $expiredBefore) { continue; } diff --git a/tests/Integration/Http/FileSessionTest.php b/tests/Integration/Http/FileSessionTest.php index e40ffac5db..29bfdf8129 100644 --- a/tests/Integration/Http/FileSessionTest.php +++ b/tests/Integration/Http/FileSessionTest.php @@ -283,6 +283,7 @@ public function unchanged_session_is_not_rewritten(): void $session = $this->manager->getOrCreate($id); $session->set('user', 'brent'); + $this->manager->save($session); $unchanged = $this->manager->getOrCreate($id); @@ -290,6 +291,7 @@ public function unchanged_session_is_not_rewritten(): void // Another request writes to the same session in the meantime $concurrent = $this->manager->getOrCreate($id); $concurrent->set('cart', 'book'); + $this->manager->save($concurrent); $clock->plus(Duration::minutes(5)); @@ -309,6 +311,7 @@ public function last_active_at_is_read_from_modification_time(): void $session = $this->manager->getOrCreate($id); $session->set('user', 'brent'); + $this->manager->save($session); $clock->plus(Duration::minutes(5)); diff --git a/tests/Integration/Http/ManageSessionMiddlewareTest.php b/tests/Integration/Http/ManageSessionMiddlewareTest.php index 03c8957f53..af4c9197a4 100644 --- a/tests/Integration/Http/ManageSessionMiddlewareTest.php +++ b/tests/Integration/Http/ManageSessionMiddlewareTest.php @@ -171,7 +171,7 @@ private function handle(Session $session, ?Closure $controller = null, array $he $middleware( request: new GenericRequest(method: Method::GET, uri: '/', headers: $headers), next: new HttpMiddlewareCallable(function () use ($session, $controller) { - if ($controller !== null) { + if ($controller instanceof Closure) { $controller($session); } From fd4e6b9c7a769bc02d1f6e3a1657a87118ea0ba6 Mon Sep 17 00:00:00 2001 From: brendt Date: Thu, 29 Oct 2026 13:35:57 +0100 Subject: [PATCH 2/2] fix rector --- rector.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/rector.php b/rector.php index 6d49c1f9bf..3cf9dcd152 100644 --- a/rector.php +++ b/rector.php @@ -9,7 +9,6 @@ use Rector\Config\RectorConfig; use Rector\EarlyReturn\Rector\Return_\ReturnBinaryOrToEarlyReturnRector; use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector; -use Rector\Php70\Rector\StaticCall\StaticCallOnNonStaticToInstanceCallRector; use Rector\Php74\Rector\Property\RestoreDefaultNullToNullableTypePropertyRector; use Rector\Php81\Rector\Array_\ArrayToFirstClassCallableRector; use Rector\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector; @@ -47,7 +46,6 @@ ReadOnlyPropertyRector::class, AddSensitiveParameterAttributeRector::class, RestoreDefaultNullToNullableTypePropertyRector::class, - StaticCallOnNonStaticToInstanceCallRector::class, EncapsedStringsToSprintfRector::class, PrivatizeFinalClassMethodRector::class, IssetOnPropertyObjectToPropertyExistsRector::class,