Verzeichnisstruktur phpBB-3.3.15
- Veröffentlicht
- 28.08.2024
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
ParameterReflection.php
001 <?php
002 /**
003 * Zend Framework (http://framework.zend.com/)
004 *
005 * @link http://github.com/zendframework/zf2 for the canonical source repository
006 * @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com)
007 * @license http://framework.zend.com/license/new-bsd New BSD License
008 */
009
010 namespace Zend\Code\Reflection;
011
012 use ReflectionParameter;
013
014 use function method_exists;
015
016 class ParameterReflection extends ReflectionParameter implements ReflectionInterface
017 {
018 /**
019 * @var bool
020 */
021 protected $isFromMethod = false;
022
023 /**
024 * Get declaring class reflection object
025 *
026 * @return ClassReflection
027 */
028 public function getDeclaringClass()
029 {
030 $phpReflection = parent::getDeclaringClass();
031 $zendReflection = new ClassReflection($phpReflection->getName());
032 unset($phpReflection);
033
034 return $zendReflection;
035 }
036
037 /**
038 * Get class reflection object
039 *
040 * @return null|ClassReflection
041 */
042 public function getClass()
043 {
044 $phpReflection = parent::getClass();
045 if ($phpReflection === null) {
046 return null;
047 }
048
049 $zendReflection = new ClassReflection($phpReflection->getName());
050 unset($phpReflection);
051
052 return $zendReflection;
053 }
054
055 /**
056 * Get declaring function reflection object
057 *
058 * @return FunctionReflection|MethodReflection
059 */
060 public function getDeclaringFunction()
061 {
062 $phpReflection = parent::getDeclaringFunction();
063 if ($phpReflection instanceof \ReflectionMethod) {
064 $zendReflection = new MethodReflection($this->getDeclaringClass()->getName(), $phpReflection->getName());
065 } else {
066 $zendReflection = new FunctionReflection($phpReflection->getName());
067 }
068 unset($phpReflection);
069
070 return $zendReflection;
071 }
072
073 /**
074 * Get parameter type
075 *
076 * @return string|null
077 */
078 public function detectType()
079 {
080 if (method_exists($this, 'getType')
081 && ($type = $this->getType())
082 && $type->isBuiltin()
083 ) {
084 return $type->getName();
085 }
086
087 // can be dropped when dropping PHP7 support:
088 if ($this->isArray()) {
089 return 'array';
090 }
091
092 // can be dropped when dropping PHP7 support:
093 if ($this->isCallable()) {
094 return 'callable';
095 }
096
097 if (($class = $this->getClass()) instanceof \ReflectionClass) {
098 return $class->getName();
099 }
100
101 $docBlock = $this->getDeclaringFunction()->getDocBlock();
102
103 if (! $docBlock instanceof DocBlockReflection) {
104 return null;
105 }
106
107 $params = $docBlock->getTags('param');
108
109 if (isset($params[$this->getPosition()])) {
110 return $params[$this->getPosition()]->getType();
111 }
112
113 return null;
114 }
115
116 /**
117 * @return string
118 */
119 public function toString()
120 {
121 return parent::__toString();
122 }
123
124 /**
125 * @return string
126 */
127 public function __toString()
128 {
129 return parent::__toString();
130 }
131 }
132