Skip to content

Commit

Permalink
Improve typehinting
Browse files Browse the repository at this point in the history
  • Loading branch information
nyamsprod committed Jul 30, 2023
1 parent d6a3992 commit 9b92755
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion BaseUri.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ final class BaseUri implements Stringable, JsonSerializable, UriAccess

private function __construct(
private readonly Psr7UriInterface|UriInterface $uri,
private readonly UriFactoryInterface|null $uriFactory
private readonly ?UriFactoryInterface $uriFactory
) {
$this->nullValue = $this->uri instanceof Psr7UriInterface ? '' : null;
$this->origin = $this->computeOrigin($this->uri, $this->nullValue);
Expand Down
4 changes: 2 additions & 2 deletions Http.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public function jsonSerialize(): string
/**
* Safely stringify input when possible for League UriInterface compatibility.
*/
private function filterInput(string $str): string|null
private function filterInput(string $str): ?string
{
return match (true) {
'' === $str => null,
Expand Down Expand Up @@ -165,7 +165,7 @@ public function withHost(string $host): self
return $this->newInstance($this->uri->withHost($this->filterInput($host)));
}

public function withPort(int|null $port): self
public function withPort(?int $port): self
{
return $this->newInstance($this->uri->withPort($port));
}
Expand Down
2 changes: 1 addition & 1 deletion Uri.php
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ private function formatIp(string $host): string
*
* @throws SyntaxError
*/
private function formatPort(int|null $port = null): ?int
private function formatPort(?int $port = null): ?int
{
$defaultPort = self::SCHEME_DEFAULT_PORT[$this->scheme] ?? null;

Expand Down

0 comments on commit 9b92755

Please sign in to comment.