3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
10 namespace Zend\Code\Reflection
;
12 use ReflectionParameter
;
14 class ParameterReflection
extends ReflectionParameter
implements ReflectionInterface
19 protected $isFromMethod = false;
22 * Get declaring class reflection object
24 * @return ClassReflection
26 public function getDeclaringClass()
28 $phpReflection = parent
::getDeclaringClass();
29 $zendReflection = new ClassReflection($phpReflection->getName());
30 unset($phpReflection);
32 return $zendReflection;
36 * Get class reflection object
38 * @return ClassReflection
40 public function getClass()
42 $phpReflection = parent
::getClass();
43 if ($phpReflection == null) {
47 $zendReflection = new ClassReflection($phpReflection->getName());
48 unset($phpReflection);
50 return $zendReflection;
54 * Get declaring function reflection object
56 * @return FunctionReflection|MethodReflection
58 public function getDeclaringFunction()
60 $phpReflection = parent
::getDeclaringFunction();
61 if ($phpReflection instanceof \ReflectionMethod
) {
62 $zendReflection = new MethodReflection($this->getDeclaringClass()->getName(), $phpReflection->getName());
64 $zendReflection = new FunctionReflection($phpReflection->getName());
66 unset($phpReflection);
68 return $zendReflection;
76 public function getType()
78 if ($this->isArray()) {
80 } elseif (method_exists($this, 'isCallable') && $this->isCallable()) {
84 if (($class = $this->getClass()) instanceof \ReflectionClass
) {
85 return $class->getName();
88 $docBlock = $this->getDeclaringFunction()->getDocBlock();
89 if (!$docBlock instanceof DocBlockReflection
) {
93 $params = $docBlock->getTags('param');
94 if (isset($params[$this->getPosition()])) {
95 return $params[$this->getPosition()]->getType();
101 public function toString()
103 return parent
::__toString();
106 public function __toString()
108 return parent
::__toString();