
	                	                 
ReflectionClass::getInterfaces() 메서드는 클래스의 인터페이스를 반환합니다. 그러나 이 메서드는 인터페이스를 반환하는 대신, 인터페이스 이름을 반환하는 것처럼 보입니다.
이유는 ReflectionClass::getInterfaces() 메서드는 ReflectionClass 객체를 반환하는 것이 아니라, 인터페이스 이름을 반환하는 것입니다. 
예를 들어, 클래스 MyClassWithInterface가 MyInterface 인터페이스를 구현하고 있다고 가정해 보겠습니다.
#hostingforum.kr
php
class MyClassWithInterface extends MyClass implements MyInterface {}
이 경우, ReflectionClass::getInterfaces() 메서드를 호출하면 MyInterface 인터페이스의 이름을 반환합니다.
#hostingforum.kr
php
$reflectionClass = new ReflectionClass('MyClassWithInterface');
$interfaces = $reflectionClass->getInterfaces();
print_r($interfaces);
결과는 다음과 같습니다.
#hostingforum.kr
php
Array
(
    [0] => ReflectionClass Object
        (
            [name] => MyInterface
            [namespace] => 
            [filename] => 
            [filepath] => 
            [lineno] => 
            [nameWithoutNamespace] => MyInterface
            [namespaceName] => 
            [reflection] => ReflectionClass Object
                (
                    [name] => MyInterface
                    [namespace] => 
                    [filename] => 
                    [filepath] => 
                    [lineno] => 
                    [nameWithoutNamespace] => MyInterface
                    [namespaceName] => 
                    [reflection] => 
                )
            [isUserDefined] => 1
            [isInternal] => 
            [isUserDefinedStatic] => 1
            [isInternalStatic] => 
            [isInstantiable] => 1
            [isAbstract] => 
            [isFinal] => 
            [isCloneable] => 1
            [isUnsettable] => 
            [isSerialized] => 
        )
)
이 결과에서, ReflectionClass::getInterfaces() 메서드는 MyInterface 인터페이스의 이름을 반환하는 것을 볼 수 있습니다.
따라서, ReflectionClass::getInterfaces() 메서드는 인터페이스를 반환하는 것이 아니라, 인터페이스 이름을 반환하는 것입니다.
2025-04-28 19:08