Skip to content

Commit

Permalink
deprecate "meth" ref in favor of "method"
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Aug 3, 2023
1 parent 8de00a9 commit d9a8ba5
Show file tree
Hide file tree
Showing 13 changed files with 65 additions and 64 deletions.
4 changes: 2 additions & 2 deletions doc/reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,11 @@ matching directive is found:
:php:class:`LibraryName\\ClassName`

.. rst:role:: php:meth
.. rst:role:: php:method
Reference a method of a class/interface/trait::
:php:meth:`DateTime::setDate`
:php:method:`DateTime::setDate`

.. rst:role:: php:attr
Expand Down
4 changes: 2 additions & 2 deletions doc/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ From other place, you can create cross reference like that:

.. code:: rst
You can modify a DateTime's date using :php:meth:`DateTime::setDate`.
You can modify a DateTime's date using :php:method:`DateTime::setDate`.
Result
-----------

You can modify a DateTime's date using :php:meth:`DateTime::setDate`.
You can modify a DateTime's date using :php:method:`DateTime::setDate`.

5 changes: 3 additions & 2 deletions sphinxcontrib/phpdomain.py
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,7 @@ class PhpDomain(Domain):
"function": ObjType(_("function"), "function", "obj"),
"global": ObjType(_("global variable"), "global", "obj"),
"const": ObjType(_("const"), "const", "obj"),
"method": ObjType(_("method"), "meth", "obj"),
"method": ObjType(_("method"), "method", "obj"),
"class": ObjType(_("class"), "class", "obj"),
"attr": ObjType(_("attribute"), "attr", "obj"),
"exception": ObjType(_("exception"), "exc", "obj"),
Expand Down Expand Up @@ -782,7 +782,8 @@ class PhpDomain(Domain):
"global": PhpXRefRole(),
"class": PhpXRefRole(),
"exc": PhpXRefRole(),
"meth": PhpXRefRole(fix_parens=False),
"method": PhpXRefRole(fix_parens=False),
"meth": PhpXRefRole(fix_parens=False), # deprecated, use "method"
"attr": PhpXRefRole(),
"const": PhpXRefRole(),
"namespace": PhpXRefRole(),
Expand Down
6 changes: 3 additions & 3 deletions test/log.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ <h1>Unresolved references<a class="headerlink" href="#unresolved-references" tit
</li>
<li>
<p>
<code class="xref php php-meth docutils literal notranslate">
<code class="xref php php-method docutils literal notranslate">
<span class="pre">Foo\A::simplifyy</span>
</code>
</p>
Expand All @@ -59,7 +59,7 @@ <h1>Unresolved references<a class="headerlink" href="#unresolved-references" tit
<li>
<p>
<a class="reference internal" href="ns.html#Foo\A::simplify" title="Foo\A::simplify">
<code class="xref php php-meth docutils literal notranslate">
<code class="xref php php-method docutils literal notranslate">
<span class="pre">Foo\A::simplify</span>
</code>
</a>
Expand All @@ -71,7 +71,7 @@ <h1>Unresolved references<a class="headerlink" href="#unresolved-references" tit
<li>
<p>
<a class="reference internal" href="ns.html#Foo\A::simplify" title="Foo\A::simplify">
<code class="xref php php-meth docutils literal notranslate">
<code class="xref php php-method docutils literal notranslate">
<span class="pre">Foo\A::simplify</span>
</code>
</a>
Expand Down
6 changes: 3 additions & 3 deletions test/log.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@

- {php:class}`Foo\Aa`

- {php:meth}`Foo\A::simplifyy`
- {php:method}`Foo\A::simplifyy`

:::{php:namespace} Foo
:::

- {php:meth}`Foo\A::simplify`
- {php:method}`Foo\A::simplify`

:::{php:namespace} Fooo
:::

- {php:meth}`Foo\A::simplify`
- {php:method}`Foo\A::simplify`
2 changes: 1 addition & 1 deletion test/method.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ <h2>Cross linking<a class="headerlink" href="#cross-linking" title="Permalink to
<li>
<p>
<a class="reference internal" href="#Foo::test" title="Foo::test">
<code class="xref php php-meth docutils literal notranslate">
<code class="xref php php-method docutils literal notranslate">
<span class="pre">Foo::test()</span>
</code>
</a>
Expand Down
2 changes: 1 addition & 1 deletion test/method.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ Simple test method.

## Cross linking

- {php:meth}`Foo::test()`
- {php:method}`Foo::test()`
12 changes: 6 additions & 6 deletions test/ns.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ <h2>Cross linking<a class="headerlink" href="#cross-linking" title="Permalink to
<li>
<p>
<a class="reference internal" href="#Foo\A::simplify" title="Foo\A::simplify">
<code class="xref php php-meth docutils literal notranslate">
<code class="xref php php-method docutils literal notranslate">
<span class="pre">A::simplify</span>
</code>
</a>
Expand Down Expand Up @@ -115,7 +115,7 @@ <h2>Cross linking<a class="headerlink" href="#id1" title="Permalink to this head
<li>
<p>
<a class="reference internal" href="#Bar\A::simplify" title="Bar\A::simplify">
<code class="xref php php-meth docutils literal notranslate">
<code class="xref php php-method docutils literal notranslate">
<span class="pre">A::simplify</span>
</code>
</a>
Expand All @@ -124,7 +124,7 @@ <h2>Cross linking<a class="headerlink" href="#id1" title="Permalink to this head
<li>
<p>
<a class="reference internal" href="#Foo\Bar\A::simplify" title="Foo\Bar\A::simplify">
<code class="xref php php-meth docutils literal notranslate">
<code class="xref php php-method docutils literal notranslate">
<span class="pre">Foo\Bar\A::simplify</span>
</code>
</a>
Expand All @@ -133,7 +133,7 @@ <h2>Cross linking<a class="headerlink" href="#id1" title="Permalink to this head
<li>
<p>
<a class="reference internal" href="#Bar\A::simplify" title="Bar\A::simplify">
<code class="xref php php-meth docutils literal notranslate">
<code class="xref php php-method docutils literal notranslate">
<span class="pre">Bar\A::simplify</span>
</code>
</a>
Expand Down Expand Up @@ -248,7 +248,7 @@ <h1>NS must not be guessed<a class="headerlink" href="#ns-must-not-be-guessed" t
<ul class="simple">
<li>
<p>
<code class="xref php php-meth docutils literal notranslate">
<code class="xref php php-method docutils literal notranslate">
<span class="pre">A2::simplify</span>
</code>
</p>
Expand All @@ -258,7 +258,7 @@ <h1>NS must not be guessed<a class="headerlink" href="#ns-must-not-be-guessed" t
<ul class="simple">
<li>
<p>
<code class="xref php php-meth docutils literal notranslate">
<code class="xref php php-method docutils literal notranslate">
<span class="pre">A::simplify</span>
</code>
</p>
Expand Down
12 changes: 6 additions & 6 deletions test/ns.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

## Cross linking

- {php:meth}`A::simplify`
- {php:method}`A::simplify`

# NS can be changed

Expand All @@ -35,9 +35,9 @@

## Cross linking

- {php:meth}`A::simplify`
- {php:meth}`\Foo\Bar\A::simplify`
- {php:meth}`\Bar\A::simplify`
- {php:method}`A::simplify`
- {php:method}`\Foo\Bar\A::simplify`
- {php:method}`\Bar\A::simplify`

# Leading `\` implies absolute class name

Expand Down Expand Up @@ -66,9 +66,9 @@
These cross references must not have a link as the target methods are not defined.
:::

- {php:meth}`\A2::simplify`
- {php:method}`\A2::simplify`

:::{php:namespace} Bar2
:::

- {php:meth}`A::simplify`
- {php:method}`A::simplify`
36 changes: 18 additions & 18 deletions test/rst_doc.html
Original file line number Diff line number Diff line change
Expand Up @@ -457,21 +457,21 @@ <h3>Test Case - Global symbols with no namespaces<a class="headerlink" href="#te
</p>
<p>
<a class="reference internal" href="#DateTime::setTime" title="DateTime::setTime">
<code class="xref php php-meth docutils literal notranslate">
<code class="xref php php-method docutils literal notranslate">
<span class="pre">DateTime::setTime()</span>
</code>
</a>
</p>
<p>
<a class="reference internal" href="#DateTime::getLastErrors" title="DateTime::getLastErrors">
<code class="xref php php-meth docutils literal notranslate">
<code class="xref php php-method docutils literal notranslate">
<span class="pre">DateTime::getLastErrors()</span>
</code>
</a>
</p>
<p>
<a class="reference internal" href="#DateTime::setDate" title="DateTime::setDate">
<code class="xref php php-meth docutils literal notranslate">
<code class="xref php php-method docutils literal notranslate">
<span class="pre">DateTime::setDate()</span>
</code>
</a>
Expand All @@ -492,7 +492,7 @@ <h3>Test Case - Global symbols with no namespaces<a class="headerlink" href="#te
</p>
<p>
<a class="reference internal" href="#OtherClass::update" title="OtherClass::update">
<code class="xref php php-meth docutils literal notranslate">
<code class="xref php php-method docutils literal notranslate">
<span class="pre">OtherClass::update</span>
</code>
</a>
Expand All @@ -513,7 +513,7 @@ <h3>Test Case - Global symbols with no namespaces<a class="headerlink" href="#te
</p>
<p>
<a class="reference internal" href="#OtherClass2::update" title="OtherClass2::update">
<code class="xref php php-meth docutils literal notranslate">
<code class="xref php php-method docutils literal notranslate">
<span class="pre">OtherClass2::update()</span>
</code>
</a>
Expand All @@ -527,14 +527,14 @@ <h3>Test Case - Global symbols with no namespaces<a class="headerlink" href="#te
</p>
<p>
<a class="reference internal" href="#DateTimeInterface::setTime" title="DateTimeInterface::setTime">
<code class="xref php php-meth docutils literal notranslate">
<code class="xref php php-method docutils literal notranslate">
<span class="pre">DateTimeInterface::setTime()</span>
</code>
</a>
</p>
<p>
<a class="reference internal" href="#DateTimeInterface::setDate" title="DateTimeInterface::setDate">
<code class="xref php php-meth docutils literal notranslate">
<code class="xref php php-method docutils literal notranslate">
<span class="pre">setDate()</span>
</code>
</a>
Expand Down Expand Up @@ -569,7 +569,7 @@ <h3>Test Case - Global symbols with no namespaces<a class="headerlink" href="#te
</p>
<p>
<a class="reference internal" href="#LogTrait::log" title="LogTrait::log">
<code class="xref php php-meth docutils literal notranslate">
<code class="xref php php-method docutils literal notranslate">
<span class="pre">LogTrait::log()</span>
</code>
</a>
Expand All @@ -580,7 +580,7 @@ <h3>Test Case - Prefix less links<a class="headerlink" href="#test-case-prefix-l
<p>The following links should not be prefixed with a classname.</p>
<p>
<a class="reference internal" href="#DateTime::setDate" title="DateTime::setDate">
<code class="xref php php-meth docutils literal notranslate">
<code class="xref php php-method docutils literal notranslate">
<span class="pre">setDate()</span>
</code>
</a>
Expand Down Expand Up @@ -993,7 +993,7 @@ <h3>Test Case - not including namespace<a class="headerlink" href="#test-case-no
</p>
<p>
<a class="reference internal" href="#LibraryName\NamespaceClass2::update" title="LibraryName\NamespaceClass2::update">
<code class="xref php php-meth docutils literal notranslate">
<code class="xref php php-method docutils literal notranslate">
<span class="pre">NamespaceClass2::update()</span>
</code>
</a>
Expand All @@ -1007,35 +1007,35 @@ <h3>Test Case - not including namespace<a class="headerlink" href="#test-case-no
</p>
<p>
<a class="reference internal" href="#LibraryName\LibraryClassFinal::firstMethod" title="LibraryName\LibraryClassFinal::firstMethod">
<code class="xref php php-meth docutils literal notranslate">
<code class="xref php php-method docutils literal notranslate">
<span class="pre">LibraryClassFinal::firstMethod</span>
</code>
</a>
</p>
<p>
<a class="reference internal" href="#LibraryName\LibraryClassFinal::secondMethod" title="LibraryName\LibraryClassFinal::secondMethod">
<code class="xref php php-meth docutils literal notranslate">
<code class="xref php php-method docutils literal notranslate">
<span class="pre">LibraryClassFinal::secondMethod</span>
</code>
</a>
</p>
<p>
<a class="reference internal" href="#LibraryName\LibraryClassFinal::thirdMethod" title="LibraryName\LibraryClassFinal::thirdMethod">
<code class="xref php php-meth docutils literal notranslate">
<code class="xref php php-method docutils literal notranslate">
<span class="pre">LibraryClassFinal::thirdMethod</span>
</code>
</a>
</p>
<p>
<a class="reference internal" href="#LibraryName\LibraryClassFinal::fourthMethod" title="LibraryName\LibraryClassFinal::fourthMethod">
<code class="xref php php-meth docutils literal notranslate">
<code class="xref php php-method docutils literal notranslate">
<span class="pre">LibraryClassFinal::fourthMethod</span>
</code>
</a>
</p>
<p>
<a class="reference internal" href="#LibraryName\LibraryClassFinal::fifthMethod" title="LibraryName\LibraryClassFinal::fifthMethod">
<code class="xref php php-meth docutils literal notranslate">
<code class="xref php php-method docutils literal notranslate">
<span class="pre">LibraryClassFinal::fifthMethod</span>
</code>
</a>
Expand Down Expand Up @@ -1063,7 +1063,7 @@ <h3>Test Case - not including namespace<a class="headerlink" href="#test-case-no
</p>
<p>
<a class="reference internal" href="#LibraryName\TemplateTrait::render" title="LibraryName\TemplateTrait::render">
<code class="xref php php-meth docutils literal notranslate">
<code class="xref php php-method docutils literal notranslate">
<span class="pre">TemplateTrait::render()</span>
</code>
</a>
Expand Down Expand Up @@ -2013,14 +2013,14 @@ <h4>Links to Advanced Enumeration Example<a class="headerlink" href="#links-to-a
</p>
<p>
<a class="reference internal" href="#Example\Advanced\Suit::color" title="Example\Advanced\Suit::color">
<code class="xref php php-meth docutils literal notranslate">
<code class="xref php php-method docutils literal notranslate">
<span class="pre">Suit::color</span>
</code>
</a>
</p>
<p>
<a class="reference internal" href="#Example\Advanced\Suit::values" title="Example\Advanced\Suit::values">
<code class="xref php php-meth docutils literal notranslate">
<code class="xref php php-method docutils literal notranslate">
<span class="pre">Suit::values</span>
</code>
</a>
Expand Down
Loading

0 comments on commit d9a8ba5

Please sign in to comment.