From bff57bb030f84bc785fcb9420b95b2b472d924c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20H=C3=A4der?= Date: Sun, 19 Jun 2022 13:59:58 +0200 Subject: [PATCH] Changes: - added type-hints - added returned type-hints in interface (I checked all) --- .../Capability/ICanHandleHttpResponses.php | 28 +++++++++---------- src/Object/Post.php | 2 +- src/Object/Search/ContactResult.php | 2 +- src/Util/EMailer/MailBuilder.php | 4 +-- src/Util/Mimetype.php | 2 +- src/Util/ParseUrl.php | 2 +- 6 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/Network/HTTPClient/Capability/ICanHandleHttpResponses.php b/src/Network/HTTPClient/Capability/ICanHandleHttpResponses.php index e2db2f50fc..e8cc43a3c7 100644 --- a/src/Network/HTTPClient/Capability/ICanHandleHttpResponses.php +++ b/src/Network/HTTPClient/Capability/ICanHandleHttpResponses.php @@ -33,14 +33,14 @@ interface ICanHandleHttpResponses * * @return string The Return Code */ - public function getReturnCode(); + public function getReturnCode(): string; /** * Returns the Content Type * * @return string the Content Type */ - public function getContentType(); + public function getContentType(): string; /** * Returns the headers @@ -51,7 +51,7 @@ interface ICanHandleHttpResponses *@see MessageInterface::getHeader() * */ - public function getHeader(string $header); + public function getHeader(string $header): array; /** * Returns all headers @@ -59,7 +59,7 @@ interface ICanHandleHttpResponses * * @return string[][] */ - public function getHeaders(); + public function getHeaders(): array; /** * Check if a specified header exists @@ -69,7 +69,7 @@ interface ICanHandleHttpResponses * * @return boolean "true" if header exists */ - public function inHeader(string $field); + public function inHeader(string $field): bool; /** * Returns the headers as an associated array @@ -78,47 +78,47 @@ interface ICanHandleHttpResponses * * @return string[][] associated header array */ - public function getHeaderArray(); + public function getHeaderArray(): array; /** * @return bool */ - public function isSuccess(); + public function isSuccess(): bool; /** * @return string */ - public function getUrl(); + public function getUrl(): string; /** * @return string */ - public function getRedirectUrl(); + public function getRedirectUrl(): string; /** * @see MessageInterface::getBody() * * @return string */ - public function getBody(); + public function getBody(): string; /** * @return boolean */ - public function isRedirectUrl(); + public function isRedirectUrl(): bool; /** * @return integer */ - public function getErrorNumber(); + public function getErrorNumber(): int; /** * @return string */ - public function getError(); + public function getError(): string; /** * @return boolean */ - public function isTimeout(); + public function isTimeout(): bool; } diff --git a/src/Object/Post.php b/src/Object/Post.php index fec3b3f2b3..4c5aa8a21b 100644 --- a/src/Object/Post.php +++ b/src/Object/Post.php @@ -1008,7 +1008,7 @@ class Post /** * @return string */ - private function getRedirectUrl() + private function getRedirectUrl(): string { return $this->redirect_url; } diff --git a/src/Object/Search/ContactResult.php b/src/Object/Search/ContactResult.php index dabae1f4d3..8895f0ce0b 100644 --- a/src/Object/Search/ContactResult.php +++ b/src/Object/Search/ContactResult.php @@ -110,7 +110,7 @@ class ContactResult implements IResult /** * @return string */ - public function getUrl() + public function getUrl(): string { return $this->url; } diff --git a/src/Util/EMailer/MailBuilder.php b/src/Util/EMailer/MailBuilder.php index 6e892cf254..e6b745b979 100644 --- a/src/Util/EMailer/MailBuilder.php +++ b/src/Util/EMailer/MailBuilder.php @@ -164,7 +164,7 @@ abstract class MailBuilder * * @return string[][] */ - public function getHeaders() + public function getHeaders(): array { return $this->headers; } @@ -182,7 +182,7 @@ abstract class MailBuilder * @param string[][] $headers * @return $this */ - public function withHeaders(array $headers) + public function withHeaders(array $headers): MailBuilder { $this->headers = $headers; diff --git a/src/Util/Mimetype.php b/src/Util/Mimetype.php index d7a702d71c..ca57648771 100644 --- a/src/Util/Mimetype.php +++ b/src/Util/Mimetype.php @@ -29,7 +29,7 @@ class Mimetype * @param string $filename filename * @return mixed array or string */ - public static function getContentType($filename) + public static function getContentType(string $filename) { $mime_types = [ diff --git a/src/Util/ParseUrl.php b/src/Util/ParseUrl.php index abd9154da1..f4c78df8a5 100644 --- a/src/Util/ParseUrl.php +++ b/src/Util/ParseUrl.php @@ -59,7 +59,7 @@ class ParseUrl * @param string $accept content-type to accept * @return array content type */ - public static function getContentType(string $url, string $accept = HttpClientAccept::DEFAULT) + public static function getContentType(string $url, string $accept = HttpClientAccept::DEFAULT): array { $curlResult = DI::httpClient()->head($url, [HttpClientOptions::ACCEPT_CONTENT => $accept]);