Skip to content

Commit 7d79edf

Browse files
authored
Merge pull request #6053 from kenjis/remove-CodeIgniter-Services
refactor: remove `CodeIgniter\Services`
2 parents cae264a + e1b03d7 commit 7d79edf

File tree

9 files changed

+8
-98
lines changed

9 files changed

+8
-98
lines changed

phpstan-baseline.neon.dist

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -455,11 +455,6 @@ parameters:
455455
count: 1
456456
path: system/Debug/Exceptions.php
457457

458-
-
459-
message: "#^Property CodeIgniter\\\\Debug\\\\Exceptions\\:\\:\\$formatter \\(CodeIgniter\\\\Format\\\\FormatterInterface\\) in isset\\(\\) is not nullable\\.$#"
460-
count: 1
461-
path: system/Debug/Exceptions.php
462-
463458
-
464459
message: "#^Property Config\\\\Exceptions\\:\\:\\$sensitiveDataInTrace \\(array\\) in isset\\(\\) is not nullable\\.$#"
465460
count: 1
@@ -660,11 +655,6 @@ parameters:
660655
count: 1
661656
path: system/Log/Logger.php
662657

663-
-
664-
message: "#^Property CodeIgniter\\\\RESTful\\\\ResourceController\\:\\:\\$formatter \\(CodeIgniter\\\\Format\\\\FormatterInterface\\) in isset\\(\\) is not nullable\\.$#"
665-
count: 1
666-
path: system/RESTful/ResourceController.php
667-
668658
-
669659
message: "#^Call to an undefined method CodeIgniter\\\\Router\\\\RouteCollectionInterface\\:\\:getDefaultNamespace\\(\\)\\.$#"
670660
count: 3
@@ -835,11 +825,6 @@ parameters:
835825
count: 1
836826
path: system/Test/Mock/MockConnection.php
837827

838-
-
839-
message: "#^Property CodeIgniter\\\\Test\\\\Mock\\\\MockResourcePresenter\\:\\:\\$formatter \\(CodeIgniter\\\\Format\\\\FormatterInterface\\) in isset\\(\\) is not nullable\\.$#"
840-
count: 1
841-
path: system/Test/Mock/MockResourcePresenter.php
842-
843828
-
844829
message: "#^Property CodeIgniter\\\\Throttle\\\\Throttler\\:\\:\\$testTime \\(int\\) on left side of \\?\\? is not nullable\\.$#"
845830
count: 1

system/API/ResponseTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ trait ResponseTrait
7575
/**
7676
* Current Formatter instance. This is usually set by ResponseTrait::format
7777
*
78-
* @var FormatterInterface
78+
* @var FormatterInterface|null
7979
*/
8080
protected $formatter;
8181

system/Test/bootstrap.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,6 @@
7676
require_once SYSTEMPATH . 'Config/Services.php';
7777
require_once APPPATH . 'Config/Services.php';
7878

79-
// Use Config\Services as CodeIgniter\Services
80-
if (! class_exists('CodeIgniter\Services', false)) {
81-
class_alias(Services::class, 'CodeIgniter\Services');
82-
}
83-
8479
// Initialize and register the loader with the SPL autoloader stack.
8580
Services::autoloader()->initialize(new Autoload(), new Modules())->register();
8681

system/bootstrap.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,6 @@
101101
require_once SYSTEMPATH . 'Config/Services.php';
102102
require_once APPPATH . 'Config/Services.php';
103103

104-
// Use Config\Services as CodeIgniter\Services
105-
if (! class_exists('CodeIgniter\Services', false)) {
106-
class_alias(Services::class, 'CodeIgniter\Services');
107-
}
108-
109104
// Initialize and register the loader with the SPL autoloader stack.
110105
Services::autoloader()->initialize(new Autoload(), new Modules())->register();
111106

tests/_support/Services.php

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

tests/system/CommonFunctionsTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace CodeIgniter;
1313

1414
use CodeIgniter\Config\BaseService;
15-
use CodeIgniter\Config\Services;
1615
use CodeIgniter\HTTP\RedirectResponse;
1716
use CodeIgniter\HTTP\Response;
1817
use CodeIgniter\HTTP\URI;
@@ -29,6 +28,7 @@
2928
use Config\App;
3029
use Config\Logger;
3130
use Config\Modules;
31+
use Config\Services;
3232
use Kint;
3333
use stdClass;
3434
use Tests\Support\Models\JobModel;
@@ -118,8 +118,8 @@ public function testRedirectReturnsRedirectResponse()
118118
Services::locator(),
119119
new Modules()
120120
);
121-
\CodeIgniter\Services::injectMock('response', $response);
122-
\CodeIgniter\Services::injectMock('routes', $routes);
121+
Services::injectMock('response', $response);
122+
Services::injectMock('routes', $routes);
123123

124124
$routes->add('home/base', 'Controller::index', ['as' => 'base']);
125125
$response->method('redirect')->willReturnArgument(0);

tests/system/ControllerTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
use CodeIgniter\Test\CIUnitTestCase;
2020
use CodeIgniter\Validation\Exceptions\ValidationException;
2121
use Config\App;
22+
use Config\Services;
2223
use Psr\Log\LoggerInterface;
2324

2425
/**
@@ -56,7 +57,7 @@ protected function setUp(): void
5657
$this->config = new App();
5758
$this->request = new IncomingRequest($this->config, new URI('https://somwhere.com'), null, new UserAgent());
5859
$this->response = new Response($this->config);
59-
$this->logger = \Config\Services::logger();
60+
$this->logger = Services::logger();
6061
}
6162

6263
public function testConstructor()

tests/system/Helpers/FormHelperTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
namespace CodeIgniter\Helpers;
1313

1414
use CodeIgniter\HTTP\URI;
15-
use CodeIgniter\Services;
1615
use CodeIgniter\Test\CIUnitTestCase;
1716
use Config\App;
1817
use Config\Filters;
18+
use Config\Services;
1919

2020
/**
2121
* @internal

tests/system/Log/Handlers/ChromeLoggerHandlerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111

1212
namespace CodeIgniter\Log\Handlers;
1313

14-
use CodeIgniter\Services;
1514
use CodeIgniter\Test\CIUnitTestCase;
1615
use CodeIgniter\Test\Mock\MockLogger as LoggerConfig;
1716
use CodeIgniter\Test\Mock\MockResponse;
1817
use Config\App;
18+
use Config\Services;
1919
use stdClass;
2020

2121
/**

0 commit comments

Comments
 (0)