Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions stubs/core.stub
Original file line number Diff line number Diff line change
Expand Up @@ -318,3 +318,12 @@ function abs($num) {}
* @return ($categorize is true ? array<string, array<string, mixed>> : array<string, mixed>)
*/
function get_defined_constants(bool $categorize = false): array {}

/**
* @param array<string> $long_options
* @param mixed $rest_index
* @param-out positive-int $rest_index
* @return __benevolent<array<string,string>|array<string,false>|array<string,list<mixed>>|false>
*/
function getopt(string $short_options, array $long_options = [], &$rest_index = null) {}

3 changes: 2 additions & 1 deletion tests/PHPStan/Analyser/nsrt/getopt.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
use function getopt;
use function PHPStan\Testing\assertType;

$opts = getopt("ab:c::", ["longopt1", "longopt2:", "longopt3::"]);
$opts = getopt("ab:c::", ["longopt1", "longopt2:", "longopt3::"], $restIndex);
assertType('(array<string, list<mixed>|string|false>|false)', $opts);
assertType('int<1, max>', $restIndex);
Loading