- Fixed missing return types

This commit is contained in:
Dave Mc Nicoll committed 2026-10-26 12:06:56 +00:00
1 parent ac44ef4989
commit f3a21a811b
3 files changed
+22 -22

No files matched your search

+14 -14
View File
@@ -53,7 +53,7 @@ class Uri implements UriInterface
$this->setFragment($parts['fragment'] ?? null); $this->setFragment($parts['fragment'] ?? null);
} }
public function getScheme() public function getScheme(): string
{ {
return $this->scheme; return $this->scheme;
} }
@@ -94,7 +94,7 @@ class Uri implements UriInterface
return ( $info = $this->getUserInfo() ) ? "{$info}@" : ""; return ( $info = $this->getUserInfo() ) ? "{$info}@" : "";
} }
public function getHost() public function getHost(): string
{ {
return $this->host; return $this->host;
} }
@@ -106,7 +106,7 @@ class Uri implements UriInterface
return $this; return $this;
} }
public function getPort() public function getPort(): ?int
{ {
return $this->port; return $this->port;
} }
@@ -118,7 +118,7 @@ class Uri implements UriInterface
return $port && ! in_array($port, $ignore) ? ":{$port}" : ""; return $port && ! in_array($port, $ignore) ? ":{$port}" : "";
} }
public function getPath() public function getPath(): string
{ {
$path = implode('/', array_map('rawurlencode', explode('/', $this->path))); $path = implode('/', array_map('rawurlencode', explode('/', $this->path)));
@@ -130,7 +130,7 @@ class Uri implements UriInterface
return $this->getPath(); return $this->getPath();
} }
public function getQuery() public function getQuery(): string
{ {
return http_build_query($this->query, "", null, PHP_QUERY_RFC3986); return http_build_query($this->query, "", null, PHP_QUERY_RFC3986);
} }
@@ -142,7 +142,7 @@ class Uri implements UriInterface
return $query ? "?{$query}" : ""; return $query ? "?{$query}" : "";
} }
public function getFragment() public function getFragment() : string
{ {
return rawurlencode($this->fragment ? "#{$this->fragment}" : ""); return rawurlencode($this->fragment ? "#{$this->fragment}" : "");
} }
@@ -152,12 +152,12 @@ class Uri implements UriInterface
return $this->getFragment(); return $this->getFragment();
} }
public function withScheme($scheme) public function withScheme($scheme) : UriInterface
{ {
return (clone $this)->setScheme($scheme); return (clone $this)->setScheme($scheme);
} }
public function withUserInfo($user, $password = null) public function withUserInfo($user, $password = null) : UriInterface
{ {
return (clone $this)->setUserInfo($user, $password); return (clone $this)->setUserInfo($user, $password);
} }
@@ -170,12 +170,12 @@ class Uri implements UriInterface
return $this; return $this;
} }
public function withHost($host) public function withHost($host) : UriInterface
{ {
return (clone $this)->setHost($host); return (clone $this)->setHost($host);
} }
public function withPort($port) public function withPort($port) : UriInterface
{ {
return (clone $this)->setPort($port); return (clone $this)->setPort($port);
} }
@@ -187,7 +187,7 @@ class Uri implements UriInterface
return $this; return $this;
} }
public function withPath($path) public function withPath($path) : UriInterface
{ {
return (clone $this)->setPath($path); return (clone $this)->setPath($path);
} }
@@ -199,7 +199,7 @@ class Uri implements UriInterface
return $this; return $this;
} }
public function withQuery($query) public function withQuery($query) : UriInterface
{ {
return $this->setQuery($query); return $this->setQuery($query);
} }
@@ -215,7 +215,7 @@ class Uri implements UriInterface
return $this; return $this;
} }
public function withFragment($fragment) public function withFragment($fragment) : UriInterface
{ {
return (clone $this)->setFragment($fragment); return (clone $this)->setFragment($fragment);
} }
@@ -227,7 +227,7 @@ class Uri implements UriInterface
return $this; return $this;
} }
public function __toString() public function __toString() : string
{ {
return $this->render(); return $this->render();
} }
+5 -5
View File
@@ -45,7 +45,7 @@ class Request extends Message implements ServerRequestInterface
return $target ?: '/'; return $target ?: '/';
} }
public function withRequestTarget($requestTarget) public function withRequestTarget($requestTarget) : RequestInterface
{ {
return (clone $this)->setRequestTarget($requestTarget); return (clone $this)->setRequestTarget($requestTarget);
} }
@@ -57,12 +57,12 @@ class Request extends Message implements ServerRequestInterface
return $this; return $this;
} }
public function getMethod() public function getMethod(): string
{ {
return $this->method->value; return $this->method->value;
} }
public function withMethod($method) public function withMethod($method) : RequestInterface
{ {
return (clone $this)->setMethod($method); return (clone $this)->setMethod($method);
} }
@@ -79,7 +79,7 @@ class Request extends Message implements ServerRequestInterface
return $this->uri; return $this->uri;
} }
public function withUri(UriInterface $uri, $preserveHost = false) public function withUri(UriInterface $uri, $preserveHost = false) : RequestInterface
{ {
return (clone $this)->setUri($uri, $preserveHost); return (clone $this)->setUri($uri, $preserveHost);
} }
@@ -95,7 +95,7 @@ class Request extends Message implements ServerRequestInterface
return $this; return $this;
} }
protected function renderHostHeader(UriInterface $fromUri = null) : string protected function renderHostHeader(? UriInterface $fromUri = null) : string
{ {
$fromUri ??= $this->uri; $fromUri ??= $this->uri;
+3 -3
View File
@@ -20,17 +20,17 @@ class Response extends Message implements ResponseInterface
$this->setHeaders($headers); $this->setHeaders($headers);
} }
public function getStatusCode() /* : int */ public function getStatusCode() : int
{ {
return $this->code; return $this->code;
} }
public function withStatus($code, $reasonPhrase = null)/* : ResponseInterface*/ public function withStatus($code, $reasonPhrase = null) : ResponseInterface
{ {
return (clone $this)->setStatusCode($code, $reasonPhrase); return (clone $this)->setStatusCode($code, $reasonPhrase);
} }
public function getReasonPhrase() /* : string */ public function getReasonPhrase() : string
{ {
return $this->message; return $this->message;
} }