Skip to content

Commit ff98230

Browse files
authored
Merge pull request #79 from blubolt/return-types
Provide native return type hints for all additional helpers
2 parents 1ac726f + 5d45c06 commit ff98230

1 file changed

Lines changed: 17 additions & 17 deletions

File tree

src/ServerRequest.php

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@ public function withUri(UriInterface $uri, $preserveHost = false)
765765
*
766766
* @return string|null
767767
*/
768-
public function getContentCharset()
768+
public function getContentCharset(): ?string
769769
{
770770
$mediaTypeParams = $this->getMediaTypeParams();
771771

@@ -783,7 +783,7 @@ public function getContentCharset()
783783
*
784784
* @return string|null The serverRequest content type, if known
785785
*/
786-
public function getContentType()
786+
public function getContentType(): ?string
787787
{
788788
$result = $this->serverRequest->getHeader('Content-Type');
789789
return $result ? $result[0] : null;
@@ -796,7 +796,7 @@ public function getContentType()
796796
*
797797
* @return int|null
798798
*/
799-
public function getContentLength()
799+
public function getContentLength(): ?int
800800
{
801801
$result = $this->serverRequest->getHeader('Content-Length');
802802
return $result ? (int) $result[0] : null;
@@ -831,7 +831,7 @@ public function getCookieParam($key, $default = null)
831831
*
832832
* @return string|null The serverRequest media type, minus content-type params
833833
*/
834-
public function getMediaType()
834+
public function getMediaType(): ?string
835835
{
836836
$contentType = $this->getContentType();
837837

@@ -851,9 +851,9 @@ public function getMediaType()
851851
*
852852
* Note: This method is not part of the PSR-7 standard.
853853
*
854-
* @return array
854+
* @return mixed[]
855855
*/
856-
public function getMediaTypeParams()
856+
public function getMediaTypeParams(): array
857857
{
858858
$contentType = $this->getContentType();
859859
$contentTypeParams = [];
@@ -904,9 +904,9 @@ public function getParam($key, $default = null)
904904
*
905905
* Note: This method is not part of the PSR-7 standard.
906906
*
907-
* @return array
907+
* @return mixed[]
908908
*/
909-
public function getParams()
909+
public function getParams(): array
910910
{
911911
$params = $this->getQueryParams();
912912
$postParams = $this->getParsedBody();
@@ -1006,7 +1006,7 @@ public function registerMediaTypeParser($mediaType, callable $callable)
10061006
*
10071007
* @return bool
10081008
*/
1009-
public function isDelete()
1009+
public function isDelete(): bool
10101010
{
10111011
return $this->isMethod('DELETE');
10121012
}
@@ -1018,7 +1018,7 @@ public function isDelete()
10181018
*
10191019
* @return bool
10201020
*/
1021-
public function isGet()
1021+
public function isGet(): bool
10221022
{
10231023
return $this->isMethod('GET');
10241024
}
@@ -1030,7 +1030,7 @@ public function isGet()
10301030
*
10311031
* @return bool
10321032
*/
1033-
public function isHead()
1033+
public function isHead(): bool
10341034
{
10351035
return $this->isMethod('HEAD');
10361036
}
@@ -1043,7 +1043,7 @@ public function isHead()
10431043
* @param string $method HTTP method
10441044
* @return bool
10451045
*/
1046-
public function isMethod($method)
1046+
public function isMethod($method): bool
10471047
{
10481048
return $this->serverRequest->getMethod() === $method;
10491049
}
@@ -1055,7 +1055,7 @@ public function isMethod($method)
10551055
*
10561056
* @return bool
10571057
*/
1058-
public function isOptions()
1058+
public function isOptions(): bool
10591059
{
10601060
return $this->isMethod('OPTIONS');
10611061
}
@@ -1067,7 +1067,7 @@ public function isOptions()
10671067
*
10681068
* @return bool
10691069
*/
1070-
public function isPatch()
1070+
public function isPatch(): bool
10711071
{
10721072
return $this->isMethod('PATCH');
10731073
}
@@ -1079,7 +1079,7 @@ public function isPatch()
10791079
*
10801080
* @return bool
10811081
*/
1082-
public function isPost()
1082+
public function isPost(): bool
10831083
{
10841084
return $this->isMethod('POST');
10851085
}
@@ -1091,7 +1091,7 @@ public function isPost()
10911091
*
10921092
* @return bool
10931093
*/
1094-
public function isPut()
1094+
public function isPut(): bool
10951095
{
10961096
return $this->isMethod('PUT');
10971097
}
@@ -1103,7 +1103,7 @@ public function isPut()
11031103
*
11041104
* @return bool
11051105
*/
1106-
public function isXhr()
1106+
public function isXhr(): bool
11071107
{
11081108
return $this->serverRequest->getHeaderLine('X-Requested-With') === 'XMLHttpRequest';
11091109
}

0 commit comments

Comments
 (0)