ReflectionParameter::hasType
(PHP 7, PHP 8)
ReflectionParameter::hasType — Checks if parameter has a type
说明
Checks if the parameter has a type associated with it.
参数
此函数没有参数。
示例
示例 #1 ReflectionParameter::hasType() example
<?php
function someFunction(string $param, $param2 = null) {}
$reflectionFunc = new ReflectionFunction('someFunction');
$reflectionParams = $reflectionFunc->getParameters();
var_dump($reflectionParams[0]->hasType());
var_dump($reflectionParams[1]->hasType());
以上示例的输出类似于:
bool(true) bool(false)
+添加备注
用户贡献的备注
此页面尚无用户贡献的备注。
备份地址:http://www.lvesu.com/blog/php/reflectionparameter.hastype.php