Skip to content

Add tests to check ZPP handles intersection types for internal functions #9100

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Girgias
Copy link
Member

@Girgias Girgias commented Jul 22, 2022

No description provided.

@@ -52,6 +52,14 @@ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_zend_string_or_stdclass_or_n
ZEND_ARG_INFO(0, param)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_zend_intersection_type, 0, 1, Traversable|Countable, 0)
Copy link
Member

@kocsismate kocsismate Jul 26, 2022

Choose a reason for hiding this comment

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

Do you plan to add support for intersection types in the arginfo? Right now, the return type seems a bit inaccurate (?).

Copy link
Member Author

Choose a reason for hiding this comment

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

I didn't actually check the output of the arginfo >_> so yeah that would need fixing.

Not too sure how to add support, but I wanted to add a test to make sure stuff "works" which it seems although it's inacurate. Let me get back to this, and thanks for catching this :)

@Girgias
Copy link
Member Author

Girgias commented Jul 28, 2022

I'm not sure if I need to do anything specific in the arg info to support intersection types actually. As I can't seem to find usages which use the type directly

Need to amend zend_verify_internal_arg_types()

@Girgias
Copy link
Member Author

Girgias commented Jul 28, 2022

Just to be sure, Arg Info doesn't actually support multiple class unions either? Or does it?

@kocsismate
Copy link
Member

Just to be sure, Arg Info doesn't actually support multiple class unions either? Or does it?

Yeah, it is missing unfortunately :S I may be able to work on it though, if you do not want to

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

Successfully merging this pull request may close these issues.

2 participants