PHPDoc 2
| From: | Guillaume SMET | Date: | Sun, 11 Aug 2002 21:49:40 +0000 |
| Subject: | PHPDoc 2 | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-8302@lists.php.net to get a copy of this message | ||
Hi,
I don't know if it's an expected behaviour but here is the problem :
- class1 extends class2 extends class3
- there is a methodName method in class3 and class2 so the methodName method of class2 overrides the
methodName method of class3
- currently, PHPDoc considers that the method methodName is inherited from class2 (that's ok)
AND class3 (not ok)
This time, you can find the error in the analyser/PhpdocClassAnalyser.php file in the
addInheritedElements method : there's no test
to check if a method is already inherited.
Here is a workaround which works, it's certainly not perfect but the analysis of classes in
PHPDoc is far from perfect too :) :
function addInheritedElements($classname, $parentclass, $type) {
if (!isset($this->classes[$parentclass][$type]))
return false;
reset($this->classes[$parentclass][$type]);
while (list($elementname, $data) = each($this->classes[$parentclass][$type])) {
$alreadyInherited = false;
if(isset($this->classes[$classname]["inherited"][$type]))
{
foreach($this->classes[$classname]["inherited"][$type] AS $array)
{
if(isset($array[$elementname]))
{
$alreadyInherited = true;
}
}
}
if(!$alreadyInherited) {
if (!isset($this->classes[$classname][$type][$elementname])) {
$this->classes[$classname]["inherited"][$type][$parentclass][$elementname] = true;
} else {
$this->classes[$classname][$type][$elementname]["overrides"] = $parentclass;
$this->classes[$classname][$type][$elementname]["undoc"] =
$this->isUndocumented($parentclass, $type, $elementname);
$this->classes[$classname]["overrides"][$type][$parentclass][$elementname] = true;
reset($data);
while (list($field, $value)=each($data)) {
if (!isset($this->classes[$classname][$type][$elementname][$field]) &&
!isset($this->notinherited[$type][$field])) {
$this->classes[$classname][$type][$elementname][$field] = $value;
if ("params" == $field && "functions" == $type)
$this->classes[$classname][$type][$elementname]["paraminherited"] = true;
}
}
}
}
}
return true;
} // end func addInheritedElements
HTH
G.