@@ -136,57 +136,57 @@ class Request
136136 protected $ content ;
137137
138138 /**
139- * @var string[]
139+ * @var string[]|null
140140 */
141141 protected $ languages ;
142142
143143 /**
144- * @var string[]
144+ * @var string[]|null
145145 */
146146 protected $ charsets ;
147147
148148 /**
149- * @var string[]
149+ * @var string[]|null
150150 */
151151 protected $ encodings ;
152152
153153 /**
154- * @var string[]
154+ * @var string[]|null
155155 */
156156 protected $ acceptableContentTypes ;
157157
158158 /**
159- * @var string
159+ * @var string|null
160160 */
161161 protected $ pathInfo ;
162162
163163 /**
164- * @var string
164+ * @var string|null
165165 */
166166 protected $ requestUri ;
167167
168168 /**
169- * @var string
169+ * @var string|null
170170 */
171171 protected $ baseUrl ;
172172
173173 /**
174- * @var string
174+ * @var string|null
175175 */
176176 protected $ basePath ;
177177
178178 /**
179- * @var string
179+ * @var string|null
180180 */
181181 protected $ method ;
182182
183183 /**
184- * @var string
184+ * @var string|null
185185 */
186186 protected $ format ;
187187
188188 /**
189- * @var SessionInterface|callable(): SessionInterface
189+ * @var SessionInterface|callable():SessionInterface|null
190190 */
191191 protected $ session ;
192192
@@ -282,16 +282,16 @@ public function initialize(array $query = [], array $request = [], array $attrib
282282 $ this ->headers = new HeaderBag ($ this ->server ->getHeaders ());
283283
284284 $ 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 ;
295295 }
296296
297297 /**
@@ -468,16 +468,16 @@ public function duplicate(array $query = null, array $request = null, array $att
468468 $ dup ->server = new ServerBag ($ server );
469469 $ dup ->headers = new HeaderBag ($ dup ->server ->getHeaders ());
470470 }
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 ;
481481
482482 if (!$ dup ->get ('_format ' ) && $ this ->get ('_format ' )) {
483483 $ dup ->attributes ->set ('_format ' , $ this ->get ('_format ' ));
@@ -1182,7 +1182,7 @@ public function getHost(): string
11821182 */
11831183 public function setMethod (string $ method )
11841184 {
1185- unset( $ this ->method ) ;
1185+ $ this ->method = null ;
11861186 $ this ->server ->set ('REQUEST_METHOD ' , $ method );
11871187 }
11881188
@@ -1201,7 +1201,7 @@ public function setMethod(string $method)
12011201 */
12021202 public function getMethod (): string
12031203 {
1204- if (isset ( $ this ->method ) ) {
1204+ if (null !== $ this ->method ) {
12051205 return $ this ->method ;
12061206 }
12071207
@@ -1249,7 +1249,7 @@ public function getRealMethod(): string
12491249 */
12501250 public function getMimeType (string $ format ): ?string
12511251 {
1252- if (! isset ( static ::$ formats) ) {
1252+ if (null === static ::$ formats ) {
12531253 static ::initializeFormats ();
12541254 }
12551255
@@ -1263,7 +1263,7 @@ public function getMimeType(string $format): ?string
12631263 */
12641264 public static function getMimeTypes (string $ format ): array
12651265 {
1266- if (! isset ( static ::$ formats) ) {
1266+ if (null === static ::$ formats ) {
12671267 static ::initializeFormats ();
12681268 }
12691269
@@ -1280,7 +1280,7 @@ public function getFormat(?string $mimeType): ?string
12801280 $ canonicalMimeType = trim (substr ($ mimeType , 0 , $ pos ));
12811281 }
12821282
1283- if (! isset ( static ::$ formats) ) {
1283+ if (null === static ::$ formats ) {
12841284 static ::initializeFormats ();
12851285 }
12861286
@@ -1305,7 +1305,7 @@ public function getFormat(?string $mimeType): ?string
13051305 */
13061306 public function setFormat (?string $ format , string |array $ mimeTypes )
13071307 {
1308- if (! isset ( static ::$ formats) ) {
1308+ if (null === static ::$ formats ) {
13091309 static ::initializeFormats ();
13101310 }
13111311
@@ -1586,13 +1586,13 @@ public function isNoCache(): bool
15861586 */
15871587 public function getPreferredFormat (?string $ default = 'html ' ): ?string
15881588 {
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 ;
15911591 }
15921592
15931593 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 ;
15961596 }
15971597 }
15981598
@@ -1639,7 +1639,7 @@ public function getPreferredLanguage(array $locales = null): ?string
16391639 */
16401640 public function getLanguages (): array
16411641 {
1642- if (isset ( $ this ->languages ) ) {
1642+ if (null !== $ this ->languages ) {
16431643 return $ this ->languages ;
16441644 }
16451645
0 commit comments