From c6c4f812c84afebe8e8dd2344ba2aabfc10130c4 Mon Sep 17 00:00:00 2001 From: kenjis Date: Thu, 11 Apr 2024 18:02:04 +0900 Subject: [PATCH] docs: add array types --- phpstan-baseline.php | 50 --------------------------- system/HTTP/CURLRequest.php | 2 ++ tests/system/HTTP/CURLRequestTest.php | 3 ++ 3 files changed, 5 insertions(+), 50 deletions(-) diff --git a/phpstan-baseline.php b/phpstan-baseline.php index 61841f81795a..3da30e816317 100644 --- a/phpstan-baseline.php +++ b/phpstan-baseline.php @@ -5336,11 +5336,6 @@ 'count' => 10, 'path' => __DIR__ . '/system/HTTP/CURLRequest.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\HTTP\\\\CURLRequest\\:\\:__construct\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/system/HTTP/CURLRequest.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\HTTP\\\\CURLRequest\\:\\:applyBody\\(\\) has parameter \\$curlOptions with no value type specified in iterable type array\\.$#', 'count' => 1, @@ -12901,36 +12896,6 @@ 'count' => 1, 'path' => __DIR__ . '/tests/system/HTTP/CLIRequestTest.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Assigning \'10\' directly on offset \'HTTP_CONTENT_LENGTH\' of \\$_SERVER is discouraged\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/tests/system/HTTP/CURLRequestDoNotShareOptionsTest.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Assigning \'en\\-US\' directly on offset \'HTTP_ACCEPT_LANGUAGE\' of \\$_SERVER is discouraged\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/tests/system/HTTP/CURLRequestDoNotShareOptionsTest.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Assigning \'gzip, deflate, br\' directly on offset \'HTTP_ACCEPT_ENCODING\' of \\$_SERVER is discouraged\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/tests/system/HTTP/CURLRequestDoNotShareOptionsTest.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Assigning \'site1\\.com\' directly on offset \'HTTP_HOST\' of \\$_SERVER is discouraged\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/tests/system/HTTP/CURLRequestDoNotShareOptionsTest.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\HTTP\\\\CURLRequestDoNotShareOptionsTest\\:\\:getRequest\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/tests/system/HTTP/CURLRequestDoNotShareOptionsTest.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Access to an undefined property CodeIgniter\\\\HTTP\\\\CURLRequest\\:\\:\\$curl_options\\.$#', - 'count' => 39, - 'path' => __DIR__ . '/tests/system/HTTP/CURLRequestTest.php', -]; $ignoreErrors[] = [ 'message' => '#^Assigning \'10\' directly on offset \'HTTP_CONTENT_LENGTH\' of \\$_SERVER is discouraged\\.$#', 'count' => 1, @@ -12951,21 +12916,6 @@ 'count' => 1, 'path' => __DIR__ . '/tests/system/HTTP/CURLRequestTest.php', ]; -$ignoreErrors[] = [ - 'message' => '#^Call to an undefined method CodeIgniter\\\\HTTP\\\\CURLRequest\\:\\:setOutput\\(\\)\\.$#', - 'count' => 4, - 'path' => __DIR__ . '/tests/system/HTTP/CURLRequestTest.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\HTTP\\\\CURLRequestTest\\:\\:getRequest\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/tests/system/HTTP/CURLRequestTest.php', -]; -$ignoreErrors[] = [ - 'message' => '#^Method CodeIgniter\\\\HTTP\\\\CURLRequestTest\\:\\:getRequest\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/tests/system/HTTP/CURLRequestTest.php', -]; $ignoreErrors[] = [ 'message' => '#^Method CodeIgniter\\\\HTTP\\\\ContentSecurityPolicyTest\\:\\:work\\(\\) has no return type specified\\.$#', 'count' => 1, diff --git a/system/HTTP/CURLRequest.php b/system/HTTP/CURLRequest.php index 3040f29b9feb..4b1c9c625399 100644 --- a/system/HTTP/CURLRequest.php +++ b/system/HTTP/CURLRequest.php @@ -107,6 +107,8 @@ class CURLRequest extends OutgoingRequest * - baseURI * - timeout * - any other request options to use as defaults. + * + * @param array $options */ public function __construct(App $config, URI $uri, ?ResponseInterface $response = null, array $options = []) { diff --git a/tests/system/HTTP/CURLRequestTest.php b/tests/system/HTTP/CURLRequestTest.php index 722fe1270c02..1f53a57a8465 100644 --- a/tests/system/HTTP/CURLRequestTest.php +++ b/tests/system/HTTP/CURLRequestTest.php @@ -41,6 +41,9 @@ protected function setUp(): void $this->request = $this->getRequest(); } + /** + * @param array $options + */ protected function getRequest(array $options = []): MockCURLRequest { $uri = isset($options['base_uri']) ? new URI($options['base_uri']) : new URI();