Skip to content

Commit 8f3930e

Browse files
Add get_headers stub (#5140)
1 parent 7af5078 commit 8f3930e

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

stubs/core.stub

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,11 @@ function abs($num) {}
389389
*/
390390
function get_defined_constants(bool $categorize = false): array {}
391391

392+
/**
393+
* @return ($associative is false ? list<string>|false : array<int|string, string|list<string>>|false)
394+
*/
395+
function get_headers(string $url, bool $associative = false, ?resource $context = null): array|false {}
396+
392397
/**
393398
* @param array<string> $long_options
394399
* @param mixed $rest_index
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php declare(strict_types = 1);
2+
3+
namespace Bug13835;
4+
5+
use function PHPStan\Testing\assertType;
6+
7+
assertType('list<string>|false', get_headers('http://example.com'));
8+
assertType('array<int|string, list<string>|string>|false', get_headers('http://example.com', true));
9+
assertType('list<string>|false', get_headers('http://example.com', false));

0 commit comments

Comments
 (0)