diff --git a/lib/Service/CurlService.php b/lib/Service/CurlService.php index c864bc14..b10afa7c 100644 --- a/lib/Service/CurlService.php +++ b/lib/Service/CurlService.php @@ -30,6 +30,7 @@ declare(strict_types=1); namespace OCA\Social\Service; +use CurlHandle; use Exception; use OCA\Social\AP; use OCA\Social\Exceptions\HostMetaException; @@ -386,9 +387,9 @@ class CurlService { /** * @param Request $request * - * @return resource + * @return CurlHandle */ - private function initRequest(Request $request) { + private function initRequest(Request $request): CurlHandle { $curl = $this->generateCurlRequest($request); $this->initRequestHeaders($curl, $request); @@ -404,7 +405,8 @@ class CurlService { curl_setopt($curl, CURLOPT_BUFFERSIZE, 128); curl_setopt($curl, CURLOPT_NOPROGRESS, false); - curl_setopt($curl, CURLOPT_PROGRESSFUNCTION, + curl_setopt( + $curl, CURLOPT_PROGRESSFUNCTION, /** * @param $downloadSize * @param int $downloaded @@ -430,8 +432,10 @@ class CurlService { /** * @param Request $request + * + * @return CurlHandle */ - private function generateCurlRequest(Request $request) { + private function generateCurlRequest(Request $request): CurlHandle { $url = $request->getUsedProtocol() . '://' . $request->getHost() . $request->getParsedUrl(); if ($request->getType() !== Request::TYPE_GET) { $curl = curl_init($url); @@ -467,10 +471,10 @@ class CurlService { } /** - * @param resource $curl + * @param CurlHandle $curl * @param Request $request */ - private function initRequestHeaders($curl, Request $request) { + private function initRequestHeaders(CurlHandle $curl, Request $request): void { $headers = []; foreach ($request->getHeaders() as $name => $value) { $headers[] = $name . ': ' . $value; @@ -481,14 +485,14 @@ class CurlService { /** - * @param resource $curl + * @param CurlHandle $curl * @param Request $request * * @throws RequestContentException * @throws RequestServerException * @throws RequestNetworkException */ - private function parseRequestResult($curl, Request $request): void { + private function parseRequestResult(CurlHandle $curl, Request $request): void { $this->parseRequestResultCurl($curl, $request); $code = curl_getinfo($curl, CURLINFO_HTTP_CODE); @@ -499,12 +503,12 @@ class CurlService { /** - * @param resource $curl + * @param CurlHandle $curl * @param Request $request * * @throws RequestNetworkException */ - private function parseRequestResultCurl($curl, Request $request) { + private function parseRequestResultCurl(CurlHandle $curl, Request $request): void { $errno = curl_errno($curl); if ($errno > 0) { throw new RequestNetworkException( diff --git a/psalm.xml b/psalm.xml index ebb13347..eb6d9e11 100644 --- a/psalm.xml +++ b/psalm.xml @@ -26,6 +26,7 @@ + @@ -35,6 +36,7 @@ + diff --git a/tests/psalm-baseline.xml b/tests/psalm-baseline.xml index af53a7c5..426fb3b3 100644 --- a/tests/psalm-baseline.xml +++ b/tests/psalm-baseline.xml @@ -1,89 +1,72 @@ - + - - ['a', 'p', 'span', 'br'] + + - + Acore - + ACore ACore - + $parent - - $this->parent + + parent]]> - + $v === null - + $v === 0 $v === 0 - - - $object = $cache->getItem($this->getObjectId()) - - - + dropTable hasTable hasTable - + + Server::get(Connection::class) + Server::get(Connection::class) + - - (bool)($this->cache->get(self::CACHE_PREFIX . 'wellknown') === 'true') + + cache->get(self::CACHE_PREFIX . 'wellknown') === 'true')]]> - + ClientException - - $this->configService->getAppValue(ConfigService::SOCIAL_MAX_SIZE) + + configService->getAppValue(ConfigService::SOCIAL_MAX_SIZE)]]> - - is_array($result) - - - $this->maxDownloadSizeReached === true + + maxDownloadSizeReached === true]]> - - - setAttributedTo - setContent - - - is_array($_FILES['attachments']['error']) + + - + !$type !$type !$type - + $varr[0] !== null - - - $host === null - $username === null - $username === null - -