Looking at a few examples in the Zend Framework, it seems that comments are mostly copied - and this sometimes leads to different comments.
The first example I will take is Zend_Http_Client_Adapter_Interface::connect , which is declared as:
public function connect($host, $port = 80, $secure = false);
And if you look at a class that implements this interface, for example Zend_Http_Client_Adapter_Curl , you will see:
public function connect($host, $port = 80, $secure = false)
So, copy-paste the parameters; and more information during implementation.
Another example would be Zend_Log_Writer_Abstract::_write :
abstract protected function _write($event);
And in the child class, for example Zend_Log_Writer_Db :
protected function _write($event)
Here, again, copy-paste; and a small modification to the parent class that has not been recreated in the child class.
Now what do I usually do?
- I generally think that developers do not write comments too often
- And generally forget to update them
- So, I try to make their life easier and not duplicate comments.
- If the comment in the child class should not differ from the comment in the parent class.
source share