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