diff --git a/stubs/core.stub b/stubs/core.stub index a4851141091..9a4d8a711ce 100644 --- a/stubs/core.stub +++ b/stubs/core.stub @@ -389,6 +389,11 @@ function abs($num) {} */ function get_defined_constants(bool $categorize = false): array {} +/** + * @return ($associative is false ? list|false : array>|false) + */ +function get_headers(string $url, bool $associative = false, ?resource $context = null): array|false {} + /** * @param array $long_options * @param mixed $rest_index diff --git a/tests/PHPStan/Analyser/nsrt/get_headers.php b/tests/PHPStan/Analyser/nsrt/get_headers.php new file mode 100644 index 00000000000..eb382a99773 --- /dev/null +++ b/tests/PHPStan/Analyser/nsrt/get_headers.php @@ -0,0 +1,9 @@ +|false', get_headers('http://example.com')); +assertType('array|string>|false', get_headers('http://example.com', true)); +assertType('list|false', get_headers('http://example.com', false));