as I accidentally found out that PHP allows default argument values
to occur not only at the end of parameter list:

function ( Classname $a, Classname $b = null, Classname $c ) ...

Unfortunately, documentation does not state what is supposed to happen in such situation.
It appears $b can be an instance of Classname or a null.

I've draw up simple test case (https://gist.github.com/2829626) to verify my assumption and it seems to work at least since PHP 5.3.0. It is extremely useful to allow null
value and retain the power of type hints at the same time.

Is there anything else to test? Does it work for your setup? Can it be used that way?
And if yes, can it be officially documented?

Do not hesitate to prove I'm wrong.

-- Oliver

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to