Skip to content

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

Closed

Conversation

duncan3dc
Copy link
Member

No description provided.

Copy link
Member

@cmb69 cmb69 left a 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.


function spl_autoload_call(string $class_name): void {}

function spl_autoload_register(callable $autoload_function = UNKNOWN, bool $throw = true, bool $prepend = false): bool {}
Copy link
Member

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?

Copy link
Member Author

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?

Copy link
Member

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).

Copy link
Member Author

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

@nikic
Copy link
Member

nikic commented Oct 29, 2019

Checking back here. @duncan3dc can you address the review comments?

@duncan3dc duncan3dc force-pushed the convert-spl-functions-arginfo branch from f6e45c7 to bb3b2f4 Compare November 17, 2019 16:02
@duncan3dc
Copy link
Member Author

Sorry for the delay, thanks for the review @cmb69 I've addressed all but one of the comments, waiting for help on that one

@duncan3dc duncan3dc force-pushed the convert-spl-functions-arginfo branch from bb3b2f4 to 618f559 Compare November 17, 2019 20:30
@duncan3dc
Copy link
Member Author

@cmb69
Copy link
Member

cmb69 commented Nov 18, 2019

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 class_implements() or class_uses(), or maybe we should support type juggling to string as well (convert_to_string()) if we're in "strict_types=0" mode.


function class_implements(object|string $what, bool $autoload = true): array|false {}

function class_uses(object|string $what, bool $autoload = true): array|false {}
Copy link
Member

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)

@kocsismate
Copy link
Member

@duncan3dc These stubs have already been added in the meanwhile by #4968 so this PR can be closed.

@cmb69
Copy link
Member

cmb69 commented Dec 20, 2019

Oh, indeed.

@cmb69 cmb69 closed this Dec 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants