Also,

function foo(SomeClass $obj) would error out if passed something other than a SomeClass instance, while
function foo(int $number) would just cast $number to int.

Not really intuitive and not really consistent.

Regards,
Vlad Bosinceanu

Stefan Esser wrote:
Hello,
typing into PHP, even if it is optional. Passing $_REQUEST['age'] to a
that $_REQUEST['age'] has been checked for numeric before the functio

would you please not use $_REQUEST in any of your examples? $_REQUEST is
one of the biggest design weaknesses in PHP. Every application using
$_REQUEST is most probably vulnerable to Delayed Cross Site Request
Forgery problems. (This basically means if e.g. a cookie named (age)
exists it will always overwrite the GET/POST content and therefore
unwanted requests will be performed)

And well... This thread continues without a single valid (!= personal
opinion) reason why type hinting should NOT be introduced. BTW accepting
the string '1' where an (int) type hint is placed would be the next
stupid design decision.

Yours,
Stefan Esser


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to