Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions system/Config/Services.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 1 addition & 3 deletions tests/system/Config/ServicesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,13 @@
*/
final class ServicesTest extends CIUnitTestCase
{
private App $config;
private array $original;

protected function setUp(): void
{
parent::setUp();

$this->original = $_SERVER;
$this->config = new App();
}

protected function tearDown(): void
Expand Down Expand Up @@ -243,7 +241,7 @@ public function testNewViewcell()
*/
public function testNewSession()
{
$actual = Services::session($this->config);
$actual = Services::session();
$this->assertInstanceOf(Session::class, $actual);
}

Expand Down
7 changes: 5 additions & 2 deletions user_guide_src/source/changelogs/v4.4.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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``.
Expand Down