Skip to content

Commit 38edd9a

Browse files
authored
Update Request.php fix explicit nullable php 8.4 (#27)
* Update Request.php fix explicit nullable php 8.4 * Update Response.php fix explicit nullable php 8.4 * Update Headers.php fix explicit nullable php 8.4
1 parent c0553e5 commit 38edd9a

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/Headers.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class Headers
2222
*
2323
* @param int|null $httpCode The current response code.
2424
*/
25-
public static function status(int $httpCode = null)
25+
public static function status(?int $httpCode = null)
2626
{
2727
if ($httpCode === null) return self::$httpCode;
2828
self::$httpCode = $httpCode;

src/Request.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ public static function get($params, bool $safeData = true)
234234
*
235235
* @return mixed
236236
*/
237-
public static function params(string $key = null, $default = null)
237+
public static function params(?string $key = null, $default = null)
238238
{
239239
return static::get($key) ?? $default;
240240
}
@@ -250,7 +250,7 @@ public static function params(string $key = null, $default = null)
250250
*
251251
* @return mixed
252252
*/
253-
public static function getOrDefault(string $key = null, $default = null)
253+
public static function getOrDefault(?string $key = null, $default = null)
254254
{
255255
return static::get($key) ?? $default;
256256
}
@@ -300,7 +300,7 @@ public static function files($filenames = null)
300300
* @param string|null $key
301301
* @return array|string|null
302302
*/
303-
public static function cookies(string $key = null)
303+
public static function cookies(?string $key = null)
304304
{
305305
return $key === null ?
306306
Cookie::all() :

src/Response.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ public function markup(string $markup, int $code = 200)
186186
* @param string|null $name The of the file as shown to user
187187
* @param int $code The response status code
188188
*/
189-
public function download(string $file, string $name = null, int $code = 200)
189+
public function download(string $file, ?string $name = null, int $code = 200)
190190
{
191191
$this->status = $code;
192192

@@ -356,7 +356,7 @@ public function withHeader($name, ?string $value = '', bool $replace = true, int
356356
*
357357
* @return Response
358358
*/
359-
public function withCookie(string $name, string $value, int $expire = null): Response
359+
public function withCookie(string $name, string $value, ?int $expire = null): Response
360360
{
361361
$this->cookies[$name] = [$value, $expire ?? (time() + 604800)];
362362

0 commit comments

Comments
 (0)