sphinxcontrib-phpdomain icon indicating copy to clipboard operation
sphinxcontrib-phpdomain copied to clipboard

Absolute class name must be supported

Open mvorisek opened this issue 1 year ago • 4 comments

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...

mvorisek avatar Jul 14 '23 18:07 mvorisek

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?

markstory avatar Jul 14 '23 22:07 markstory

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:

  • X (unqualified name),
  • X\Sub (Sub class name under global NS + X NS)
  • and \Foo\Y (fully qualified name).

mvorisek avatar Jul 14 '23 22:07 mvorisek

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

mvorisek avatar Jul 18 '23 10:07 mvorisek

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

markstory avatar Jul 18 '23 16:07 markstory