1 | <?php |
||
5 | class ReflectionParameter extends Reflection |
||
6 | { |
||
7 | protected $declaringFunction; |
||
8 | protected $type; |
||
9 | protected $byRef; |
||
10 | protected $required = true; |
||
11 | protected $variadic = false; |
||
12 | protected $defaultType = 'null'; |
||
13 | protected $defaultValue = null; |
||
14 | protected $constantName = null; |
||
15 | |||
16 | /** |
||
17 | * Gets the declaring function or method. |
||
18 | * |
||
19 | * @return ReflectionFunction |
||
20 | */ |
||
21 | 3 | public function getDeclaringFunction() |
|
25 | |||
26 | /** |
||
27 | * Gets the declaring class for a method. |
||
28 | * |
||
29 | * @return ReflectionClass|ReflectionTrait|ReflectionInterface|null Always null for a function |
||
30 | */ |
||
31 | 3 | public function getDeclaringClass() |
|
39 | |||
40 | 3 | public function getFileName() |
|
44 | |||
45 | /** |
||
46 | * Checks if the parameter is passed in by reference. |
||
47 | * |
||
48 | * @return bool |
||
49 | */ |
||
50 | 3 | public function isByRef() |
|
54 | |||
55 | /** |
||
56 | * Checks if the parameter is passed in by reference. |
||
57 | * |
||
58 | * @return bool |
||
59 | */ |
||
60 | public function isPassedByReference() |
||
64 | |||
65 | /** |
||
66 | * Checks if the parameter can be passed by value. |
||
67 | * |
||
68 | * @return bool |
||
69 | */ |
||
70 | public function canBePassedByValue() |
||
74 | |||
75 | /** |
||
76 | * Checks if the parameter is required. |
||
77 | * |
||
78 | * @return bool |
||
79 | */ |
||
80 | 15 | public function isRequired() |
|
84 | |||
85 | /** |
||
86 | * Checks if the parameter is declared as a variadic parameter. |
||
87 | * |
||
88 | * @return bool |
||
89 | */ |
||
90 | public function isVariadic() |
||
94 | |||
95 | /** |
||
96 | * Checks if the parameter is optional. |
||
97 | * |
||
98 | * @return bool |
||
99 | */ |
||
100 | public function isOptional() |
||
104 | |||
105 | /** |
||
106 | * Gets the associated type of a parameter. |
||
107 | * |
||
108 | * @return ReflectionType ReflectionType if a parameter type is specified, null otherwise. |
||
109 | */ |
||
110 | 3 | public function getType() |
|
115 | |||
116 | /** |
||
117 | * Gets the class type hinted for the parameter as a ReflectionClass object. |
||
118 | * |
||
119 | * @return ReflectionClass|null |
||
120 | */ |
||
121 | public function getClass() |
||
131 | |||
132 | /** |
||
133 | * Checks if the parameter has a type associated with it. |
||
134 | * |
||
135 | * @return bool |
||
136 | */ |
||
137 | public function hasType() |
||
142 | |||
143 | /** |
||
144 | * Checks if the parameter expects an array. |
||
145 | * |
||
146 | * @return bool |
||
147 | */ |
||
148 | public function isArray() |
||
153 | |||
154 | /** |
||
155 | * Checks if the parameter expects a callable. |
||
156 | * |
||
157 | * @return bool |
||
158 | */ |
||
159 | public function isCallable() |
||
164 | |||
165 | /** |
||
166 | * Checks whether the parameter allows NULL. |
||
167 | * |
||
168 | * @return bool |
||
169 | */ |
||
170 | public function allowsNull() |
||
182 | |||
183 | /** |
||
184 | * Checks if a default value for the parameter is available. |
||
185 | * |
||
186 | * @return bool |
||
187 | */ |
||
188 | public function isDefaultValueAvailable() |
||
192 | |||
193 | 3 | public function getDefault() |
|
197 | |||
198 | 3 | public function getDefaultType() |
|
202 | |||
203 | /** |
||
204 | * Gets default parameter value. |
||
205 | * |
||
206 | * @throws \ReflectionException If the parameter is required |
||
207 | * |
||
208 | * @return mixed |
||
209 | */ |
||
210 | 12 | public function getDefaultValue() |
|
218 | |||
219 | /** |
||
220 | * Returns the default value's constant name if default value is constant or null. |
||
221 | * |
||
222 | * @return string|null |
||
223 | */ |
||
224 | public function getDefaultValueConstantName() |
||
228 | |||
229 | /** |
||
230 | * Returns whether the default value of this parameter is a named constant. |
||
231 | * |
||
232 | * @return bool |
||
233 | */ |
||
234 | public function isDefaultValueConstant() |
||
238 | |||
239 | /** |
||
240 | * Gets the position of the parameter. |
||
241 | * |
||
242 | * The position of the parameter, left to right, starting at position #0. |
||
243 | * |
||
244 | * @return int |
||
245 | */ |
||
246 | public function getPosition() |
||
254 | |||
255 | 963 | public function setDeclaringFunction(ReflectionFunctionAbstract $declaringFunction) |
|
261 | |||
262 | 963 | public function setType($type) |
|
268 | |||
269 | 963 | public function setByRef($byRef) |
|
275 | |||
276 | 774 | public function setRequired($required) |
|
282 | |||
283 | 963 | public function setVariadic($variadic) |
|
289 | |||
290 | 774 | public function setDefault($type, $value) |
|
297 | |||
298 | 174 | public function setDefaultValueConstantName($constantName) |
|
304 | } |
||
305 |