diff --git a/src/Conversation/ClientFactory.php b/src/Conversation/ClientFactory.php index aab7d76d..ade41cc8 100644 --- a/src/Conversation/ClientFactory.php +++ b/src/Conversation/ClientFactory.php @@ -5,7 +5,6 @@ use Psr\Container\ContainerInterface; use Vonage\Client\APIResource; use Vonage\Client\Credentials\Handler\KeypairHandler; -use Vonage\Conversation\Client; class ClientFactory { diff --git a/src/Conversation/ConversationObjects/Channel.php b/src/Conversation/ConversationObjects/Channel.php index 17992b71..d585d653 100644 --- a/src/Conversation/ConversationObjects/Channel.php +++ b/src/Conversation/ConversationObjects/Channel.php @@ -4,7 +4,6 @@ namespace Vonage\Conversation\ConversationObjects; -use phpDocumentor\Reflection\Types\This; use Vonage\Entity\Hydrator\ArrayHydrateInterface; class Channel implements ArrayHydrateInterface diff --git a/src/Conversation/ConversationObjects/CreateConversationRequest.php b/src/Conversation/ConversationObjects/CreateConversationRequest.php index 7ce31658..64e70992 100644 --- a/src/Conversation/ConversationObjects/CreateConversationRequest.php +++ b/src/Conversation/ConversationObjects/CreateConversationRequest.php @@ -105,7 +105,7 @@ public function setImageUrl(?string $imageUrl): CreateConversationRequest return $this; } - public function fromArray(array $data) + public function fromArray(array $data): void { if (isset($data['name'])) { $this->setName($data['name']); diff --git a/src/Conversion/Client.php b/src/Conversion/Client.php index 2a4ae90d..335eed33 100644 --- a/src/Conversion/Client.php +++ b/src/Conversion/Client.php @@ -13,7 +13,6 @@ use Vonage\Client\Exception as ClientException; use function http_build_query; -use function is_null; use function json_decode; class Client implements ClientAwareInterface, APIClient @@ -91,13 +90,10 @@ protected function sendConversion($type, $message_id, $delivered, $timestamp = n } } - /** - * @return ClientException\Exception|ClientException\Request|ClientException\Server - */ - protected function getException(ResponseInterface $response) + protected function getException(ResponseInterface $response): ClientException\Exception|ClientException\Request|ClientException\Server { $body = json_decode($response->getBody()->getContents(), true); - $status = (int)$response->getStatusCode(); + $status = $response->getStatusCode(); if ($status === 402) { $e = new ClientException\Request('This endpoint may need activating on your account. ' . diff --git a/src/Conversion/ClientFactory.php b/src/Conversion/ClientFactory.php index 291f828c..48c7b323 100644 --- a/src/Conversion/ClientFactory.php +++ b/src/Conversion/ClientFactory.php @@ -9,11 +9,10 @@ use Vonage\Client\Credentials\Handler\BasicHandler; /** - * @todo Finish this Namespace + * @TODO Finish this Namespace */ class ClientFactory { - public function __invoke(ContainerInterface $container): Client { /** @var APIResource $api */ diff --git a/src/Entity/Filter/DateFilter.php b/src/Entity/Filter/DateFilter.php index fb242e28..6360ab03 100644 --- a/src/Entity/Filter/DateFilter.php +++ b/src/Entity/Filter/DateFilter.php @@ -13,8 +13,8 @@ class DateFilter implements FilterInterface { public const FORMAT = 'Y:m:d:H:i:s'; - protected $start; - protected $end; + protected DateTime $start; + protected DateTime $end; public function __construct(DateTime $start, DateTime $end) { @@ -27,9 +27,6 @@ public function __construct(DateTime $start, DateTime $end) } } - /** - * @return string[] - */ public function getQuery(): array { return [ diff --git a/src/Entity/Hydrator/ArrayHydrator.php b/src/Entity/Hydrator/ArrayHydrator.php index d557a4db..36b49b9b 100644 --- a/src/Entity/Hydrator/ArrayHydrator.php +++ b/src/Entity/Hydrator/ArrayHydrator.php @@ -6,10 +6,7 @@ class ArrayHydrator implements HydratorInterface { - /** - * @var ArrayHydrateInterface - */ - protected $prototype; + protected ArrayHydrateInterface $prototype; public function hydrate(array $data): ArrayHydrateInterface { @@ -19,9 +16,6 @@ public function hydrate(array $data): ArrayHydrateInterface return $object; } - /** - * @param $object - */ public function hydrateObject(array $data, $object) { $object->fromArray($data); diff --git a/src/Entity/Hydrator/ConstructorHydrator.php b/src/Entity/Hydrator/ConstructorHydrator.php index 80c2bb50..073fa0a1 100644 --- a/src/Entity/Hydrator/ConstructorHydrator.php +++ b/src/Entity/Hydrator/ConstructorHydrator.php @@ -6,21 +6,14 @@ class ConstructorHydrator implements HydratorInterface { - /** - * Class to create - * @var string - */ - protected $prototype; + protected string $prototype; - public function hydrate(array $data) + public function hydrate(array $data): mixed { $className = $this->prototype; return new $className($data); } - /** - * @param $object - */ public function hydrateObject(array $data, $object): never { throw new \RuntimeException('Constructor Hydration can not happen on an existing object'); diff --git a/src/Entity/Hydrator/HydratorInterface.php b/src/Entity/Hydrator/HydratorInterface.php index 7ec802cc..52143f07 100644 --- a/src/Entity/Hydrator/HydratorInterface.php +++ b/src/Entity/Hydrator/HydratorInterface.php @@ -13,8 +13,6 @@ public function hydrate(array $data); /** * Hydrate an existing object created outside of the hydrator - * - * @param $object */ public function hydrateObject(array $data, $object); } diff --git a/src/Entity/IterableAPICollection.php b/src/Entity/IterableAPICollection.php index 3881f80b..fd2a42a4 100644 --- a/src/Entity/IterableAPICollection.php +++ b/src/Entity/IterableAPICollection.php @@ -15,6 +15,8 @@ use Vonage\Client\ClientAwareInterface; use Vonage\Client\ClientAwareTrait; use Vonage\Client\Exception as ClientException; +use Vonage\Client\Exception\Exception; +use Vonage\Client\Exception\Server; use Vonage\Entity\Filter\EmptyFilter; use Vonage\Entity\Filter\FilterInterface; @@ -26,7 +28,6 @@ use function is_null; use function json_decode; use function md5; -use function strpos; /** * Common code for iterating over a collection, and using the collection class to discover the API path. @@ -402,7 +403,7 @@ public function setPage($index): self /** * @return int|mixed */ - public function getPage() + public function getPage(): mixed { if (isset($this->pageData)) { if (array_key_exists('page', $this->pageData)) { @@ -459,11 +460,6 @@ public function getSize() throw new RuntimeException('size not set'); } - /** - * @param $size - * - * @return $this - */ public function setSize($size): self { $this->size = (int)$size; @@ -473,8 +469,6 @@ public function setSize($size): self /** * Filters reduce to query params and include paging settings. - * - * @return $this */ public function setFilter(FilterInterface $filter): self { @@ -494,8 +488,6 @@ public function getFilter(): FilterInterface /** * Fetch a page using the current filter if no query is provided. * - * @param $absoluteUri - * * @throws ClientException\Exception * @throws ClientException\Request * @throws ClientException\Server @@ -564,12 +556,7 @@ protected function fetchPage($absoluteUri): void } } - /** - * @throws ClientException\Exception - * - * @return ClientException\Request|ClientException\Server - */ - protected function getException(ResponseInterface $response) + protected function getException(ResponseInterface $response): ClientException\Request|ClientException\Server { $response->getBody()->rewind(); $body = json_decode($response->getBody()->getContents(), true); @@ -599,9 +586,6 @@ public function getAutoAdvance(): bool return $this->autoAdvance; } - /** - * @return $this - */ public function setAutoAdvance(bool $autoAdvance): self { $this->autoAdvance = $autoAdvance; @@ -614,9 +598,6 @@ public function getNaiveCount(): bool return $this->naiveCount; } - /** - * @return $this - */ public function setNaiveCount(bool $naiveCount): self { $this->naiveCount = $naiveCount; @@ -643,9 +624,6 @@ public function setIndex(?int $index): IterableAPICollection return $this; } - /** - * @return bool - */ public function hasPagination(): bool { return $this->hasPagination; diff --git a/src/Entity/Psr7Trait.php b/src/Entity/Psr7Trait.php index 596563c8..f78144a6 100644 --- a/src/Entity/Psr7Trait.php +++ b/src/Entity/Psr7Trait.php @@ -9,7 +9,6 @@ use Vonage\Entity\Hydrator\ArrayHydrateInterface; use function array_merge; -use function get_class; use function is_array; use function json_decode; use function method_exists; @@ -23,15 +22,8 @@ */ trait Psr7Trait { - /** - * @var RequestInterface - */ - protected $request; - - /** - * @var ResponseInterface - */ - protected $response; + protected RequestInterface $request; + protected ResponseInterface $response; /** * @deprecated See error