Re: [PHP-DEV] [VOTE][RFC] Scalar Type Hinting with Cast

[email protected] (Stas Malyshev)
Newsgroups php.internals
Organization SugarCRM
Message-ID <[email protected]>
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/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.