2

Is there any way with phpdoc to document the different values that a class property can take and what effect this will have. For example:-

class SomeClass {

   /**
   * Cell text align
   * 
   * null - table default
   * l - left align
   * r - right align
   * c - centre align
   * j - justify
   */
   public $align;

   Some code
}

Is there any way to make the value-description pairs be parsed by phpdoc so that it will turn them into a definition list or such like?

1
  • Unrelated: how do you intend to ensure that the variable contains these values? Have you thought about a protected variable with public getters and setters? Commented Mar 29, 2012 at 19:39

1 Answer 1

2

Something like this will become a <ul> in the documentation output:

class SomeClass {

   /**
    * Cell text align
    * 
    * Possible values: 
    * - null - table default
    * - l - left align
    * - r - right align
    * - c - centre align
    * - j - justify
    */
   public $align;

   // Some code
}

From the manual page on DocBlock description details.

Sign up to request clarification or add additional context in comments.

1 Comment

Soon we'll be able to look forward to PHPDocumentor 2 @ www.phpdoc.org, though it's not finished just yet as of this post.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.