Reflection ReflectionParameter::getDeclaringClass

(PHP 5 >= 5.1.3, PHP 7, PHP 8)

ReflectionParameter::getDeclaringClass — 클래스 선언을 가져옵니다.


설명

public ReflectionParameter::getDeclaringClass(): ?ReflectionClass

선언하는 클래스를 가져옵니다.


매개변수

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


반환 값

ReflectionClass 객체이거나 함수에서 호출된 경우 null입니다.


Examples

예제 #1 메소드를 선언한 클래스 가져오기

                  
<?php
class Foo
{
    public function bar(\DateTime $datetime)
    {
    }
}

class Baz extends Foo
{
}

$param = new \ReflectionParameter(['Baz', 'bar'], 0);

var_dump($param->getDeclaringClass());
                  
                

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

object(ReflectionClass)#2 (1) {
  ["name"]=>
  string(3) "Foo"
}
                

기타