Lets say I have parent class with some variable, which has phpdoc:
class Parent
{
/**
* This variable stores some important value that
* is going to be changed in child classes
* @var integer
*/
public $variable = 0;
}
Now I am writing child class, which has this variable overriden:
class Child extends Parent
{
public $variable = 10;
}
So my question is: what phpdoc should I write for $variable in Child class, so I do not have to copy and paste variable description? Same question goes for methods. Help is much appreciated.
Update: I've asked this question after I've seen errors after creating phpdoc, like "No summary for property $variable" in Child class. If I add this summary - error disappears, but phpdoc shows description from Parent class anyway, no matter what I write in Child class. What am I doing wrong?
That behavior sounds like a bug to me. A complete lack of docblock on the child class property should result in the parent property docblock being inherited completely. Please report it as an issue at the github repo.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With