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

From: Date: Sun, 14 Sep 2014 06:32:50 +0000
Subject: Re: [VOTE][RFC] Scalar Type Hinting with Cast
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-77171@lists.php.net to get a copy of this message
Hi! > oa-res-27-90:php-src ajf$ sapi/cli/php -r 'function foobar(int $a) { > var_dump($a); } foobar(1.5);' > > Catchable fatal error: Argument 1 passed to foobar() must be of the > type int, float given, called in Command line code on line 1 and > defined in Command line code on line 1 Calling this "scalar type hinting with cast" when it doesn't actually cast in wide variety of cases sounds a bit misleading to me. It should be called "scalar type checking with restricted casting" or something like that. I would also ask to clean up an RFC a bit and to clarify which of the proposed choices and "possible changes" are actually being voted for when somebody votes "yes". In any case, I call everybody to vote against this RFC in this form, since it introduces inconsistency between internal and user functions and makes PHP have two different arbitrary sets of rules for implicit conversions, and this can not be good for PHP. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/

« previous php.internals (#77171) next »