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

Fixed signatures of gmp_div, odbc_exec and unregister_tick_function #533

Merged
merged 2 commits into from
May 25, 2021
Merged

Fixed signatures of gmp_div, odbc_exec and unregister_tick_function #533

merged 2 commits into from
May 25, 2021

Conversation

danielmarschall
Copy link
Contributor

gmp_div: Return type is GMP , not resource

odbc_exec: Return type is resource|false , not resource
Note that the "flags" argument will be removed in PHP 8.0

unregister_tick_function: argument is now called "callback" and type "callable" instead of "string"
Example: $callable=array(&$object, 'my_method') or $callable=array('Object', 'my_method')

@@ -8012,7 +8012,7 @@
'odbc_do' => ['resource', 'connection_id'=>'resource', 'query'=>'string', 'flags='=>'int'],
'odbc_error' => ['string', 'connection_id='=>'resource'],
'odbc_errormsg' => ['string', 'connection_id='=>'resource'],
'odbc_exec' => ['resource', 'connection_id'=>'resource', 'query'=>'string', 'flags='=>'int'],
'odbc_exec' => ['resource|false', 'connection_id'=>'resource', 'query'=>'string', 'flags='=>'int'], // Note: 'flags' was removed in PHP 8.0
Copy link
Member

Choose a reason for hiding this comment

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

The note is useless here, you can submit a change to https://github.com/phpstan/phpstan-src/blob/master/resources/functionMap_php80delta.php instead

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay. Will you do it, or do I need to send a new pull request?

Copy link
Member

Choose a reason for hiding this comment

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

Modify this PR so it can be merged, thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I changed the PR

@@ -12639,7 +12639,7 @@
'unixtojd' => ['int|false', 'timestamp='=>'int'],
'unlink' => ['bool', 'filename'=>'string', 'context='=>'resource'],
'unpack' => ['array|false', 'format'=>'string', 'data'=>'string', 'offset='=>'int'],
'unregister_tick_function' => ['void', 'function_name'=>'string'],
'unregister_tick_function' => ['void', 'callback'=>'callable'],
Copy link
Member

Choose a reason for hiding this comment

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

The parameter does not need to be renamed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, sounds good. I just looked in the old manual . In PHP 7, it was called "$function_name" , and in PHP 8 it was renamed to "$callback" (so it should be renamed in functionMap_php80delta.php then)

Copy link
Member

Choose a reason for hiding this comment

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

This doesn't need to be done, the PHP 8 signatures are mostly taken from https://github.com/phpstan/php-8-stubs/blob/main/stubs/ext/standard/unregister_tick_function.php already.

@ondrejmirtes ondrejmirtes merged commit 58a1471 into phpstan:master May 25, 2021
@ondrejmirtes
Copy link
Member

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants