diff --git a/src/Type/Php/CurlGetinfoFunctionDynamicReturnTypeExtension.php b/src/Type/Php/CurlGetinfoFunctionDynamicReturnTypeExtension.php index c21dfee1640..c20cd7c1b4f 100644 --- a/src/Type/Php/CurlGetinfoFunctionDynamicReturnTypeExtension.php +++ b/src/Type/Php/CurlGetinfoFunctionDynamicReturnTypeExtension.php @@ -147,6 +147,7 @@ public function getTypeFromFunctionCall(FunctionReflection $functionReflection, 'CURLINFO_HTTPAUTH_USED' => $integerFalseType, 'CURLINFO_PROXYAUTH_USED' => $integerFalseType, 'CURLINFO_CONN_ID' => $integerFalseType, + 'CURLINFO_SIZE_DELIVERED' => $integerFalseType, ]; foreach ($componentTypesPairedConstants as $constantName => $type) { @@ -193,6 +194,7 @@ private function createAllComponentsReturnType(): Type 'pretransfer_time' => $floatType, 'size_upload' => $floatType, 'size_download' => $floatType, + 'size_delivered' => $integerType, 'speed_download' => $floatType, 'speed_upload' => $floatType, 'download_content_length' => $floatType, diff --git a/tests/PHPStan/Analyser/nsrt/curl_getinfo.php b/tests/PHPStan/Analyser/nsrt/curl_getinfo.php index 94750ddaccb..2c37238a0c1 100644 --- a/tests/PHPStan/Analyser/nsrt/curl_getinfo.php +++ b/tests/PHPStan/Analyser/nsrt/curl_getinfo.php @@ -9,7 +9,7 @@ class Foo { public function bar() { - $curlGetInfoType = '(array{url: string, content_type: string|null, http_code: int, header_size: int, request_size: int, filetime: int, ssl_verify_result: int, redirect_count: int, total_time: float, namelookup_time: float, connect_time: float, pretransfer_time: float, size_upload: float, size_download: float, speed_download: float, speed_upload: float, download_content_length: float, upload_content_length: float, starttransfer_time: float, redirect_time: float, redirect_url: string, primary_ip: string, certinfo: list>, primary_port: int, local_ip: string, local_port: int, http_version: int, protocol: int, ssl_verifyresult: int, scheme: string, appconnect_time_us: int, queue_time_us: int, connect_time_us: int, namelookup_time_us: int, pretransfer_time_us: int, redirect_time_us: int, starttransfer_time_us: int, posttransfer_time_us: int, total_time_us: int, request_header: string, effective_method: string, capath: string, cainfo: string, used_proxy: int, httpauth_used: int, proxyauth_used: int, conn_id: int}|false)'; + $curlGetInfoType = '(array{url: string, content_type: string|null, http_code: int, header_size: int, request_size: int, filetime: int, ssl_verify_result: int, redirect_count: int, total_time: float, namelookup_time: float, connect_time: float, pretransfer_time: float, size_upload: float, size_download: float, size_delivered: int, speed_download: float, speed_upload: float, download_content_length: float, upload_content_length: float, starttransfer_time: float, redirect_time: float, redirect_url: string, primary_ip: string, certinfo: list>, primary_port: int, local_ip: string, local_port: int, http_version: int, protocol: int, ssl_verifyresult: int, scheme: string, appconnect_time_us: int, queue_time_us: int, connect_time_us: int, namelookup_time_us: int, pretransfer_time_us: int, redirect_time_us: int, starttransfer_time_us: int, posttransfer_time_us: int, total_time_us: int, request_header: string, effective_method: string, capath: string, cainfo: string, used_proxy: int, httpauth_used: int, proxyauth_used: int, conn_id: int}|false)'; $handle = new CurlHandle(); assertType('mixed', curl_getinfo()); diff --git a/tests/PHPStan/Analyser/nsrt/curl_getinfo_8.6.php b/tests/PHPStan/Analyser/nsrt/curl_getinfo_8.6.php new file mode 100644 index 00000000000..c622cd60b0a --- /dev/null +++ b/tests/PHPStan/Analyser/nsrt/curl_getinfo_8.6.php @@ -0,0 +1,15 @@ += 8.6 + +namespace CurlGetinfo86; + +use CurlHandle; +use function PHPStan\Testing\assertType; + +class Foo +{ + public function bar() + { + $handle = new CurlHandle(); + assertType('int|false', curl_getinfo($handle, CURLINFO_SIZE_DELIVERED)); + } +}