Skip to content

Commit 00ef50f

Browse files
committed
fix: remove unused parameters in Services::exceptions() and Exception
1 parent fdd935d commit 00ef50f

5 files changed

Lines changed: 9 additions & 22 deletions

File tree

system/Config/BaseService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
* @method static CURLRequest curlrequest($options = [], ResponseInterface $response = null, App $config = null, $getShared = true)
102102
* @method static Email email($config = null, $getShared = true)
103103
* @method static EncrypterInterface encrypter(Encryption $config = null, $getShared = false)
104-
* @method static Exceptions exceptions(ConfigExceptions $config = null, IncomingRequest $request = null, ResponseInterface $response = null, $getShared = true)
104+
* @method static Exceptions exceptions(ConfigExceptions $config = null, $getShared = true)
105105
* @method static Filters filters(ConfigFilters $config = null, $getShared = true)
106106
* @method static Format format(ConfigFormat $config = null, $getShared = true)
107107
* @method static Honeypot honeypot(ConfigHoneyPot $config = null, $getShared = true)

system/Config/Services.php

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -257,25 +257,18 @@ public static function encrypter(?EncryptionConfig $config = null, $getShared =
257257
* - register_shutdown_function
258258
*
259259
* @return Exceptions
260-
*
261-
* @deprecated The parameter $request and $response are deprecated.
262260
*/
263261
public static function exceptions(
264262
?ExceptionsConfig $config = null,
265-
?IncomingRequest $request = null,
266-
?ResponseInterface $response = null,
267263
bool $getShared = true
268264
) {
269265
if ($getShared) {
270-
return static::getSharedInstance('exceptions', $config, $request, $response);
266+
return static::getSharedInstance('exceptions', $config);
271267
}
272268

273269
$config ??= config(ExceptionsConfig::class);
274270

275-
// @TODO remove instantiation of Response in the future.
276-
$response ??= AppServices::response();
277-
278-
return new Exceptions($config, $request, $response);
271+
return new Exceptions($config);
279272
}
280273

281274
/**

system/Debug/Exceptions.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,7 @@ class Exceptions
7474

7575
private ?Throwable $exceptionCaughtByExceptionHandler = null;
7676

77-
/**
78-
* @param RequestInterface|null $request
79-
*
80-
* @deprecated The parameter $request and $response are deprecated. No longer used.
81-
*/
82-
public function __construct(ExceptionsConfig $config, $request, ResponseInterface $response) /** @phpstan-ignore-line */
77+
public function __construct(ExceptionsConfig $config)
8378
{
8479
// For backward compatibility
8580
$this->ob_level = ob_get_level();

tests/system/Config/ServicesTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,13 @@ public function testNewUnsharedEmailWithNonEmptyConfig(): void
127127

128128
public function testNewExceptions(): void
129129
{
130-
$actual = Services::exceptions(new Exceptions(), Services::request(), Services::response());
130+
$actual = Services::exceptions(new Exceptions());
131131
$this->assertInstanceOf(\CodeIgniter\Debug\Exceptions::class, $actual);
132132
}
133133

134134
public function testNewExceptionsWithNullConfig(): void
135135
{
136-
$actual = Services::exceptions(null, null, null, false);
136+
$actual = Services::exceptions(null, false);
137137
$this->assertInstanceOf(\CodeIgniter\Debug\Exceptions::class, $actual);
138138
}
139139

tests/system/Debug/ExceptionsTest.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
use CodeIgniter\Test\CIUnitTestCase;
2020
use CodeIgniter\Test\ReflectionHelper;
2121
use Config\Exceptions as ExceptionsConfig;
22-
use Config\Services;
2322
use ErrorException;
2423
use RuntimeException;
2524

@@ -52,7 +51,7 @@ protected function setUp(): void
5251
{
5352
parent::setUp();
5453

55-
$this->exception = new Exceptions(new ExceptionsConfig(), Services::request(), Services::response());
54+
$this->exception = new Exceptions(new ExceptionsConfig());
5655
}
5756

5857
/**
@@ -65,7 +64,7 @@ public function testDeprecationsOnPhp81DoNotThrow(): void
6564
$config->logDeprecations = true;
6665
$config->deprecationLogLevel = 'error';
6766

68-
$this->exception = new Exceptions($config, Services::request(), Services::response());
67+
$this->exception = new Exceptions($config);
6968
$this->exception->initialize();
7069

7170
// this is only needed for IDEs not to complain that strlen does not accept explicit null
@@ -89,7 +88,7 @@ public function testSuppressedDeprecationsAreLogged(): void
8988
$config->logDeprecations = true;
9089
$config->deprecationLogLevel = 'error';
9190

92-
$this->exception = new Exceptions($config, Services::request(), Services::response());
91+
$this->exception = new Exceptions($config);
9392
$this->exception->initialize();
9493

9594
@trigger_error('Hello! I am a deprecation!', E_USER_DEPRECATED);

0 commit comments

Comments
 (0)