Skip to content

Commit e371c09

Browse files
authored
Merge pull request #8617 from kenjis/refactor-Request
refactor: remove deprecated items in Request
2 parents c38d7de + 6683b65 commit e371c09

File tree

4 files changed

+14
-47
lines changed

4 files changed

+14
-47
lines changed

system/HTTP/IncomingRequest.php

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,6 @@
4949
*/
5050
class IncomingRequest extends Request
5151
{
52-
/**
53-
* Enable CSRF flag
54-
*
55-
* Enables a CSRF cookie token to be set.
56-
* Set automatically based on Config setting.
57-
*
58-
* @var bool
59-
*
60-
* @deprecated Not used
61-
*/
62-
protected $enableCSRF = false;
63-
6452
/**
6553
* The URI for this request.
6654
*
@@ -121,13 +109,6 @@ class IncomingRequest extends Request
121109
*/
122110
protected $validLocales = [];
123111

124-
/**
125-
* Configuration settings.
126-
*
127-
* @var App
128-
*/
129-
protected $config;
130-
131112
/**
132113
* Holds the old data from a redirect.
133114
*
@@ -172,7 +153,6 @@ public function __construct($config, ?URI $uri = null, $body = 'php://input', ?U
172153
$body = null;
173154
}
174155

175-
$this->config = $config;
176156
$this->uri = $uri;
177157
$this->body = $body;
178158
$this->userAgent = $userAgent;
@@ -929,18 +909,4 @@ public function getFile(string $fileID)
929909

930910
return $this->files->getFile($fileID);
931911
}
932-
933-
/**
934-
* Remove relative directory (../) and multi slashes (///)
935-
*
936-
* Do some final cleaning of the URI and return it, currently only used in static::_parse_request_uri()
937-
*
938-
* @deprecated 4.1.2 Use URI::removeDotSegments() directly
939-
*/
940-
protected function removeRelativeDirectory(string $uri): string
941-
{
942-
$uri = URI::removeDotSegments($uri);
943-
944-
return $uri === '/' ? $uri : ltrim($uri, '/');
945-
}
946912
}

system/HTTP/Request.php

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,15 @@ class Request extends OutgoingRequest implements RequestInterface
2424
{
2525
use RequestTrait;
2626

27-
/**
28-
* Proxy IPs
29-
*
30-
* @var array<string, string>
31-
*
32-
* @deprecated 4.0.5 No longer used. Check the App config directly
33-
*/
34-
protected $proxyIPs;
35-
3627
/**
3728
* Constructor.
3829
*
3930
* @param App $config
40-
*
41-
* @deprecated 4.0.5 The $config is no longer needed and will be removed in a future version
4231
*/
43-
public function __construct($config = null) // @phpstan-ignore-line
32+
public function __construct($config = null)
4433
{
34+
$this->config = $config ?? config(App::class);
35+
4536
if (empty($this->method)) {
4637
$this->method = $this->getServer('REQUEST_METHOD') ?? Method::GET;
4738
}

system/HTTP/RequestTrait.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@
2727
*/
2828
trait RequestTrait
2929
{
30+
/**
31+
* Configuration settings.
32+
*
33+
* @var App
34+
*/
35+
protected $config;
36+
3037
/**
3138
* IP address of the current user.
3239
*
@@ -61,7 +68,7 @@ public function getIPAddress(): string
6168
'valid_ip',
6269
];
6370

64-
$proxyIPs = config(App::class)->proxyIPs;
71+
$proxyIPs = $this->config->proxyIPs;
6572

6673
if (! empty($proxyIPs) && (! is_array($proxyIPs) || is_int(array_key_first($proxyIPs)))) {
6774
throw new ConfigException(

user_guide_src/source/changelogs/v4.5.0.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,9 @@ Request
329329
has been removed.
330330
- The visibility of the deprecated properties ``$uri`` and ``$config`` in
331331
``IncomingRequest`` has been changed to protected.
332+
- The ``$enableCSRF`` property in ``IncomingRequest`` has been removed.
333+
- The ``removeRelativeDirectory()`` method in ``IncomingRequest`` has been removed.
334+
- The ``$proxyIPs`` property in ``Request`` has been removed.
332335

333336
Filters
334337
-------

0 commit comments

Comments
 (0)