Skip to content

Commit

Permalink
Merge pull request #15 from bearsunday/sooorh-sa
Browse files Browse the repository at this point in the history
Soothe SA
  • Loading branch information
koriym authored Jan 6, 2024
2 parents 6335f87 + 3ef35b2 commit 4152fef
Show file tree
Hide file tree
Showing 7 changed files with 1,477 additions and 983 deletions.
2 changes: 1 addition & 1 deletion src/Http/CreateResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ private function getHeaders(array $headers): array
$keyedHeader[$matched[1]] = $matched[2];
}

return $keyedHeader; // @phpstan-ignore-line
return $keyedHeader;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Http/HttpResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public function options(string $uri, array $query = []): ResourceObject
}

/**
* @param array<mixed> $query
* @param array<string, mixed> $query
*/
private function safeRequest(string $path, array $query): ResourceObject
{
Expand Down
9 changes: 7 additions & 2 deletions src/QueryMerger.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,19 @@
final class QueryMerger
{
/**
* @param array<mixed> $query
* @param array<string, mixed> $query
*/
public function __invoke(string $uri, array $query): Uri
{
$path = (string) parse_url($uri, PHP_URL_PATH);
$uriQueryString = (string) parse_url($uri, PHP_URL_QUERY);
parse_str($uriQueryString, $uriQuery);
$mergedQuery = $uriQuery + $query;
$uriQueryKeyString = [];
foreach ($uriQuery as $key => $value) {
$uriQueryKeyString[(string) $key] = $value;
}

$mergedQuery = $uriQueryKeyString + $query;

return new Uri($path, $mergedQuery);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Uri.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ final class Uri
/** @var string */
public $path;

/** @var array<string, string> */
/** @var array<string, mixed> */
public $query;

/**
* @param array<string, string> $query
* @param array<string, mixed> $query
*/
public function __construct(string $path, array $query)
{
Expand Down
Loading

0 comments on commit 4152fef

Please sign in to comment.