Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Comments in code - style.

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Page: 1
Go to End
Author Topic: 1399 Views
  • mateusz
    Avatar
    Google Summer of Code Hacker
    27 Posts

    Comments in code - style. Link to this post

    I would like to know what style should we use in comments. I suppose that we should use phpDoc attributes but I would like to know which of them are necessary. The same question I have about Javascript.

  • Sam
    Avatar
    Administrator
    679 Posts

    Re: Comments in code - style. Link to this post

    Generally speaking, @param and @return are sufficient.

    /**
    * Short description of the class/method.
    * This is a longer explanation of what the method does, be sure to include any
    * assumptions that it makes; if it's designed to be called from some particular
    * place, it's worth mentioning that too.
    *
    * @param something This is a variable What should it contain?
    * @param other This is a variable. What should it contain?
    * @return Explain the return value
    */

    JavaScript doesn't currently have documentation auto-generated for it, but using a similar format to the PHP docs just keeps things consistent.

    1399 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.