I'm building a website with laravel and had some trouble with the documentation of the variables in an eloquent class. I've seen that the eloquent class uses an attributes-array to store all the variables. I'd like to document the available attributes in my classes so I can easily generate documentation and have code-completion with descriptions. I tried declaring the variables in the classes for documentation. I've tried declaring them public, but then the attributes-array isn't used anymore which is necessary. Declaring them protected works for the attributes-array, but the declared variables aren't used and the documentation and declarations aren't available in other files for code-completion, suggestions and descriptions. I also would like to avoid getter and setters. Is there a convenient way of documenting those variables in laravel?
Thanks in advance!
You can document member variables with @property type $variable
:
/**
* @property string $foo
* @property int $bar
*/
class MyModel extends Eloquent {
}