Skip to content

Commit a5bd769

Browse files
authored
Merge pull request #8142 from kenjis/remove-Response-properties
refactor: remove deprecated properties in Response
2 parents e875b05 + 71e4831 commit a5bd769

File tree

4 files changed

+23
-78
lines changed

4 files changed

+23
-78
lines changed

rector.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@
9494
__DIR__ . '/system/Router/AutoRouterImproved.php',
9595
// @TODO remove if deprecated $config is removed
9696
__DIR__ . '/system/HTTP/Request.php',
97+
__DIR__ . '/system/HTTP/Response.php',
9798
],
9899

99100
// check on constant compare

system/HTTP/Response.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,10 @@ class Response extends Message implements ResponseInterface
146146
* @param App $config
147147
*
148148
* @todo Recommend removing reliance on config injection
149+
*
150+
* @deprecated 4.5.0 The param $config is no longer used.
149151
*/
150-
public function __construct($config)
152+
public function __construct($config) // @phpstan-ignore-line
151153
{
152154
// Default to a non-caching page.
153155
// Also ensures that a Cache-control header exists.
@@ -156,8 +158,6 @@ public function __construct($config)
156158
// We need CSP object even if not enabled to avoid calls to non existing methods
157159
$this->CSP = Services::csp();
158160

159-
$this->CSPEnabled = $config->CSPEnabled;
160-
161161
$this->cookieStore = new CookieStore([]);
162162

163163
$cookie = config(CookieConfig::class);

system/HTTP/ResponseTrait.php

Lines changed: 1 addition & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -34,23 +34,12 @@
3434
*/
3535
trait ResponseTrait
3636
{
37-
/**
38-
* Whether Content Security Policy is being enforced.
39-
*
40-
* @var bool
41-
*
42-
* @deprecated Use $this->CSP->enabled() instead.
43-
*/
44-
protected $CSPEnabled = false;
45-
4637
/**
4738
* Content security policy handler
4839
*
4940
* @var ContentSecurityPolicy
50-
*
51-
* @deprecated Will be protected. Use `getCSP()` instead.
5241
*/
53-
public $CSP;
42+
protected $CSP;
5443

5544
/**
5645
* CookieStore instance.
@@ -59,69 +48,6 @@ trait ResponseTrait
5948
*/
6049
protected $cookieStore;
6150

62-
/**
63-
* Set a cookie name prefix if you need to avoid collisions
64-
*
65-
* @var string
66-
*
67-
* @deprecated Use the dedicated Cookie class instead.
68-
*/
69-
protected $cookiePrefix = '';
70-
71-
/**
72-
* Set to .your-domain.com for site-wide cookies
73-
*
74-
* @var string
75-
*
76-
* @deprecated Use the dedicated Cookie class instead.
77-
*/
78-
protected $cookieDomain = '';
79-
80-
/**
81-
* Typically will be a forward slash
82-
*
83-
* @var string
84-
*
85-
* @deprecated Use the dedicated Cookie class instead.
86-
*/
87-
protected $cookiePath = '/';
88-
89-
/**
90-
* Cookie will only be set if a secure HTTPS connection exists.
91-
*
92-
* @var bool
93-
*
94-
* @deprecated Use the dedicated Cookie class instead.
95-
*/
96-
protected $cookieSecure = false;
97-
98-
/**
99-
* Cookie will only be accessible via HTTP(S) (no javascript)
100-
*
101-
* @var bool
102-
*
103-
* @deprecated Use the dedicated Cookie class instead.
104-
*/
105-
protected $cookieHTTPOnly = false;
106-
107-
/**
108-
* Cookie SameSite setting
109-
*
110-
* @var string
111-
*
112-
* @deprecated Use the dedicated Cookie class instead.
113-
*/
114-
protected $cookieSameSite = Cookie::SAMESITE_LAX;
115-
116-
/**
117-
* Stores all cookies that were set in the response.
118-
*
119-
* @var array
120-
*
121-
* @deprecated Use the dedicated Cookie class instead.
122-
*/
123-
protected $cookies = [];
124-
12551
/**
12652
* Type of format the body is in.
12753
* Valid: html, json, xml

user_guide_src/source/changelogs/v4.5.0.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,22 @@ Model
141141
- ``Model::idValue()``
142142
- ``Model::classToArray()``
143143

144+
Response
145+
--------
146+
147+
- The visibility of the deprecated property ``ResponseTrait::$CSP`` has been
148+
changed to protected.
149+
- The following deprecated properties have been removed.
150+
151+
- ``ResponseTrait::$CSPEnabled``
152+
- ``ResponseTrait::$cookiePrefix``
153+
- ``ResponseTrait::$cookieDomain``
154+
- ``ResponseTrait::$cookiePath``
155+
- ``ResponseTrait::$cookieSecure``
156+
- ``ResponseTrait::$cookieHTTPOnly``
157+
- ``ResponseTrait::$cookieSameSite``
158+
- ``ResponseTrait::$cookies``
159+
144160
CodeIgniter
145161
-----------
146162

@@ -240,6 +256,8 @@ Deprecations
240256

241257
- **CodeIgniter:** The ``determinePath()`` method has been deprecated. No longer
242258
used.
259+
- **Response:** The constructor parameter ``$config`` has been deprecated. No
260+
longer used.
243261

244262
Bugs Fixed
245263
**********

0 commit comments

Comments
 (0)