On 10 September 2013 00:28, Hannes Magnusson <hannes.magnus...@gmail.com> wrote:
> IMO an optional argument should have a way to "skip it, using default value".
> its annoying when in userland you have to do
> if ($option) {
> foo($arg1, $arg2, $option);
> } else {
> foo($arg1, $arg2);
> }
>
> And I consider it a bug when I cannot pass empty string/array/null to
> the optional parameter.

Agreed. This is closely related to recent discussions on internals,
and without wishing to bring that particular open can of worms over
here I think it would be good to account for the possibility in docs.
My first thought would be to add a phpdoc:skippable="true" (or
something) attribute to parameters, which would possibly have some
form of semantic meaning in the rendered version if any of the
parameter proposals were to make through but, on this topic, would
negate a missingInitializer error. Obviously this would only be valid
for choice="opt" parameters.

This may be a really bad idea, so please feel free to send any
comments/alternative ideas/abuse in my general direction.

Cheers, Chris

Reply via email to