From 62e20d83e8386a5ad48e42f98ee93433ffd10fc9 Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 7 Jul 2023 09:26:03 +0900 Subject: [PATCH 1/3] fix: Services::session() $config type --- system/Config/Services.php | 9 +++------ tests/system/Config/ServicesTest.php | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/system/Config/Services.php b/system/Config/Services.php index c8ded8034257..a2f6a5cb03a9 100644 --- a/system/Config/Services.php +++ b/system/Config/Services.php @@ -661,19 +661,16 @@ public static function security(?SecurityConfig $config = null, bool $getShared * Return the session manager. * * @return Session - * - * @TODO replace the first parameter type `?App` with `?SessionConfig` */ - public static function session(?App $config = null, bool $getShared = true) + public static function session(?SessionConfig $config = null, bool $getShared = true) { if ($getShared) { return static::getSharedInstance('session', $config); } - $logger = AppServices::logger(); + $config ??= config(SessionConfig::class); - $config = config(SessionConfig::class); - assert($config instanceof SessionConfig, 'Missing "Config/Session.php".'); + $logger = AppServices::logger(); $driverName = $config->driver; diff --git a/tests/system/Config/ServicesTest.php b/tests/system/Config/ServicesTest.php index b6ea85e6971f..283233d8b4ed 100644 --- a/tests/system/Config/ServicesTest.php +++ b/tests/system/Config/ServicesTest.php @@ -243,7 +243,7 @@ public function testNewViewcell() */ public function testNewSession() { - $actual = Services::session($this->config); + $actual = Services::session(); $this->assertInstanceOf(Session::class, $actual); } From 3eab5e043e7ac43ec5de9fb2b85f8fb797d36657 Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 7 Jul 2023 09:28:12 +0900 Subject: [PATCH 2/3] docs: add changelog --- user_guide_src/source/changelogs/v4.4.0.rst | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/user_guide_src/source/changelogs/v4.4.0.rst b/user_guide_src/source/changelogs/v4.4.0.rst index 20db5a2d7b38..e6d6d6a68a63 100644 --- a/user_guide_src/source/changelogs/v4.4.0.rst +++ b/user_guide_src/source/changelogs/v4.4.0.rst @@ -50,8 +50,11 @@ Method Signature Changes Parameter Type Changes ---------------------- -- **Services:** The first parameter of ``Services::security()`` has been - changed from ``Config\App`` to ``Config\Security``. +- **Services:** + - The first parameter of ``Services::security()`` has been changed from + ``Config\App`` to ``Config\Security``. + - The first parameter of ``Services::session()`` has been changed from + ``Config\App`` to ``Config\Session``. - **Session:** - The second parameter of ``Session::__construct()`` has been changed from ``Config\App`` to ``Config\Session``. From e0f4094660561459ada5359ebd78934900f0d569 Mon Sep 17 00:00:00 2001 From: kenjis Date: Fri, 7 Jul 2023 09:39:27 +0900 Subject: [PATCH 3/3] test: remove unused property --- tests/system/Config/ServicesTest.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/system/Config/ServicesTest.php b/tests/system/Config/ServicesTest.php index 283233d8b4ed..349b6b0cc575 100644 --- a/tests/system/Config/ServicesTest.php +++ b/tests/system/Config/ServicesTest.php @@ -54,7 +54,6 @@ */ final class ServicesTest extends CIUnitTestCase { - private App $config; private array $original; protected function setUp(): void @@ -62,7 +61,6 @@ protected function setUp(): void parent::setUp(); $this->original = $_SERVER; - $this->config = new App(); } protected function tearDown(): void