diff options
Diffstat (limited to 'Zend/tests/object_types/return_type_reflection.phpt')
-rw-r--r-- | Zend/tests/object_types/return_type_reflection.phpt | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/Zend/tests/object_types/return_type_reflection.phpt b/Zend/tests/object_types/return_type_reflection.phpt new file mode 100644 index 0000000000..461199febe --- /dev/null +++ b/Zend/tests/object_types/return_type_reflection.phpt @@ -0,0 +1,31 @@ +--TEST-- +Reflecting object return type +--FILE-- +<?php + +interface One { + public function a() : object; +} + +class Two implements One { + public function a() : object {} +} + +function a() : object {} + +$returnTypeOne = (new ReflectionClass(One::class))->getMethod('a')->getReturnType(); +var_dump($returnTypeOne->isBuiltin(), (string)$returnTypeOne); + +$returnTypeTwo = (new ReflectionClass(Two::class))->getMethod('a')->getReturnType(); +var_dump($returnTypeTwo->isBuiltin(), (string)$returnTypeTwo); + +$returnTypea = (new ReflectionFunction('a'))->getReturnType(); +var_dump($returnTypea->isBuiltin(), (string)$returnTypea); + +--EXPECTF-- +bool(true) +string(6) "object" +bool(true) +string(6) "object" +bool(true) +string(6) "object"
\ No newline at end of file |