ReflectionParameter 类
(PHP 5, PHP 7, PHP 8)
简介
ReflectionParameter 检索函数或方法参数的相关信息。
要自行检查函数的参数,首先创建 ReflectionFunction 或 ReflectionMethod 的实例,然后使用它们的 ReflectionFunctionAbstract::getParameters() 方法来检索参数的数组。
类摘要
/* 属性 */
/* 方法 */
}属性
- name
-
参数名。只读,在尝试赋值的时候会抛出 ReflectionException。
更新日志
| 版本 | 说明 |
|---|---|
| 8.0.0 | 已移除 ReflectionParameter::export()。 |
目录
- ReflectionParameter::allowsNull — Checks if null is allowed
- ReflectionParameter::canBePassedByValue — Returns whether this parameter can be passed by value
- ReflectionParameter::__clone — Clone
- ReflectionParameter::__construct — Construct
- ReflectionParameter::export — Exports
- ReflectionParameter::getAttributes — Gets Attributes
- ReflectionParameter::getClass — 获取参数的 ReflectionClass 对象或为 null
- ReflectionParameter::getDeclaringClass — Gets declaring class
- ReflectionParameter::getDeclaringFunction — Gets declaring function
- ReflectionParameter::getDefaultValue — Gets default parameter value
- ReflectionParameter::getDefaultValueConstantName — Returns the default value's constant name if default value is constant or null
- ReflectionParameter::getName — Gets parameter name
- ReflectionParameter::getPosition — Gets parameter position
- ReflectionParameter::getType — Gets a parameter's type
- ReflectionParameter::hasType — Checks if parameter has a type
- ReflectionParameter::isArray — Checks if parameter expects an array
- ReflectionParameter::isCallable — Returns whether parameter MUST be callable
- ReflectionParameter::isDefaultValueAvailable — 检查默认是否可用
- ReflectionParameter::isDefaultValueConstant — Returns whether the default value of this parameter is a constant
- ReflectionParameter::isOptional — Checks if optional
- ReflectionParameter::isPassedByReference — Checks if passed by reference
- ReflectionParameter::isPromoted — Checks if a parameter is promoted to a property
- ReflectionParameter::isVariadic — Checks if the parameter is variadic
- ReflectionParameter::__toString — To string