Re: [VOTE][RFC] Scalar Type Hinting with Cast

From: Date: Mon, 15 Sep 2014 00:31:03 +0000
Subject: Re: [VOTE][RFC] Scalar Type Hinting with Cast
References: 1 2 3 4 5 6 7 8  Groups: php.internals 
Request: Send a blank email to internals+get-77204@lists.php.net to get a copy of this message
On Sun, Sep 14, 2014 at 3:22 PM, Derick Rethans <derick@php.net> wrote: > We can either have casting where: > > function bar(int $foo) { } > bar("42"); > > Means the same as: > > function bar($foo) { } > bar((int) "42"); > > Or we can have it as a strict cast, or we can have it like it currently > (ie, not at all). I can live with those three options, but not an > option where casting/checking does something different again. > I totally agree with this. I can understand any of the following: 1) function f(int $a) { } == f( (int) $a); -- with NO notices 2) function f(int $a) {} means $a must be exactly type int -- or recoverable error is thrown 3) current behavior (no scalar type hints) But a new set of rules that require a 23x7 table to describe what's going on ... not a big fan. -- Matthew Leverton

« previous php.internals (#77204) next »