-
Notifications
You must be signed in to change notification settings - Fork 7.8k
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
[Basic functions] Added return type for arginfo #1492
Conversation
1 http://php.net/manual/en/function.abs.php |
Hi Dmitry, PHP-7 is in RC stage. We can't add any new features now. Thanks. Dmitry. On Sun, Aug 30, 2015 at 7:22 PM, Dmitry Patsura notifications@github.com
|
Since no RFC has materialized, and since the work seems to have been abandoned by the author, I'm closing this PR. Take this as encouragement to create a clean, complete PR, targeting an appropriate branch (too late for 7.1), and start an accompanying RFC and internals discussion at the same time. |
BTW: I don't see a problem merging this PR into master. |
@morrisonlevi Was this you were talking about #3026 (comment)? |
@dstogov quote:
Was this in reference to the suggestion to add |
@krakjoe yes |
Merged b7d2e04 Thanks. Apologies for the confusion ... |
687e2e7
to
d3908b1
Compare
d3908b1
to
7933411
Compare
Rebased commits, drop unneeded argument on |
@@ -1619,71 +1619,71 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_round, 0, 0, 1) | |||
ZEND_ARG_INFO(0, mode) | |||
ZEND_END_ARG_INFO() | |||
|
|||
ZEND_BEGIN_ARG_INFO(arginfo_sin, 0) | |||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(arginfo_sin, IS_DOUBLE, 0) |
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.
All of these will need to be declared nullable due to zpp failures :(
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.
@nikic I think it would be better for the future if we distinguish at the macro level the functions returning nullable types because of ZPP failures and those which may return null even if ZPP failure is changed to TypeError
. Unless we don't have any of those; I know returning false
is incredibly common. Agree?
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.
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.
@morrisonlevi @nikic @krakjoe Is functions return type something that might be happening in PHP 7.x
? Is so, I've started to write a script (it is very simple yet), so we can automate that. Let me know if you want me to PR it to the core, so we can start adding them 😄
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 don't think it makes much sense to add return type arginfo, if we're not also adding parameter type arginfo. Furthermore, adding return type arginfo is a general problem as pointed out above, since ZPP failures are handled manually (most functions return NULL in this case, but I've seen functions returning FALSE). It might be most reasonable to postpone this to PHP 8, where we hopefully can throw exceptions on ZPP failures, and maybe even unify arginfo and ZPP.
@ovr bump, see nikita's comment ... |
Comment on behalf of kalle at php.net: Closing due to inactivity |
Hey!
I love PHP7 ideas about return type hints and it's very usefull in static analysis
I am working https://github.com/ovr/phpsa
Now I am using https://github.com/ovr/phpreflection but I would like to see return type for all functions in PHP7 on FunctionReflection
Now
I am going to add return types for basic functions
Dear mainterns:
If idea is rly good please write smthgs in comments :)
Because i don't know is it okey or not
Main questions:
1 http://php.net/manual/en/function.abs.php
Maybe it's time to add fake type
IS_NUMBER
?Thanks