ReflectionProperty::hasType
(PHP 7 >= 7.4.0, PHP 8)
ReflectionProperty::hasType — Checks if property has a type
参数
此函数没有参数。
示例
示例 #1 ReflectionProperty::hasType() example
<?php
class User
{
public string $name;
}
$rp = new ReflectionProperty('User', 'name');
var_dump($rp->hasType());
?>
以上示例会输出:
bool(true)
参见
- ReflectionProperty::getType() - Gets a property's type
- ReflectionProperty::isInitialized() - Checks whether a property is initialized
+添加备注
用户贡献的备注
此页面尚无用户贡献的备注。
备份地址:http://www.lvesu.com/blog/php/reflectionproperty.hastype.php