(PHP 7 >= 7.4.0, PHP 8)
ReflectionProperty::hasType — 檢查屬性是否有類型
此函式沒有參數。
範例 #1 ReflectionProperty::hasType() 範例
<?php
class User
{
public string $name;
}
$rp = new ReflectionProperty('User', 'name');
var_dump($rp->hasType());
?>
上述範例會輸出
bool(true)