Reflection ReflectionIntersectionType::getTypes
(PHP 8 >= 8.1.0)
ReflectionIntersectionType::getTypes — intersection 유형에 포함된 유형을 반환합니다.
설명
public ReflectionIntersectionType::getTypes(): array
intersection 유형에 포함된 유형의 reflections를 반환합니다.
매개변수
이 함수에는 매개변수가 없습니다.
반환 값
ReflectionType 개체의 배열입니다.
Examples
예제 #1 ReflectionIntersectionType::getTypes() 예제
<?php
function someFunction(Iterator&Countable $value) {}
$reflectionFunc = new ReflectionFunction('someFunction');
$reflectionParam = $reflectionFunc->getParameters()[0];
var_dump($reflectionParam->getType()->getTypes());
?>
위의 예는 다음과 유사한 결과를 출력합니다.
array(2) { [0] => class ReflectionNamedType#4(0) { } [1] => class ReflectionNamedType#5(0) { } }
기타
- ReflectionType::allowsNull() - null이 허용되는지 확인
- ReflectionParameter::getType() - 매개변수의 유형을 가져옵니다.