ReflectionParameter::getType() - php 反射机制
ReflectionParameter::getType()
版本:php7
(PHP 7)
Gets a parameter's type
说明
publicReflectionParameter::getType(void) :ReflectionTypeGets the associated type of a parameter.
参数
此函数没有参数。
返回值
Returns aReflectionTypeobject if a parameter type is specified,NULL
otherwise.
范例
Example #1ReflectionParameter::getType()Usage as of PHP 7.1.0
As of PHP 7.1.0,ReflectionType::__toString()is deprecated,andReflectionParameter::getType()mayreturn an instance ofReflectionNamedType. To get the name of the parameter type,ReflectionNamedType()is available in this case.
以上例程会输出:
int NULL
Example #2ReflectionParameter::getType()Usage before PHP 7.1.0
Output of the above example in PHP 7.0:
int NULL
参见
- ReflectionParameter::hasType() Checks if parameter has a type
- ReflectionType::__toString() To string
鹏仔微信 15129739599 鹏仔QQ344225443 鹏仔前端 pjxi.com 共享博客 sharedbk.com
图片声明:本站部分配图来自网络。本站只作为美观性配图使用,无任何非法侵犯第三方意图,一切解释权归图片著作权方,本站不承担任何责任。如有恶意碰瓷者,必当奉陪到底严惩不贷!