On Sat, Apr 6, 2019 at 9:53 AM Guilliam Xavier <guilliam.xav...@gmail.com> wrote:
> Hello internals, > > David and I would like to open the discussion on our joint RFC: > > https://wiki.php.net/rfc/nullable-casting > > Mainly, it would enable to use e.g. `(?int)$x` besides `(int)$x`. > > We are looking forward to your feedback and, if possible, help to fill > in the "RFC Impact" subsections (hopefully "None" to all) as well as a > review of the proposed implementation: > > https://github.com/php/php-src/pull/3764 I'm a bit concerned that there are two possible semantics for what (?int) does: 1. What I would intuitively expect: A fallible integer cast. I.e. try to cast to integer and if not possible return null. So (?int) "foobar" becomes null rather than 0. 2. What this RFC proposes: A normal integer cast that leaves null alone. Both behaviors make sense to me generally ... and if there are two ways to interpret a piece of syntax, I'd say the syntax is not explicit enough. Nikita