Most common/liked syntax for in-code documentation (comments)?

≯℡__Kan透↙ 提交于 2019-12-08 13:35:52

it's phpdoc format, a way to auto document your code using comments.

http://www.phpdoc.org/

Eclipse appears to be picking up phpDoc (probably the most common solution for PHP projects and one I'm happily recommend) elements, which are a great way of documenting the various classes, methods, method arguments, etc. as well as providing a means of tracking to-do's, marking functions/methods as deprecated, etc.

Additionally, you can of course generation documentation in HTML, PDF, CHM format, etc. using the phpdoc command line tool

You can find out more (and check out the required syntax) on the phpDoc site.

Eclipse will do it's best to use heredoc/phpdoc comments which can then be compiled into documentation. Try writing a function then putting a /** comment above it and you'll see ecplise automatically adds the function parameters in the comment.

If you have a look at the Java API, that is the kind of documentation that get's compiled from that style of comments.

If you don't think you're ever going to compile your comments into docs then don't feel bound by it and extra comments in code are always useful. However, it is a documentation standard so it's not a bad thing. I only tend to use this style of commenting for things that I know lots of other people will be looking over.

As pointed out by others, using that kind of comments for phpdoc can be very valuable. But I think it is not only about generating documentation, but making it easier for you to write code as well. Some IDEs (at least Netbeans) use phpdoc comments for providing better autocomplete features than otherwise would be available.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!