Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to document class properties in PHP 5 with phpDocumentor

Tags:

php

class

phpdoc

Take in consideration the following PHP 5 class:

class SomeClass {     //I want to document this property...     private $foo;       function __construct()     {      }      public function SetFoo($value)     {         $this->foo = $value;     }      public function GetFoo()     {         return $this->foo;     } } 

How in phpDocumentor will I document the $foo property? I'm not even sure it need to be documented but I would like to know how if if needs to...

I know how to document SetFoo() and GetFoo(), I'm just not sure about the private property (variable?).

Thanks!

like image 455
AlexV Avatar asked Feb 03 '10 19:02

AlexV


People also ask

How do you declare and access properties of a class in PHP?

Here, we declare a static property: $value. Then, we echo the value of the static property by using the class name, double colon (::), and the property name (without creating a class first).

How do I access properties in PHP?

Within class methods non-static properties may be accessed by using -> (Object Operator): $this->property (where property is the name of the property). Static properties are accessed by using the :: (Double Colon): self::$property .

What is declaring properties in PHP?

Introduction. Data members declared inside class are called properties. Property is sometimes referred to as attribute or field. In PHP, a property is qualified by one of the access specifier keywords, public, private or protected.


1 Answers

/**  * This is what the variable does. The var line contains the type stored in this variable.  * @var string  */ private $foo; 
like image 194
Billy ONeal Avatar answered Sep 20 '22 19:09

Billy ONeal