Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix mysqli_fetch_* stubs #7014

Merged
merged 5 commits into from Nov 29, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 {}