PHPDoc 自定义部分和分组

发布于 2024-09-28 01:47:08 字数 484 浏览 2 评论 0原文

我正在使用 Symfony Event Dispatcher。管理员可以启用或启用一系列模块,中央注册表将自动注册插件感兴趣的事件并处理事件的调度。

目前,我们使用 PHPDoc 生成所有文档,并拥有严格的 PHP Codesniffer 标准,确保文档完整且一致。

我想要做的是自动生成文档,在一个位置列出系统中可用的所有事件;我希望通过轻松找出可用的事件、这些事件中提供的数据以及可以随事件发送的响应来轻松开发新插件。

有没有办法使用 PHPDoc 来实现这一点?到目前为止,我最好的方法是向通知事件的方法添加一个 @uses 标记,引用我的 PluginRegistry 类;这样至少可以找到相关的方法,但它还远远不够理想,因为它没有提供额外的文档(什么事件可用,什么数据,什么返回数据甚至方法中有多少个事件)。

I am in the process of implementing an event dispatching system based in our application using the Symfony Event Dispatcher. A range of modules will be can be enabled or enabled by administrators and a central registry will automatically register the events that a plugin is interested in and handle the dispatching of events.

We currently use PHPDoc to generate all of our documentation and have a strict PHP Codesniffer standard that ensures documentation is complete and consistent.

What I want to do is automatically produce documentation that, in one place, lists all of the events which are available in the system; I want to make it easy to develop new plugins by making it easy to find out what events are available, what data is provided in these events and what responses can be sent with the events.

Is there any way to achieve this using PHPDoc? So far the best approach I have is to add a @uses tag to the method that notifies an event, referencing my PluginRegistry class; this way the related methods can at least be found, but it falls far short of ideal, as it provides no extra documentation (what event is available, what data, what return data or even how many events in the method).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

遮了一弯 2024-10-05 01:47:08

让所有事件实现一个特定的接口,然后您可以使用生成的 phpdoc 文件来找出哪些类实现该事件接口。

Let all your events implement a specific interface, then you can use your generated phpdoc files to find out which classes implement that event interface.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文