Req #79061 [Com]: Nullable type casting

From: Date: Fri, 03 Jan 2020 15:49:08 +0000
Subject: Req #79061 [Com]: Nullable type casting
References: 1  Groups: php.standards 
Request: Send a blank email to standards-+get-1477@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: geekcom@php.net Reported by: karolis dot bartkus at gmail dot com Summary: Nullable type casting Status: Assigned Type: Feature/Change Request Package: PHP Language Specification PHP Version: 8 Assigned To: geekcom Block user comment: N Private report: N New Comment: 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 Previous Comments: ------------------------------------------------------------------------ [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.standards (#1477) next »