Browse Source

Fix Request.php to use explicit nullable for PHP8.4

Joan Miquel 1 year ago
parent
commit
bab53ee969
1 changed files with 6 additions and 6 deletions
  1. 6 6
      src/Protocols/Http/Request.php

+ 6 - 6
src/Protocols/Http/Request.php

@@ -119,7 +119,7 @@ class Request implements Stringable
      * @param mixed $default
      * @return mixed
      */
-    public function get(string $name = null, mixed $default = null): mixed
+    public function get(?string $name = null, mixed $default = null): mixed
     {
         if (!isset($this->data['get'])) {
             $this->parseGet();
@@ -137,7 +137,7 @@ class Request implements Stringable
      * @param mixed $default
      * @return mixed
      */
-    public function post(string $name = null, mixed $default = null): mixed
+    public function post(?string $name = null, mixed $default = null): mixed
     {
         if (!isset($this->data['post'])) {
             $this->parsePost();
@@ -155,7 +155,7 @@ class Request implements Stringable
      * @param mixed $default
      * @return mixed
      */
-    public function header(string $name = null, mixed $default = null): mixed
+    public function header(?string $name = null, mixed $default = null): mixed
     {
         if (!isset($this->data['headers'])) {
             $this->parseHeaders();
@@ -174,7 +174,7 @@ class Request implements Stringable
      * @param mixed $default
      * @return mixed
      */
-    public function cookie(string $name = null, mixed $default = null): mixed
+    public function cookie(?string $name = null, mixed $default = null): mixed
     {
         if (!isset($this->data['cookie'])) {
             $this->data['cookie'] = [];
@@ -192,7 +192,7 @@ class Request implements Stringable
      * @param string|null $name
      * @return array|null
      */
-    public function file(string $name = null)
+    public function file(?string $name = null)
     {
         if (!isset($this->data['files'])) {
             $this->parsePost();
@@ -295,7 +295,7 @@ class Request implements Stringable
      * @return string
      * @throws Exception
      */
-    public function sessionId(string $sessionId = null): string
+    public function sessionId(?string $sessionId = null): string
     {
         if ($sessionId) {
             unset($this->sid);