Skip to content

Commit 8b44a23

Browse files
committed
Fix Modules does not extend BaseConfig
1 parent 8f4a2c4 commit 8b44a23

File tree

4 files changed

+3
-19
lines changed

4 files changed

+3
-19
lines changed

phpstan-baseline.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -871,16 +871,6 @@
871871
'count' => 4,
872872
'path' => __DIR__ . '/system/Config/BaseConfig.php',
873873
];
874-
$ignoreErrors[] = [
875-
'message' => '#^Argument \\#1 \\$name \\(\'Config\\\\\\\\Modules\'\\) passed to function config does not extend CodeIgniter\\\\\\\\Config\\\\\\\\BaseConfig\\.$#',
876-
'count' => 1,
877-
'path' => __DIR__ . '/system/Config/BaseConfig.php',
878-
];
879-
$ignoreErrors[] = [
880-
'message' => '#^Argument \\#1 \\$name \\(\'Config\\\\\\\\Modules\'\\) passed to function config does not extend CodeIgniter\\\\\\\\Config\\\\\\\\BaseConfig\\.$#',
881-
'count' => 2,
882-
'path' => __DIR__ . '/system/Config/BaseService.php',
883-
];
884874
$ignoreErrors[] = [
885875
'message' => '#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#',
886876
'count' => 3,

system/Config/BaseConfig.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public static function __set_state(array $array)
8282
*/
8383
public function __construct()
8484
{
85-
static::$moduleConfig = config(Modules::class);
85+
static::$moduleConfig = new Modules();
8686

8787
if (! static::$override) {
8888
return;

system/Config/BaseService.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -330,9 +330,7 @@ public static function injectMock(string $name, $mock)
330330
protected static function discoverServices(string $name, array $arguments)
331331
{
332332
if (! static::$discovered) {
333-
$config = config(Modules::class);
334-
335-
if ($config->shouldDiscover('services')) {
333+
if ((new Modules())->shouldDiscover('services')) {
336334
$locator = static::locator();
337335
$files = $locator->search('Config/Services');
338336

@@ -372,9 +370,7 @@ protected static function discoverServices(string $name, array $arguments)
372370
protected static function buildServicesCache(): void
373371
{
374372
if (! static::$discovered) {
375-
$config = config(Modules::class);
376-
377-
if ($config->shouldDiscover('services')) {
373+
if ((new Modules())->shouldDiscover('services')) {
378374
$locator = static::locator();
379375
$files = $locator->search('Config/Services');
380376

tests/system/Cache/FactoriesCacheFileVarExportHandlerTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
use CodeIgniter\Config\Factories;
1616
use CodeIgniter\Test\CIUnitTestCase;
1717
use Config\App;
18-
use Config\Modules;
1918

2019
/**
2120
* @internal
@@ -58,7 +57,6 @@ public function testSave()
5857

5958
$this->assertArrayHasKey('aliases', $cachedData);
6059
$this->assertArrayHasKey('instances', $cachedData);
61-
$this->assertArrayHasKey(Modules::class, $cachedData['aliases']);
6260
$this->assertArrayHasKey('App', $cachedData['aliases']);
6361
}
6462

0 commit comments

Comments
 (0)