Skip to content

Commit

Permalink
Merge pull request #7014 from kamil-tekiela/Fix-mysqli_fetch_-stubs
Browse files Browse the repository at this point in the history
  • Loading branch information
weirdan committed Nov 29, 2021
2 parents 28a7565 + 020c5f0 commit f1d47cc
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 28 deletions.
28 changes: 18 additions & 10 deletions dictionaries/CallMap.php
Expand Up @@ -8462,16 +8462,20 @@
'mysqli_error_list' => ['array', 'mysql'=>'mysqli'],
'mysqli_escape_string' => ['string', 'mysql'=>'mysqli', 'string'=>'string'],
'mysqli_execute' => ['bool', 'statement'=>'mysqli_stmt', 'params='=>'list<mixed>|null'],
'mysqli_fetch_all' => ['array', 'result'=>'mysqli_result', 'mode='=>'int'],
'mysqli_fetch_array' => ['array|false|null', 'result'=>'mysqli_result', 'mode='=>'int'],
'mysqli_fetch_assoc' => ['array<string,string>|false|null', 'result'=>'mysqli_result'],
'mysqli_fetch_all' => ['list<array<array-key,null|int|float|string>>', 'result'=>'mysqli_result', 'mode='=>'3'],
'mysqli_fetch_all\'1' => ['list<array<string,null|int|float|string>>', 'result'=>'mysqli_result', 'mode='=>'1'],
'mysqli_fetch_all\'2' => ['list<list<null|int|float|string>>', 'result'=>'mysqli_result', 'mode='=>'2'],
'mysqli_fetch_array' => ['array<array-key,null|int|float|string>|false|null', 'result'=>'mysqli_result', 'mode='=>'3'],
'mysqli_fetch_array\'1' => ['array<string,null|int|float|string>|false|null', 'result'=>'mysqli_result', 'mode='=>'1'],
'mysqli_fetch_array\'2' => ['list<null|int|float|string>|false|null', 'result'=>'mysqli_result', 'mode='=>'2'],
'mysqli_fetch_assoc' => ['array<string,null|int|float|string>|false|null', 'result'=>'mysqli_result'],
'mysqli_fetch_column' => ['null|int|float|string|false', 'result'=>'mysqli_result', 'column='=>'int'],
'mysqli_fetch_field' => ['object|false', 'result'=>'mysqli_result'],
'mysqli_fetch_field_direct' => ['object|false', 'result'=>'mysqli_result', 'index'=>'int'],
'mysqli_fetch_fields' => ['array|false', 'result'=>'mysqli_result'],
'mysqli_fetch_fields' => ['stdClass[]', 'result'=>'mysqli_result'],
'mysqli_fetch_lengths' => ['array|false', 'result'=>'mysqli_result'],
'mysqli_fetch_object' => ['object|false|null', 'result'=>'mysqli_result', 'class='=>'class-string', 'constructor_args='=>'array'],
'mysqli_fetch_row' => ['array<int,string>|false|null', 'result'=>'mysqli_result'],
'mysqli_fetch_row' => ['list<null|int|float|string>|false|null', 'result'=>'mysqli_result'],
'mysqli_field_count' => ['int', 'mysql'=>'mysqli'],
'mysqli_field_seek' => ['bool', 'result'=>'mysqli_result', 'index'=>'int'],
'mysqli_field_tell' => ['int', 'result'=>'mysqli_result'],
Expand Down Expand Up @@ -8514,15 +8518,19 @@
'mysqli_result::__construct' => ['void', 'mysql'=>'mysqli', 'result_mode='=>'int'],
'mysqli_result::close' => ['void'],
'mysqli_result::data_seek' => ['bool', 'offset'=>'int'],
'mysqli_result::fetch_all' => ['array', 'mode='=>'int'],
'mysqli_result::fetch_array' => ['array|false|null', 'mode='=>'int'],
'mysqli_result::fetch_assoc' => ['array<string,string>|false|null'],
'mysqli_result::fetch_all' => ['list<array<array-key,null|int|float|string>>', 'mode='=>'3'],
'mysqli_result::fetch_all\'1' => ['list<array<string,null|int|float|string>>', 'mode='=>'1'],
'mysqli_result::fetch_all\'2' => ['list<list<null|int|float|string>>', 'mode='=>'2'],
'mysqli_result::fetch_array' => ['array<array-key,null|int|float|string>|false|null', 'mode='=>'3'],
'mysqli_result::fetch_array\'1' => ['array<string,null|int|float|string>|false|null', 'mode='=>'1'],
'mysqli_result::fetch_array\'2' => ['list<null|int|float|string>|false|null', 'mode='=>'2'],
'mysqli_result::fetch_assoc' => ['array<string,null|int|float|string>|false|null'],
'mysqli_result::fetch_column' => ['null|int|float|string|false', 'column='=>'int'],
'mysqli_result::fetch_field' => ['object|false'],
'mysqli_result::fetch_field_direct' => ['object|false', 'index'=>'int'],
'mysqli_result::fetch_fields' => ['array|false'],
'mysqli_result::fetch_fields' => ['stdClass[]'],
'mysqli_result::fetch_object' => ['object|false|null', 'class='=>'class-string', 'constructor_args='=>'array'],
'mysqli_result::fetch_row' => ['array<int,string>|false|null'],
'mysqli_result::fetch_row' => ['list<null|int|float|string>|false|null'],
'mysqli_result::field_seek' => ['bool', 'index'=>'int'],
'mysqli_result::free' => ['void'],
'mysqli_result::free_result' => ['void'],
Expand Down
28 changes: 18 additions & 10 deletions dictionaries/CallMap_historical.php
Expand Up @@ -13398,15 +13398,19 @@
'mysqli_error_list' => ['array', 'mysql'=>'mysqli'],
'mysqli_escape_string' => ['string', 'mysql'=>'mysqli', 'string'=>'string'],
'mysqli_execute' => ['bool', 'statement'=>'mysqli_stmt'],
'mysqli_fetch_all' => ['array', 'result'=>'mysqli_result', 'mode='=>'int'],
'mysqli_fetch_array' => ['array|false|null', 'result'=>'mysqli_result', 'mode='=>'int'],
'mysqli_fetch_assoc' => ['array<string,string>|false|null', 'result'=>'mysqli_result'],
'mysqli_fetch_all' => ['list<array<array-key,null|int|float|string>>', 'result'=>'mysqli_result', 'mode='=>'3'],
'mysqli_fetch_all\'1' => ['list<array<string,null|int|float|string>>', 'result'=>'mysqli_result', 'mode='=>'1'],
'mysqli_fetch_all\'2' => ['list<list<null|int|float|string>>', 'result'=>'mysqli_result', 'mode='=>'2'],
'mysqli_fetch_array' => ['array<array-key,null|int|float|string>|false|null', 'result'=>'mysqli_result', 'mode='=>'3'],
'mysqli_fetch_array\'1' => ['array<string,null|int|float|string>|false|null', 'result'=>'mysqli_result', 'mode='=>'1'],
'mysqli_fetch_array\'2' => ['list<null|int|float|string>|false|null', 'result'=>'mysqli_result', 'mode='=>'2'],
'mysqli_fetch_assoc' => ['array<string,null|int|float|string>|false|null', 'result'=>'mysqli_result'],
'mysqli_fetch_field' => ['object|false', 'result'=>'mysqli_result'],
'mysqli_fetch_field_direct' => ['object|false', 'result'=>'mysqli_result', 'index'=>'int'],
'mysqli_fetch_fields' => ['array|false', 'result'=>'mysqli_result'],
'mysqli_fetch_fields' => ['stdClass[]', 'result'=>'mysqli_result'],
'mysqli_fetch_lengths' => ['array|false', 'result'=>'mysqli_result'],
'mysqli_fetch_object' => ['object|false|null', 'result'=>'mysqli_result', 'class='=>'class-string', 'constructor_args='=>'array'],
'mysqli_fetch_row' => ['array<int,string>|false|null', 'result'=>'mysqli_result'],
'mysqli_fetch_row' => ['list<null|int|float|string>|false|null', 'result'=>'mysqli_result'],
'mysqli_field_count' => ['int', 'mysql'=>'mysqli'],
'mysqli_field_seek' => ['bool', 'result'=>'mysqli_result', 'index'=>'int'],
'mysqli_field_tell' => ['int', 'result'=>'mysqli_result'],
Expand Down Expand Up @@ -13449,14 +13453,18 @@
'mysqli_result::__construct' => ['void', 'mysql'=>'mysqli', 'result_mode='=>'int'],
'mysqli_result::close' => ['void'],
'mysqli_result::data_seek' => ['bool', 'offset'=>'int'],
'mysqli_result::fetch_all' => ['array', 'mode='=>'int'],
'mysqli_result::fetch_array' => ['array|false|null', 'mode='=>'int'],
'mysqli_result::fetch_assoc' => ['array<string,string>|false|null'],
'mysqli_result::fetch_all' => ['list<array<array-key,null|int|float|string>>', 'mode='=>'3'],
'mysqli_result::fetch_all\'1' => ['list<array<string,null|int|float|string>>', 'mode='=>'1'],
'mysqli_result::fetch_all\'2' => ['list<list<null|int|float|string>>', 'mode='=>'2'],
'mysqli_result::fetch_array' => ['array<array-key,null|int|float|string>|false|null', 'mode='=>'3'],
'mysqli_result::fetch_array\'1' => ['array<string,null|int|float|string>|false|null', 'mode='=>'1'],
'mysqli_result::fetch_array\'2' => ['list<null|int|float|string>|false|null', 'mode='=>'2'],
'mysqli_result::fetch_assoc' => ['array<string,null|int|float|string>|false|null'],
'mysqli_result::fetch_field' => ['object|false'],
'mysqli_result::fetch_field_direct' => ['object|false', 'index'=>'int'],
'mysqli_result::fetch_fields' => ['array|false'],
'mysqli_result::fetch_fields' => ['stdClass[]'],
'mysqli_result::fetch_object' => ['object|false|null', 'class='=>'class-string', 'constructor_args='=>'array'],
'mysqli_result::fetch_row' => ['array<int,string>|false|null'],
'mysqli_result::fetch_row' => ['list<null|int|float|string>|false|null'],
'mysqli_result::field_seek' => ['bool', 'index'=>'int'],
'mysqli_result::free' => ['void'],
'mysqli_result::free_result' => ['void'],
Expand Down
16 changes: 8 additions & 8 deletions stubs/mysqli.phpstub
Expand Up @@ -9,7 +9,7 @@ class mysqli_result implements Traversable
{
/**
* @psalm-taint-sink callable $class

*
* @template T of object
* @param class-string<T> $class
* @param array $constructor_args
Expand All @@ -20,11 +20,11 @@ class mysqli_result implements Traversable


/**
* @psalm-taint-sink callable $class

* @template T of object
* @param class-string<T> $class
* @param array $constructor_args
* @return T|null|false
*/
* @psalm-taint-sink callable $class
*
* @template T of object
* @param class-string<T> $class
* @param array $constructor_args
* @return T|null|false
*/
function mysqli_fetch_object(mysqli_result $result, string $class = stdClass::class, array $constructor_args = []): object|false|null {}

0 comments on commit f1d47cc

Please sign in to comment.