-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support variadic parameters – take 2 #29
Conversation
So far, PhD does not support variadic parameters. Instead the manual follows the convention to use `...` as parameter name, which is then rendered as `$...` in the docs. However, as of PHP 5.6.0 variadic parameters are supported using the syntax `...$args`; therefore, we are going to support this notation for PhD. While DocBook supports a `<varargs>` element, this cannot be used in combination with named parameters. Therefore, we use the `rep` attribute of the `<methodparam>` element to designate variadic parameters.
Ugh, the PDF renderer seems to rely on PECL/haru, which is abandoned; latest release almost 8 years ago, and unlikely to be compatible with PHP 7. PS: and there is also php/web-php@beaf588 |
Also, if we go this way, should |
What's the problem there? |
That should be solved with php/web-php#349. |
$this->params["ellipsis"] = '...'; | ||
} else { | ||
$this->params["ellipsis"] = ''; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we set params["ellipsis"]
here rather than handling it directly in format_methodparam_parameter
, like the role
is?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
role="reference"
is an attribute of <parameter>
, but rep="repeat"
is an attribute of <methodparam>
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, duh.
Applied as d59932c. |
So far, PhD does not support variadic parameters. Instead the manual
follows the convention to use
...
as parameter name, which is thenrendered as
$...
in the docs. However, as of PHP 5.6.0 variadicparameters are supported using the syntax
...$args
; therefore, we aregoing to support this notation for PhD.
While DocBook supports a
<varargs>
element, this cannot be used incombination with named parameters. Therefore, we use the
rep
attribute of the
<methodparam>
element to designate variadicparameters.
What I don't like about this solution is the semantic mismatch. Consider, e.g.
array_merge(array ...$arrays)
; it is not actually$arrays
which is repeatable, but rather$array
. Maybe I'm too nit-picky here.TODO: