From 8b01176f60ee85582d467ca9b66aa8fbecd3e54d Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 19 Oct 2017 13:50:27 +0200 Subject: [PATCH] add more typehints Signed-off-by: Robin Appelman --- lib/private/Remote/Api/ApiBase.php | 1 + lib/private/Remote/Api/ApiCollection.php | 3 +++ lib/private/Remote/Api/ApiFactory.php | 1 + lib/private/Remote/Instance.php | 9 +++++++++ lib/private/Remote/InstanceFactory.php | 2 ++ lib/public/Remote/IInstanceFactory.php | 2 +- 6 files changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/private/Remote/Api/ApiBase.php b/lib/private/Remote/Api/ApiBase.php index 64153a9311..70292a977f 100644 --- a/lib/private/Remote/Api/ApiBase.php +++ b/lib/private/Remote/Api/ApiBase.php @@ -57,6 +57,7 @@ class ApiBase { * @param array $query * @param array $headers * @return resource|string + * @throws \InvalidArgumentException */ protected function request($method, $url, array $body = [], array $query = [], array $headers = []) { $fullUrl = trim($this->instance->getFullUrl(), '/') . '/' . $url; diff --git a/lib/private/Remote/Api/ApiCollection.php b/lib/private/Remote/Api/ApiCollection.php index 41b1bac0e0..5ce97621db 100644 --- a/lib/private/Remote/Api/ApiCollection.php +++ b/lib/private/Remote/Api/ApiCollection.php @@ -28,8 +28,11 @@ use OCP\Remote\ICredentials; use OCP\Remote\IInstance; class ApiCollection implements IApiCollection { + /** @var IInstance */ private $instance; + /** @var ICredentials */ private $credentials; + /** @var IClientService */ private $clientService; public function __construct(IInstance $instance, ICredentials $credentials, IClientService $clientService) { diff --git a/lib/private/Remote/Api/ApiFactory.php b/lib/private/Remote/Api/ApiFactory.php index ea084c188f..19b8e8eb50 100644 --- a/lib/private/Remote/Api/ApiFactory.php +++ b/lib/private/Remote/Api/ApiFactory.php @@ -28,6 +28,7 @@ use OCP\Remote\ICredentials; use OCP\Remote\IInstance; class ApiFactory implements IApiFactory { + /** @var IClientService */ private $clientService; public function __construct(IClientService $clientService) { diff --git a/lib/private/Remote/Instance.php b/lib/private/Remote/Instance.php index ab0081d86c..0ed301ae86 100644 --- a/lib/private/Remote/Instance.php +++ b/lib/private/Remote/Instance.php @@ -39,6 +39,7 @@ class Instance implements IInstance { /** @var IClientService */ private $clientService; + /** @var array|null */ private $status; /** @@ -93,6 +94,10 @@ class Instance implements IInstance { return $status['installed'] && !$status['maintenance']; } + /** + * @return array + * @throws NotFoundException + */ private function getStatus() { if ($this->status) { return $this->status; @@ -120,6 +125,10 @@ class Instance implements IInstance { return $status; } + /** + * @param string $url + * @return bool|string + */ private function downloadStatus($url) { try { $request = $this->clientService->newClient()->get($url); diff --git a/lib/private/Remote/InstanceFactory.php b/lib/private/Remote/InstanceFactory.php index 3b99bc6182..72baa43361 100644 --- a/lib/private/Remote/InstanceFactory.php +++ b/lib/private/Remote/InstanceFactory.php @@ -27,7 +27,9 @@ use OCP\ICache; use OCP\Remote\IInstanceFactory; class InstanceFactory implements IInstanceFactory { + /** @var ICache */ private $cache; + /** @var IClientService */ private $clientService; public function __construct(ICache $cache, IClientService $clientService) { diff --git a/lib/public/Remote/IInstanceFactory.php b/lib/public/Remote/IInstanceFactory.php index 22ac85563f..6aae463a89 100644 --- a/lib/public/Remote/IInstanceFactory.php +++ b/lib/public/Remote/IInstanceFactory.php @@ -26,7 +26,7 @@ namespace OCP\Remote; */ interface IInstanceFactory { /** - * @param $url + * @param string $url * @return IInstance * * @since 13.0.0