--TEST-- Reflecting object return type --FILE-- getMethod('a')->getReturnType(); var_dump($returnTypeOne->isBuiltin(), $returnTypeOne->getName()); $returnTypeTwo = (new ReflectionClass(Two::class))->getMethod('a')->getReturnType(); var_dump($returnTypeTwo->isBuiltin(), $returnTypeTwo->getName()); $returnTypea = (new ReflectionFunction('a'))->getReturnType(); var_dump($returnTypea->isBuiltin(), $returnTypea->getName()); ?> --EXPECT-- bool(true) string(6) "object" bool(true) string(6) "object" bool(true) string(6) "object"