Skip to content

Commit

Permalink
Fix IncompatibleReturnValueException in MessageFactoryTest
Browse files Browse the repository at this point in the history
PSR7 `RequestInterface::getUri()` must return `UriInterface`, not `string`; explicit typehint was added in `2.0`.
  • Loading branch information
Nevay committed Sep 29, 2024
1 parent 20bf3cf commit e603522
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace OpenTelemetry\Tests\Unit\SDK\Common\Http\Psr\Message;

use Nyholm\Psr7\Uri;
use Psr\Http\Message\RequestFactoryInterface;
use Psr\Http\Message\RequestInterface;

Expand All @@ -19,7 +20,7 @@ private function createRequestFactoryMock(?string $requestMethod = 'GET', ?strin
$request->method('getMethod')
->willReturn((string) $requestMethod);
$request->method('getUri')
->willReturn((string) $requestUri);
->willReturn(new Uri((string) $requestUri));
$factory = $this->createMock(RequestFactoryInterface::class);
$factory->method('createRequest')
->willReturn($request);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace OpenTelemetry\Tests\Unit\SDK\Common\Http\Psr\Message;

use Nyholm\Psr7\Uri;
use Psr\Http\Message\ServerRequestFactoryInterface;
use Psr\Http\Message\ServerRequestInterface;

Expand All @@ -19,7 +20,7 @@ private function createServerRequestFactoryMock(?string $requestMethod = 'GET',
$request->method('getMethod')
->willReturn((string) $requestMethod);
$request->method('getUri')
->willReturn((string) $requestUri);
->willReturn(new Uri((string) $requestUri));
$factory = $this->createMock(ServerRequestFactoryInterface::class);
$factory->method('createServerRequest')
->willReturn($request);
Expand Down

0 comments on commit e603522

Please sign in to comment.