Skip to content

Commit

Permalink
Resolve symfony/error-handler deprecations (#197)
Browse files Browse the repository at this point in the history
* Fixed deprecation messages for PHP 8.1 (#195)

* Fixed deprecation messages for PHP 8.1 and `symfony/error-handler` with BC (#195)

* Fixed deprecation messages for PHP 8.1 and `symfony/error-handler` in tests

Co-authored-by: Luis Fernando do Nascimento <luis.nascimento@ankorstore.com>
  • Loading branch information
andrew-demb and Luis Fernando do Nascimento committed Jun 22, 2022
1 parent 1461e07 commit f88a9e5
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 6 deletions.
15 changes: 15 additions & 0 deletions src/ServerRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ public function getUploadedFiles(): array
return $this->uploadedFiles;
}

/**
* @return static
*/
public function withUploadedFiles(array $uploadedFiles)
{
$new = clone $this;
Expand All @@ -90,6 +93,9 @@ public function getCookieParams(): array
return $this->cookieParams;
}

/**
* @return static
*/
public function withCookieParams(array $cookies)
{
$new = clone $this;
Expand All @@ -103,6 +109,9 @@ public function getQueryParams(): array
return $this->queryParams;
}

/**
* @return static
*/
public function withQueryParams(array $query)
{
$new = clone $this;
Expand All @@ -111,11 +120,17 @@ public function withQueryParams(array $query)
return $new;
}

/**
* @return array|object|null
*/
public function getParsedBody()
{
return $this->parsedBody;
}

/**
* @return static
*/
public function withParsedBody($data)
{
if (!\is_array($data) && !\is_object($data) && null !== $data) {
Expand Down
3 changes: 2 additions & 1 deletion tests/Integration/RequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

namespace Tests\Nyholm\Psr7\Integration;

use Psr\Http\Message\RequestInterface;
use Http\Psr7Test\RequestIntegrationTest;
use Nyholm\Psr7\Request;

class RequestTest extends RequestIntegrationTest
{
public function createSubject()
public function createSubject(): RequestInterface
{
return new Request('GET', '/');
}
Expand Down
3 changes: 2 additions & 1 deletion tests/Integration/ResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

namespace Tests\Nyholm\Psr7\Integration;

use Psr\Http\Message\ResponseInterface;
use Http\Psr7Test\ResponseIntegrationTest;
use Nyholm\Psr7\Response;

class ResponseTest extends ResponseIntegrationTest
{
public function createSubject()
public function createSubject(): ResponseInterface
{
return new Response();
}
Expand Down
3 changes: 2 additions & 1 deletion tests/Integration/ServerRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

namespace Tests\Nyholm\Psr7\Integration;

use Psr\Http\Message\ServerRequestInterface;
use Http\Psr7Test\ServerRequestIntegrationTest;
use Nyholm\Psr7\ServerRequest;

class ServerRequestTest extends ServerRequestIntegrationTest
{
public function createSubject()
public function createSubject(): ServerRequestInterface
{
$_SERVER['REQUEST_METHOD'] = 'GET';

Expand Down
3 changes: 2 additions & 1 deletion tests/Integration/StreamTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

namespace Tests\Nyholm\Psr7\Integration;

use Psr\Http\Message\StreamInterface;
use Http\Psr7Test\StreamIntegrationTest;
use Nyholm\Psr7\Stream;

class StreamTest extends StreamIntegrationTest
{
public function createStream($data)
public function createStream($data): StreamInterface
{
return Stream::create($data);
}
Expand Down
3 changes: 2 additions & 1 deletion tests/Integration/UploadedFileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

namespace Tests\Nyholm\Psr7\Integration;

use Psr\Http\Message\UploadedFileInterface;
use Http\Psr7Test\UploadedFileIntegrationTest;
use Nyholm\Psr7\Factory\Psr17Factory;
use Nyholm\Psr7\Stream;

class UploadedFileTest extends UploadedFileIntegrationTest
{
public function createSubject()
public function createSubject(): UploadedFileInterface
{
return (new Psr17Factory())->createUploadedFile(Stream::create('writing to tempfile'));
}
Expand Down
3 changes: 2 additions & 1 deletion tests/Integration/UriTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

namespace Tests\Nyholm\Psr7\Integration;

use Psr\Http\Message\UriInterface;
use Http\Psr7Test\UriIntegrationTest;
use Nyholm\Psr7\Uri;

class UriTest extends UriIntegrationTest
{
public function createUri($uri)
public function createUri($uri): UriInterface
{
return new Uri($uri);
}
Expand Down

0 comments on commit f88a9e5

Please sign in to comment.