Skip to content

Commit

Permalink
Method LastDragon_ru\LaraASP\Testing\Constraints\Json\Protocol::getUr…
Browse files Browse the repository at this point in the history
…i() should return Opis\JsonSchema\Uri but returns Opis\JsonSchema\Uri|null.

Parameter #2 $string of function explode expects string, string|null given.
  • Loading branch information
LastDragon-ru committed Aug 14, 2021
1 parent 9bd8a60 commit 2df9ea0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/testing/src/Constraints/Json/Protocol.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use function http_build_query;
use function implode;
use function ltrim;
use function parse_url;
use function preg_match;
use function rawurldecode;
use function rawurlencode;
Expand Down Expand Up @@ -50,7 +51,7 @@ public static function getUri(SplFileInfo $file, array $parameters = []): Uri {
$path = implode('/', array_map(static function (string $segment): string {
return rawurlencode($segment);
}, explode('/', ltrim($path, '/'))));
$uri = Uri::create("{$scheme}://{$host}/{$path}?{$query}");
$uri = new Uri((array) parse_url("{$scheme}://{$host}/{$path}?{$query}"));

// Return
return $uri;
Expand All @@ -66,7 +67,7 @@ public function __invoke(Uri $uri): ?string {
}

// Decode path
$path = $uri->path();
$path = (string) $uri->path();
$path = implode('/', array_map(static function (string $segment): string {
return rawurldecode($segment);
}, explode('/', $path)));
Expand Down

0 comments on commit 2df9ea0

Please sign in to comment.