- added type-hints
- added returned type-hints in interface (I checked all)
This commit is contained in:
Roland Häder 2022-06-19 13:59:58 +02:00
parent c0d7f8944d
commit bff57bb030
Signed by: roland
GPG key ID: C82EDE5DDFA0BA77
6 changed files with 20 additions and 20 deletions

View file

@ -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;
}

View file

@ -1008,7 +1008,7 @@ class Post
/**
* @return string
*/
private function getRedirectUrl()
private function getRedirectUrl(): string
{
return $this->redirect_url;
}

View file

@ -110,7 +110,7 @@ class ContactResult implements IResult
/**
* @return string
*/
public function getUrl()
public function getUrl(): string
{
return $this->url;
}

View file

@ -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;

View file

@ -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 = [

View file

@ -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]);