Skip to content

Use "numeric-string" type for some MySQLi functions#2223

Merged
ondrejmirtes merged 1 commit intophpstan:1.10.xfrom
phansys:mysqli
Feb 6, 2023
Merged

Use "numeric-string" type for some MySQLi functions#2223
ondrejmirtes merged 1 commit intophpstan:1.10.xfrom
phansys:mysqli

Conversation

@phansys
Copy link
Copy Markdown
Contributor

@phansys phansys commented Feb 6, 2023

If the number of rows is greater than PHP_INT_MAX, the number will be returned as a string.

BTW, is there a way to declare the type for properties like mysqli_stmt::$affected_rows?

Related to #1116.

@phansys phansys marked this pull request as ready for review February 6, 2023 10:34
@phpstan-bot
Copy link
Copy Markdown
Collaborator

This pull request has been marked as ready for review.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

When it's -1?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch. I just copied the type from mysqli_affected_rows. It's fixed.

@ondrejmirtes
Copy link
Copy Markdown
Member

BTW, is there a way to declare the type for properties

Try to add a stub file, but please add a test for it too (NodeScopeResolverTest), it might be buggy.

@ondrejmirtes
Copy link
Copy Markdown
Member

Thank you.

@ondrejmirtes ondrejmirtes merged commit b58d93e into phpstan:1.10.x Feb 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants