Skip to content

Conversation

@matbcvo
Copy link
Contributor

@matbcvo matbcvo commented Sep 12, 2025

Description

This PR adds the sphinxcontrib-phpdomain extension to the documentation build.

Compared to the older phpdomain, the markstory/sphinxcontrib-phpdomain package is actively maintained.

https://github.com/markstory/sphinxcontrib-phpdomain

Screenshots or screen recordings

Before

image

After

image

@matbcvo
Copy link
Contributor Author

matbcvo commented Sep 12, 2025

@adiati98, this seems to be working based on this PR's URL:
https://mautic-developer--269.org.readthedocs.build/en/269/plugins/config.html#advanced-routing

But I can see an issue: those aren't nested correctly. Each php:method should be inside the class directive's body, indented more than the class line. We'll need to fix all instances where this occurs.

Incorrect example

Advanced routing
================

Configure custom routes through writing a listener to the ``\Mautic\CoreBundle\CoreEvents::BUILD_ROUTE`` event. Listeners to this event receives a ``Mautic\CoreBundle\Event\RouteEvent`` object. Mautic dispatches an event for each firewall when compiling routes.

.. php:class:: Mautic\CoreBundle\Event\RouteEvent

.. php:method:: getType()

    :returns: The :ref:`route firewall<plugins/config:Routing firewalls>` for the given route collection.
    :returntype: string

.. php:method:: getCollection()

    :returns: Returns a RouteCollection object that can be used to manually define custom routes.
    :returntype: \\Symfony\\Component\\Routing\\RouteCollection

.. php:method:: addRoutes(string $path)

    Load custom routes through a resource file such as yaml or XML.

    :param string $path: Path to the resource file. For example, ``@FMElfinderBundle/Resources/config/routing.yaml``.
    :returntype: void
image

Correct example

Advanced routing
================

Configure custom routes through writing a listener to the ``\Mautic\CoreBundle\CoreEvents::BUILD_ROUTE`` event. Listeners to this event receives a ``Mautic\CoreBundle\Event\RouteEvent`` object. Mautic dispatches an event for each firewall when compiling routes.

.. php:class:: Mautic\CoreBundle\Event\RouteEvent

  .. php:method:: getType()

      :returns: The :ref:`route firewall<plugins/config:Routing firewalls>` for the given route collection.
      :returntype: string

  .. php:method:: getCollection()

      :returns: Returns a RouteCollection object that can be used to manually define custom routes.
      :returntype: \\Symfony\\Component\\Routing\\RouteCollection

  .. php:method:: addRoutes(string $path)

      Load custom routes through a resource file such as yaml or XML.

      :param string $path: Path to the resource file. For example, ``@FMElfinderBundle/Resources/config/routing.yaml``.
      :returntype: void
image

@matbcvo matbcvo marked this pull request as ready for review September 12, 2025 14:41
@matbcvo matbcvo requested a review from a team as a code owner September 12, 2025 14:41
@matbcvo matbcvo requested review from adiati98 and favour-chibueze and removed request for a team September 12, 2025 14:41
@matbcvo matbcvo requested a review from RCheesley September 12, 2025 20:44
Copy link
Contributor

@adiati98 adiati98 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @matbcvo,

Thanks so much for your PR! ✨
I'm currently reviewing this, but I also have a question in paralel.

RUN chmod +x /usr/local/bin/pipx

RUN pipx install --global sphinx
RUN pipx install --force --global --include-deps sphinx-rtd-theme
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: Is there any reason to remove this? Would we need this in the future?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: Is there any reason to remove this? Would we need this in the future?

This PR switches to pipx inject because sphinx-rtd-theme and sphinxcontrib-phpdomain are Sphinx extensions, not standalone tools.

With the previous pipx install sphinx-rtd-theme, the theme was placed into its own isolated environment. While Sphinx was still able to see the theme, the sphinxcontrib-phpdomain extension was not discoverable there (resulting in module not found error). Injecting both into the sphinx environment ensures they are installed alongside Sphinx and reliably available during docs builds.

This approach keeps the extensions in the same environment as Sphinx, avoids discovery issues, and results in a cleaner, more maintainable setup.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, okay. Thanks so much for the explanation!

Copy link
Contributor

@adiati98 adiati98 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for adding the pipx inject and fixing the indentation, @matbcvo! 🚀

FYI, as the build failed, we need to wait for @RCheesley to merge this.

thank you GIF

@matbcvo matbcvo merged commit 5ce90b5 into mautic:5.x Sep 15, 2025
2 of 3 checks passed
@matbcvo matbcvo deleted the sphinx-php-domain branch September 15, 2025 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants