-
Notifications
You must be signed in to change notification settings - Fork 7.9k
add some stubs for array func in basic_functions #4519
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
Conversation
I think it's better to stick with the existing arginfo parameter names. |
@@ -60,6 +60,24 @@ function stream_wrapper_restore(string $protocol): bool {} | |||
/** @return int|false */ | |||
function array_push(array &$stack, ...$args) {} | |||
|
|||
function krsort(array &$stack, int $sort_flags = PHP_SORT_REGULAR): bool {} |
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.
We can't typehint reference arguments. See #4501 (comment).
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.
Well, krsort() expects an array on entry, so in this case the type declaration should be fine.
|
||
function count(mixed $array, int $mode = COUNT_NORAML): bool {} | ||
|
||
function natsort(array &$stack){} |
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.
Missing return type.
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.
sorry, add void return type.
|
||
function natsort(array &$stack){} | ||
|
||
function natcasesort(array &$stack){} |
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.
Missing return type.
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.
sorry, add void return type.
|
||
function ksort(array &$stack, int $sort_flags = PHP_SORT_REGULAR): bool {} | ||
|
||
function count(mixed $array, int $mode = COUNT_NORAML): bool {} |
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.
mixed
is not a valid type hint, moreover doesn't this need a doc comment @param array|Countable $array
?
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.
sorry, I've add doc comment @param array|Countable.
@@ -66,9 +66,9 @@ function ksort(array &$stack, int $sort_flags = PHP_SORT_REGULAR): bool {} | |||
|
|||
function count(mixed $array, int $mode = COUNT_NORAML): bool {} | |||
|
|||
function natsort(array &$stack){} | |||
function natsort(array &$stack): void {} |
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.
Is ir void
or bool
?
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.
It is bool
, but actually only TRUE will ever be returned. It might be sensible to change it to void
, but that would be a BC break.
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.
@cmb69 Yeah, this goes to our list at https://bugs.php.net/bug.php?id=75958
Please have a look at the test failures. |
The test are failing because of #4519 (comment) |
thanks, I find a fail case in ext/reflection in ci log . |
1a29b0e
to
a829ed4
Compare
all test passed now, Please review again, Thanks. |
@@ -60,6 +60,25 @@ function stream_wrapper_restore(string $protocol): bool {} | |||
/** @return int|false */ | |||
function array_push(array &$stack, ...$args) {} | |||
|
|||
function krsort(array &$arg, int $sort_flags = PHP_SORT_REGULAR): bool {} |
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.
PHP_SORT_REGULAR
is a C macro; its PHP pendant is SORT_REGULAR
. I'm taking the liberty to fix that myself. :)
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.
Got it. Thanks.
Thanks. Applied as ffffaf1. |
add stubs for array sort funcs in basic_functions