markstory / sphinxcontrib-phpdomain

A PHP domain for sphinx. Allows you to annotate PHP objects in your sphinx docs.
Other
19 stars 14 forks source link

Fix problem that [] and , in argument list are swapped #4

Closed boarnasia closed 7 years ago

boarnasia commented 7 years ago

Code is fixed with reference to python domain coding. https://github.com/sphinx-doc/sphinx/blob/master/sphinx/domains/javascript.py#L84

Problem happen in case below:

.. php:method:: inputs(array $fields = [], $options = [])

In this case, result should be:

Cake\View\Helper\FormHelper::inputs(array $fields = [], $options = []])

But actually wrong:

Cake\View\Helper\FormHelper::inputs(array $fields = , []$options = []])

Above problem already fixed by this PR.


Unfortunately, this code still has another comma defect. The defect emerges when in case below:

.. php:method:: foo(string $var =",", string $buz = true)

In this case, separating with comma, arguments become 3 of 'string $var="', '"', 'string $buz = true'.

However, last defect is a problem of _pseudo_parse_arglist that should be fixed in python domain, but, I think, it is not a problem of phpdomain.

In addition, it doesn't happen in cake3 doc because of there are no signature with "," default parameter as long as I've checked.

Thank you for reading.

boarnasia commented 7 years ago

Update has done.

markstory commented 7 years ago

Thanks :+1: I've packaged a new release of this package which should get picked up by CakePHP docs next time they are built.