markstory / sphinxcontrib-phpdomain

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

Absolute class name must be supported #56

Open mvorisek opened 1 year ago

mvorisek commented 1 year ago

There is namespace support like:

.. php:namespace:: Foo\Bar

.. php:class:: X

which renders class Foo\Bar\X correctly.

but

.. php:namespace:: Foo\Bar

.. php:class:: \Foo\Data\Y

support is broken. I would expect Foo\Bar ignored as the class name is fully qualified, ie. class Foo\Data\Y rendered.

The same for traits, references...

markstory commented 1 year ago

I would expect Foo\Bar ignored as the class name is fully qualified, ie. class Foo\Data\Y rendered.

This isn't a scenario I had accounted for. Why are you mixing namespace directives with fully qualified class names in another namespace?

mvorisek commented 1 year ago

See https://github.com/atk4/ui/blob/3074d460793109f802e3542f6de0fdfec191d38a/docs/js.md?plain=1#L1 for example. The docs page mostly document Js\Xxx (Atk4\Ui\Js\Xxx) classes, but still need to refer to many Yyy (Atk4\Ui\Yyy) classes.

So I would expect .. php:namespace:: to define: "the namespace for context below until redefined" and allow .. php:class:: in form of:

mvorisek commented 1 year ago

This issue seems tobe related with https://github.com/markstory/sphinxcontrib-phpdomain/pull/47 - what is the difference of ~ vs. the standartized leading \?

markstory commented 1 year ago

The ~ operator in role directives allows the classname to be omitted from link text.