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
Improve sscanf()
signature
#567
Improve sscanf()
signature
#567
Conversation
If only two parameters were passed to this function, the values parsed will be returned as an array. Otherwise, if optional parameters are passed, the function will return the number of assigned values. The optional parameters must be passed by reference. If there are more substrings expected in the format than there are available within string, null will be returned. https://www.php.net/manual/en/function.sscanf.php
Can you please test in |
Done. |
resources/functionMap.php
Outdated
@@ -11546,7 +11546,8 @@ | |||
'sqlsrv_server_info' => ['array', 'conn'=>'resource'], | |||
'sqrt' => ['float', 'number'=>'float'], | |||
'srand' => ['void', 'seed='=>'int', 'mode='=>'int'], | |||
'sscanf' => ['mixed', 'str'=>'string', 'format'=>'string', '&...w_vars='=>'string|int|float|null'], | |||
'sscanf' => ['int|null', 'str'=>'string', 'format'=>'string', '&...w_vars'=>'string|int|float|null'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ondrejmirtes I have no idea why the tests fails, can you help me?
I made variadic args not optional, but I still get array|int|null
for two-arguments signature, but I want just array|null
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is why I wanted you to write these tests because I wasn't sure it's going to work the way you want. You need to modify the signature so that there's a third required parameter (non-variadic), and the fourth one is variadic and optional.
Thank you! |
If only two parameters were passed to this function, the values parsed will be returned as an array. Otherwise, if optional parameters are passed, the function will return the number of assigned values. The optional parameters must be passed by reference.
If there are more substrings expected in the format than there are available within string, null will be returned.
https://www.php.net/manual/en/function.sscanf.php