Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Trivial
-
Resolution: Fixed
-
Affects Version/s: 1.8.4
-
Fix Version/s: 1.9.3
-
Component/s: Zend_Reflection
-
Labels:None
Description
Looking to following block code:
Foo.php
class Foo {
/**
* @param integer $a
* @param boolean $b
* @return boolean
*/
public function bar($a, $b) {
$r = new Zend_Reflection_Class($this);
$p = $r->getMethod('bar')->getParameters();
$t = $p[0]->getType();
//...
}
}
,the value of $t is null instead of integer. The problem seems to be on 111 and 112 lines, from Reflection/Parameter.php file ;value of "$this->getPosition()" should not decrement:
Parameter.php.patch
--- Parameter.php 2009-07-08 15:51:53.000000000 +0300
+++ ParameterFix.php 2009-07-08 17:34:50.000000000 +0300
@@ -108,8 +108,8 @@
if ($docblock = $this->getDeclaringFunction()->getDocblock()) {
$params = $docblock->getTags('param');
- if (isset($params[$this->getPosition() - 1])) {
- return $params[$this->getPosition() - 1]->getType();
+ if (isset($params[$this->getPosition()])) {
+ return $params[$this->getPosition()]->getType();
}
}
i confirm this bag also