Reflection ReflectionProperty::hasType

(PHP 7 >= 7.4.0, PHP 8)

ReflectionProperty::hasType — 속성에 유형이 있는지 확인


설명

public ReflectionProperty::hasType(): bool

속성에 연결된 유형이 있는지 확인합니다.


매개변수

이 함수에는 매개변수가 없습니다.


반환 값

유형이 지정되면 true, 그렇지 않으면 false입니다.


Examples

예제 #1 ReflectionProperty::hasType() 예제

                  
<?php
class User
{
    public string $name;
}

$rp = new ReflectionProperty('User', 'name');
var_dump($rp->hasType());
?>
                  
                

위의 예는 다음을 출력합니다.

bool(true)
                

기타