@@ -136,57 +136,57 @@ class Request
136
136
protected $ content ;
137
137
138
138
/**
139
- * @var string[]
139
+ * @var string[]|null
140
140
*/
141
141
protected $ languages ;
142
142
143
143
/**
144
- * @var string[]
144
+ * @var string[]|null
145
145
*/
146
146
protected $ charsets ;
147
147
148
148
/**
149
- * @var string[]
149
+ * @var string[]|null
150
150
*/
151
151
protected $ encodings ;
152
152
153
153
/**
154
- * @var string[]
154
+ * @var string[]|null
155
155
*/
156
156
protected $ acceptableContentTypes ;
157
157
158
158
/**
159
- * @var string
159
+ * @var string|null
160
160
*/
161
161
protected $ pathInfo ;
162
162
163
163
/**
164
- * @var string
164
+ * @var string|null
165
165
*/
166
166
protected $ requestUri ;
167
167
168
168
/**
169
- * @var string
169
+ * @var string|null
170
170
*/
171
171
protected $ baseUrl ;
172
172
173
173
/**
174
- * @var string
174
+ * @var string|null
175
175
*/
176
176
protected $ basePath ;
177
177
178
178
/**
179
- * @var string
179
+ * @var string|null
180
180
*/
181
181
protected $ method ;
182
182
183
183
/**
184
- * @var string
184
+ * @var string|null
185
185
*/
186
186
protected $ format ;
187
187
188
188
/**
189
- * @var SessionInterface|callable(): SessionInterface
189
+ * @var SessionInterface|callable():SessionInterface|null
190
190
*/
191
191
protected $ session ;
192
192
@@ -282,16 +282,16 @@ public function initialize(array $query = [], array $request = [], array $attrib
282
282
$ this ->headers = new HeaderBag ($ this ->server ->getHeaders ());
283
283
284
284
$ this ->content = $ content ;
285
- unset( $ this ->languages ) ;
286
- unset( $ this ->charsets ) ;
287
- unset( $ this ->encodings ) ;
288
- unset( $ this ->acceptableContentTypes ) ;
289
- unset( $ this ->pathInfo ) ;
290
- unset( $ this ->requestUri ) ;
291
- unset( $ this ->baseUrl ) ;
292
- unset( $ this ->basePath ) ;
293
- unset( $ this ->method ) ;
294
- unset( $ this ->format ) ;
285
+ $ this ->languages = null ;
286
+ $ this ->charsets = null ;
287
+ $ this ->encodings = null ;
288
+ $ this ->acceptableContentTypes = null ;
289
+ $ this ->pathInfo = null ;
290
+ $ this ->requestUri = null ;
291
+ $ this ->baseUrl = null ;
292
+ $ this ->basePath = null ;
293
+ $ this ->method = null ;
294
+ $ this ->format = null ;
295
295
}
296
296
297
297
/**
@@ -468,16 +468,16 @@ public function duplicate(array $query = null, array $request = null, array $att
468
468
$ dup ->server = new ServerBag ($ server );
469
469
$ dup ->headers = new HeaderBag ($ dup ->server ->getHeaders ());
470
470
}
471
- unset( $ dup ->languages ) ;
472
- unset( $ dup ->charsets ) ;
473
- unset( $ dup ->encodings ) ;
474
- unset( $ dup ->acceptableContentTypes ) ;
475
- unset( $ dup ->pathInfo ) ;
476
- unset( $ dup ->requestUri ) ;
477
- unset( $ dup ->baseUrl ) ;
478
- unset( $ dup ->basePath ) ;
479
- unset( $ dup ->method ) ;
480
- unset( $ dup ->format ) ;
471
+ $ dup ->languages = null ;
472
+ $ dup ->charsets = null ;
473
+ $ dup ->encodings = null ;
474
+ $ dup ->acceptableContentTypes = null ;
475
+ $ dup ->pathInfo = null ;
476
+ $ dup ->requestUri = null ;
477
+ $ dup ->baseUrl = null ;
478
+ $ dup ->basePath = null ;
479
+ $ dup ->method = null ;
480
+ $ dup ->format = null ;
481
481
482
482
if (!$ dup ->get ('_format ' ) && $ this ->get ('_format ' )) {
483
483
$ dup ->attributes ->set ('_format ' , $ this ->get ('_format ' ));
@@ -1182,7 +1182,7 @@ public function getHost(): string
1182
1182
*/
1183
1183
public function setMethod (string $ method )
1184
1184
{
1185
- unset( $ this ->method ) ;
1185
+ $ this ->method = null ;
1186
1186
$ this ->server ->set ('REQUEST_METHOD ' , $ method );
1187
1187
}
1188
1188
@@ -1201,7 +1201,7 @@ public function setMethod(string $method)
1201
1201
*/
1202
1202
public function getMethod (): string
1203
1203
{
1204
- if (isset ( $ this ->method ) ) {
1204
+ if (null !== $ this ->method ) {
1205
1205
return $ this ->method ;
1206
1206
}
1207
1207
@@ -1249,7 +1249,7 @@ public function getRealMethod(): string
1249
1249
*/
1250
1250
public function getMimeType (string $ format ): ?string
1251
1251
{
1252
- if (! isset ( static ::$ formats) ) {
1252
+ if (null === static ::$ formats ) {
1253
1253
static ::initializeFormats ();
1254
1254
}
1255
1255
@@ -1263,7 +1263,7 @@ public function getMimeType(string $format): ?string
1263
1263
*/
1264
1264
public static function getMimeTypes (string $ format ): array
1265
1265
{
1266
- if (! isset ( static ::$ formats) ) {
1266
+ if (null === static ::$ formats ) {
1267
1267
static ::initializeFormats ();
1268
1268
}
1269
1269
@@ -1280,7 +1280,7 @@ public function getFormat(?string $mimeType): ?string
1280
1280
$ canonicalMimeType = trim (substr ($ mimeType , 0 , $ pos ));
1281
1281
}
1282
1282
1283
- if (! isset ( static ::$ formats) ) {
1283
+ if (null === static ::$ formats ) {
1284
1284
static ::initializeFormats ();
1285
1285
}
1286
1286
@@ -1305,7 +1305,7 @@ public function getFormat(?string $mimeType): ?string
1305
1305
*/
1306
1306
public function setFormat (?string $ format , string |array $ mimeTypes )
1307
1307
{
1308
- if (! isset ( static ::$ formats) ) {
1308
+ if (null === static ::$ formats ) {
1309
1309
static ::initializeFormats ();
1310
1310
}
1311
1311
@@ -1586,13 +1586,13 @@ public function isNoCache(): bool
1586
1586
*/
1587
1587
public function getPreferredFormat (?string $ default = 'html ' ): ?string
1588
1588
{
1589
- if (isset ( $ this ->preferredFormat ) || null !== $ preferredFormat = $ this ->getRequestFormat (null )) {
1590
- return $ this ->preferredFormat ??= $ preferredFormat ;
1589
+ if ($ this ->preferredFormat ?? = $ this ->getRequestFormat (null )) {
1590
+ return $ this ->preferredFormat ;
1591
1591
}
1592
1592
1593
1593
foreach ($ this ->getAcceptableContentTypes () as $ mimeType ) {
1594
- if ($ preferredFormat = $ this ->getFormat ($ mimeType )) {
1595
- return $ this ->preferredFormat = $ preferredFormat ;
1594
+ if ($ this -> preferredFormat = $ this ->getFormat ($ mimeType )) {
1595
+ return $ this ->preferredFormat ;
1596
1596
}
1597
1597
}
1598
1598
@@ -1639,7 +1639,7 @@ public function getPreferredLanguage(array $locales = null): ?string
1639
1639
*/
1640
1640
public function getLanguages (): array
1641
1641
{
1642
- if (isset ( $ this ->languages ) ) {
1642
+ if (null !== $ this ->languages ) {
1643
1643
return $ this ->languages ;
1644
1644
}
1645
1645
0 commit comments