On 13/09/06, Terje Slettebø <[EMAIL PROTECTED]> wrote:
>From: "Richard Quadling" <[EMAIL PROTECTED]>> On 12/09/06, Terje Slettebø <[EMAIL PROTECTED]> wrote: > > function f(Something $value) /** @return SomethingElse */ > > { > > // ... > > } > > But one of the first things we are told about using PHP ITRW is to > always validate user input and to make sure you only accept what you > know to be valid data. True, and at least with regard to function calls, with type hinting (as you mention below), that testing is done for you, so you don't have to, leading to less code and syntactic noise (and possibly better performance).
The issue then becomes what would happen to a value of the wrong type? You either have the option of using PHP's own internal casting mechanism, so f(int $i_int_expected) would internally cast the supplied parameter as an int or you have to produce a WARNING with a "parameter of the wrong type" message. But then what is passed to the function? This would have to be determined somehow. -- ----- Richard Quadling Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731 "Standing on the shoulders of some very clever giants!"
