-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Convert spl functions arginfo to php stubs #4733
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
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.
Thanks for the PR! Please have a look at the comments below.
ext/spl/php_spl.stub.php
Outdated
|
||
function spl_autoload_call(string $class_name): void {} | ||
|
||
function spl_autoload_register(callable $autoload_function = UNKNOWN, bool $throw = true, bool $prepend = false): 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.
Is $autoload_function
actually constrained to callable
?
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.
zend_parse_parameters_ex
just specifies a zval, but the implementation looks pretty strict about it being a callable, should I remove the type declaration and add a @param
for it instead?
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.
I'm not 100% sure, but I think callable
types must be parsed as such (i.e. using an "f" type specifier or Z_PARAM_FUNC
).
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.
Ok I've dropped the type now, added a @param
to clarify the expected value
Checking back here. @duncan3dc can you address the review comments? |
f6e45c7
to
bb3b2f4
Compare
Sorry for the delay, thanks for the review @cmb69 I've addressed all but one of the comments, waiting for help on that one |
bb3b2f4
to
618f559
Compare
I've added the union types in now they're available. |
The test failures are legit, and have to be addressed. I think it's best to remove the ZPP tests (e.g. passing an int or array where the function expects object|string). Furthermore, we may consider to throw if anything else than object|string is passed to |
|
||
function class_implements(object|string $what, bool $autoload = true): array|false {} | ||
|
||
function class_uses(object|string $what, bool $autoload = true): array|false {} |
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.
object|string
union is not yet supported based on this: 292a1ae (see the description as well)
@duncan3dc These stubs have already been added in the meanwhile by #4968 so this PR can be closed. |
Oh, indeed. |
No description provided.