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

Infer object type mysqli_fetch_object #2675

Merged
merged 3 commits into from
Apr 29, 2024
Merged

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Oct 12, 2023

No description provided.

@staabm staabm marked this pull request as ready for review October 12, 2023 09:23
@phpstan-bot
Copy link
Collaborator

This pull request has been marked as ready for review.

@@ -7472,7 +7472,7 @@
'mysqli_fetch_field_direct' => ['object|false', 'result'=>'mysqli_result', 'fieldnr'=>'int'],
'mysqli_fetch_fields' => ['array', 'result'=>'mysqli_result'],
'mysqli_fetch_lengths' => ['array|false', 'result'=>'mysqli_result'],
'mysqli_fetch_object' => ['object|null', 'result'=>'mysqli_result', 'class_name='=>'string', 'params='=>'?array'],
'mysqli_fetch_object' => ['object|false|null', 'result'=>'mysqli_result', 'class_name='=>'class-string', 'params='=>'?array'],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seem we were missing the possible false type in php 7.2/7.3.

in newer versions it was already valid because of php8-stubs

https://www.php.net/mysqli_fetch_object

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don’t sneak in narrower parameter types like this 😊

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahh good point. just dropped the param type change

@@ -7472,7 +7472,7 @@
'mysqli_fetch_field_direct' => ['object|false', 'result'=>'mysqli_result', 'fieldnr'=>'int'],
'mysqli_fetch_fields' => ['array', 'result'=>'mysqli_result'],
'mysqli_fetch_lengths' => ['array|false', 'result'=>'mysqli_result'],
'mysqli_fetch_object' => ['object|null', 'result'=>'mysqli_result', 'class_name='=>'string', 'params='=>'?array'],
'mysqli_fetch_object' => ['object|false|null', 'result'=>'mysqli_result', 'class_name='=>'class-string', 'params='=>'?array'],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don’t sneak in narrower parameter types like this 😊

@staabm
Copy link
Contributor Author

staabm commented Apr 29, 2024

fixed conflicts

@ondrejmirtes ondrejmirtes merged commit 02071ab into phpstan:1.10.x Apr 29, 2024
442 of 443 checks passed
@ondrejmirtes
Copy link
Member

Thank you.

@staabm staabm deleted the mysqli branch April 29, 2024 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants