From e1a13f1ad298182d17a5cc9a78d516f282d328be Mon Sep 17 00:00:00 2001 From: Timothy J Warren Date: Wed, 17 Jan 2018 16:33:57 -0500 Subject: [PATCH] More code style fixes --- src/Di/ContainerAware.php | 4 ++-- src/Di/ContainerInterface.php | 6 +++--- src/Exception/DoubleRenderException.php | 2 +- src/Type/StringType.php | 2 +- src/View/HttpView.php | 2 ++ src/View/JsonView.php | 5 ++++- 6 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/Di/ContainerAware.php b/src/Di/ContainerAware.php index 60a164f..e65918a 100644 --- a/src/Di/ContainerAware.php +++ b/src/Di/ContainerAware.php @@ -32,9 +32,9 @@ trait ContainerAware { * Set the container for the current object * * @param ContainerInterface $container - * @return $this + * @return self */ - public function setContainer(ContainerInterface $container) + public function setContainer(ContainerInterface $container): self { $this->container = $container; return $this; diff --git a/src/Di/ContainerInterface.php b/src/Di/ContainerInterface.php index 5483235..7515cdf 100644 --- a/src/Di/ContainerInterface.php +++ b/src/Di/ContainerInterface.php @@ -32,8 +32,8 @@ interface ContainerInterface { * Finds an entry of the container by its identifier and returns it. * * @param string $id Identifier of the entry to look for. - * @throws NotFoundException No entry was found for this identifier. - * @throws ContainerException Error while retrieving the entry. + * @throws Exception\NotFoundException No entry was found for this identifier. + * @throws Exception\ContainerException Error while retrieving the entry. * @return mixed Entry. */ public function get($id); @@ -95,5 +95,5 @@ interface ContainerInterface { * @param string $id The logger to retrieve * @return LoggerInterface|null */ - public function getLogger(string $id = 'default'); + public function getLogger(string $id = 'default'): ?LoggerInterface; } \ No newline at end of file diff --git a/src/Exception/DoubleRenderException.php b/src/Exception/DoubleRenderException.php index 43327c6..880cc0a 100644 --- a/src/Exception/DoubleRenderException.php +++ b/src/Exception/DoubleRenderException.php @@ -29,7 +29,7 @@ class DoubleRenderException extends LogicException { * * @param string $message * @param int $code - * @param null $previous + * @param Exception|null $previous */ public function __construct(string $message = 'A view can only be rendered once, because headers can only be sent once.', int $code = 0, Exception $previous = NULL) { diff --git a/src/Type/StringType.php b/src/Type/StringType.php index abc72f5..f267f09 100644 --- a/src/Type/StringType.php +++ b/src/Type/StringType.php @@ -24,7 +24,7 @@ use Stringy\Stringy; class StringType extends Stringy { /** - * See if two strings match, despite being delemeted differently, + * See if two strings match, despite being delimited differently, * such as camelCase, PascalCase, kebab-case, or snake_case. * * @param string $strToMatch diff --git a/src/View/HttpView.php b/src/View/HttpView.php index dfed19a..4b6b823 100644 --- a/src/View/HttpView.php +++ b/src/View/HttpView.php @@ -62,6 +62,7 @@ class HttpView extends BaseView { * Set the status code of the request * * @param int $code + * @throws \InvalidArgumentException * @return HttpView */ public function setStatusCode(int $code): HttpView @@ -88,6 +89,7 @@ class HttpView extends BaseView { * Send the appropriate response * * @throws DoubleRenderException + * @throws \InvalidArgumentException * @return void */ protected function output(): void diff --git a/src/View/JsonView.php b/src/View/JsonView.php index b3aa61a..b9cadd6 100644 --- a/src/View/JsonView.php +++ b/src/View/JsonView.php @@ -35,11 +35,14 @@ class JsonView extends HttpView { * Set the output string * * @param mixed $string + * @throws \InvalidArgumentException + * @throws \RuntimeException + * @throws \Aviat\Ion\JsonException * @return ViewInterface */ public function setOutput($string): ViewInterface { - if ( ! is_string($string)) + if ( ! \is_string($string)) { $string = Json::encode($string); }