-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Implemented "Nullable Types" #1045
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
* master: (52 commits) Add load time return type checking to match user land logic Add test function arguments fix data type mismatch fix unitialized val usage follow up fix for headers sent, checking a reference would be always true as well remove unused variable fix wars about importing of locally defined symbols fix data type Implemented internal function return types Updated NEWS Revert "Fixed bug #55407 (Impossible to prototype DateTime::createFromFormat)" Removed TSRMLS_D 5.6.7 now 5.5.23 now Simplify code and add comments Move zend_object->guards into additional slot of zend_object->properties_table[]. As result size of objects without __get/__set/__unset/__isset magic methods is reduced. Revert "json_decode() should generate a syntax error when given ""." Add note aout $HTTP_RAW_POST_DATA Use object pointers instead of handles make buildconf work as expected; autoconf really needs some help with all those external m4s ...
Hello, what is the status of RFC ? especially now that php7 will have an improved type checking, nullable type will be a significant improvement I think. |
Hi Levi, This was your RFC, and I don't completely understand why we missed it. Thanks. Dmitry. On Mon, Apr 27, 2015 at 9:01 AM, Allan Simon notifications@github.com
|
//cc @morrisonlevi (just making sure he gets notified) |
The short answer is that |
I see your point. Thanks. Dmitry. On Mon, Apr 27, 2015 at 5:24 PM, Levi Morrison notifications@github.com
|
The ability to type a parameter or return as
I know waiting another year will pain some people, but they can make do like they have always done in years past and just omit the types or rely on documentation. There are plenty uses of return types without This also isn't a pressing issue since we're well past the 7.0 freeze. This means we have to wait until 7.1, so there is no hurry at all. I haven't forgotten about it :) |
+1 for null|Baz @morrisonlevi |
Hi, This is very important! For non scalar returns the return type feature of PHP7 is not usable. Regards |
It's implemented like that in TypeScript. The only difference is that in TS function(a: string?) { ... } |
please oh god please lets get this cleaned up and commited. im seriously dying inside with every line i write that is not nullable. |
this may be solved only in PHP-7.1 (there is no release plan yet) |
Regarding the idea :
While allowing for a nullable type implies that no non-null default value can be set (since the default value would presumably always override a null value passed in), the inverse, I don't think, is true, eg that setting a default value of NULL excludes the ability to use a nullable type. Using your example:
This makes sense, but shouldn't the following also be valid:
|
What is the state of this PR? |
I am going to work more on this after mid-April when I have more time. |
Superseded by #1893, which was merged. |
according to https://wiki.php.net/rfc/nullable_types