PhpDocumentor如何避免在每个新注释行前面出现*

发布于 2024-09-18 07:20:11 字数 542 浏览 2 评论 0原文

根据 PhpDocumntor 的说法,为了将每个注释块转换为有效的文档,都需要像这样封装:

/**
* This function is used blah, blah, blah
* line 2
* line 2
* ...
*/
function MyFunc($string) {...

你知道是否可以(也许通过更改一些设置)避免被迫在每个注释前面放置一个星号线。 我基本上希望 PhpDocumentor 接受这些类型的注释并将其翻译为文档

/**
This function is used blah, blah, blah
line 2
line 2
...
*/
function MyFunc($string) {...

我这么问是因为 JsDOC 和 JavaDoc 不再需要在每个新行前面添加该死的星号 >,所以我想也许 PhpDocumentor 也可以通过欺骗它的设置来做到这一点,但我在 Google 上找不到任何关于此的信息。

According to PhpDocumntor each block of comment in order to be converted into a valid piece of documentation requires to be encapsulated like this:

/**
* This function is used blah, blah, blah
* line 2
* line 2
* ...
*/
function MyFunc($string) {...

Do you know if it's possible (maybe by changing some settings) to avoid being forced to place an asterisk in front of each line. I would basically like PhpDocumentor to accept and translate to documentation these type of comments:

/**
This function is used blah, blah, blah
line 2
line 2
...
*/
function MyFunc($string) {...

I'm asking because JsDOC and JavaDoc do not require a damn asterisk in front of each new line anymore, so I thought tat maybe also PhpDocumentor can do this by tricking a bit its settings, but I can't find anything about this on Google.

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

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

发布评论

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

评论(3

甜柠檬 2024-09-25 07:20:11

也许您应该使用一个编辑器来为您放置星号,这样您就不必手动执行此操作。几乎所有与 PHP 兼容的 IDE 都这样做,许多支持 PHP 的程序员编辑器也是如此。

像这样使用星号是标准约定。除非您的代码要隐藏在洞穴中,在大量水泥下,没有人会看到它,否则遵循标准约定可能是个好主意。

Maybe you should use an editor which places the asterisks for you, so you don't have to do it manually. Almost all PHP-compatible IDEs do it, as do many programmer's editors with PHP support.

Using the asterisk like that is the standard convention. Unless your code is going to be hidden away in a cave, under a ton of cement, where nobody will ever see it, it might be a good idea to follow the standard conventions.

笨笨の傻瓜 2024-09-25 07:20:11

您必须记住,如果您更改 PhpDoc 创建文档/自动完成信息的方式,最终用户如果希望查看带有文档/自动完成信息的代码,也需要更改其设置。

我不知道 PhpDoc 中有这个选项,但是您可以尝试使用 DocBlock 模板。

这是一个关于播放的链接与文档块模板。

You have to remember if you change the way PhpDoc creates the documentation / auto complete information, the end user will need to change their settings as well should they wish to view your code with documentation / auto complete information.

I am not aware of this option in PhpDoc however you could try playing with the DocBlock templates.

Here is a link on playing with the doc block templates.

如梦初醒的夏天 2024-09-25 07:20:11

使用 PhpDocumentor 无法做到这一点。

我放弃了 PhpDocumentor 并开始使用 Doxygen。对于任何可能感兴趣的人,Doxygen 允许最终用户以多种方式记录 PHP 函数,其中也如 JavaDoc 和 JsDoc。而且您不必被迫在文档中每一行的开头放置一个“该死的”星号,因此以下注释是可以的,并且将被 Doxygen 正确解析:

/**
... line1 ...
... line2 ...
*/
function MyFunc($string) {...  

There is no way to do it using PhpDocumentor.

I gave up on PhpDocumentor and started using Doxygen. For anyone who might be interested, Doxygen allows final user to document PHP function in many ways among which also like JavaDoc and JsDoc. And you are NOT forced to place a 'damn' asterisk at the beginning of each line in documentation, so the following comments are ok and will be properly parsed by Doxygen:

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