Req #79061 [Com]: Nullable type casting

From: Date: Fri, 03 Jan 2020 16:23:53 +0000
Subject: Req #79061 [Com]: Nullable type casting
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-224694@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79061&edit=1 ID: 79061 Comment by: rowan dot collins at gmail dot com Reported by: karolis dot bartkus at gmail dot com Summary: Nullable type casting Status: Assigned Type: Feature/Change Request Package: *General Issues PHP Version: 8 Assigned To: geekcom Block user comment: N Private report: N New Comment: Hi, The good news is, you're not the only person who wants this, or the first to suggest it. There was a mailing list thread about it 18 months ago [1] followed up by an RFC last April. [2][3] The bad news is that there hasn't been much movement since then. The best thing to do is to read through those discussions, and maybe catch up with David and Guilliam who wrote the RFC, then post to the list to restart the discussion. [1] https://externals.io/message/102997 [2] https://externals.io/message/105122 [3] https://wiki.php.net/rfc/nullable-casting Regards, Rowan Tommins [IMSoP] Previous Comments: ------------------------------------------------------------------------ [2020-01-03 15:49:08] geekcom@php.net Hi Karolis, Send an e-mail to internals@lists.php.net to measure reaction to your intended proposal. State who would implement the feature, or whether the proposal is only a “concept”. Proceed with an RFC if feedback is not negative or if a detailed RFC will clarify the proposal. Mail list subscription is at http://php.net/mailing-lists.php. (Reminder: always "bottom post" your replies. Never “top post”.) For detailed RFC Process instructions please see: https://wiki.php.net/rfc/howto ------------------------------------------------------------------------ [2020-01-03 14:08:35] karolis dot bartkus at gmail dot com Description: ------------ Currently the type casts allowed are: (int), (bool), (string), etc. It would be very convenient to have their nullable counterparts, i.e.: (?int), (?bool), (?string), etc. Generally speaking the idea is to be able to do this: $nullable_int = (?int) $nullable_string; which would be an equivalent of this: $nullable_int = is_null($nullable_string) ? null : (int) $nullable_string; ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=79061&edit=1

« previous php.bugs (#224694) next »