Pārlūkot izejas kodu

Merge pull request #1051 from joanhey/patch-1

Add PHP 8.4 nightly to tests
walkor 1 gadu atpakaļ
vecāks
revīzija
4ede81377d

+ 1 - 1
.github/workflows/test.yml

@@ -18,7 +18,7 @@ jobs:
       fail-fast: false
       matrix:
         os: [ubuntu-latest, macos-latest, windows-latest]
-        php: ["8.1", "8.2", "8.3"]
+        php: ["8.1", "8.2", "8.3", "8.4"] 
         stability: [prefer-lowest, prefer-stable]
 
     name: PHP ${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.os }} 

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

@@ -126,7 +126,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();
@@ -157,7 +157,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();
@@ -188,7 +188,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();
@@ -219,7 +219,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'])) {
             $cookies = explode(';', $this->header('cookie', ''));
@@ -246,7 +246,7 @@ class Request implements Stringable
      * @param string|null $name
      * @return array|null
      */
-    public function file(string $name = null)
+    public function file(?string $name = null)
     {
         clearstatcache();
         if (!empty($this->data['files'])) {
@@ -357,7 +357,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);

+ 1 - 1
src/Protocols/Http/Response.php

@@ -244,7 +244,7 @@ class Response implements Stringable
      * @param string|null $reasonPhrase
      * @return $this
      */
-    public function withStatus(int $code, string $reasonPhrase = null): static
+    public function withStatus(int $code, ?string $reasonPhrase = null): static
     {
         $this->status = $code;
         $this->reason = $reasonPhrase;

+ 1 - 1
tests/Pest.php

@@ -42,7 +42,7 @@ function something()
     // ..
 }
 
-function testWithConnectionClose(Closure $closure, string $dataContains = null, $connectionClass = TcpConnection::class): void
+function testWithConnectionClose(Closure $closure, ?string $dataContains = null, $connectionClass = TcpConnection::class): void
 {
     $tcpConnection = Mockery::spy($connectionClass);
     $closure($tcpConnection);