Bug #73459 [NEW]: ReflectionFunction:getReturnType returns ReflectionNamedType object.

From: Date: Fri, 04 Nov 2016 15:19:31 +0000
Subject: Bug #73459 [NEW]: ReflectionFunction:getReturnType returns ReflectionNamedType object.
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-205183@lists.php.net to get a copy of this message
From: arjen at parse dot nl Operating system: Linux PHP version: 7.1.0RC5 Package: Reflection related Bug Type: Bug Bug description:ReflectionFunction:getReturnType returns ReflectionNamedType object. Description: ------------ In 7.1.0beta3 ReflectionNamedType was introduced, documentation not updated. The original ReflectionType is not instantiated anymore. https://github.com/php/php-src/commit/622d2f41d1cdb597f4fafecaaacf66e238742bd4 I don't think this class change is intentional, this would be an even bigger BC break than the discussed ReflectionType::__toString change discussed on internals: http://externals.io/thread/321 Testscript @ See https://3v4l.org/Pmu6c#v710beta3 Test script: --------------- <?php class B { public function test(): B { } } function getB(): B { } $rc = new ReflectionMethod('B', 'test'); var_dump((string)$rc->getReturnType(), $rc->getReturnType()); $rc = new ReflectionFunction('getB'); var_dump((string)$rc->getReturnType(), $rc->getReturnType()); Expected result: ---------------- string(1) "B" object(ReflectionType)#2 (0) { } string(1) "B" object(ReflectionType)#1 (0) { } Actual result: -------------- string(2) "\B" object(ReflectionNamedType)#2 (0) { } string(2) "\B" object(ReflectionNamedType)#1 (0) { } -- Edit bug report at https://bugs.php.net/bug.php?id=73459&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73459&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73459&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73459&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=73459&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=73459&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=73459&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=73459&r=needscript Try newer version: https://bugs.php.net/fix.php?id=73459&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=73459&r=support Expected behavior: https://bugs.php.net/fix.php?id=73459&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=73459&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=73459&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=73459&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73459&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=73459&r=dst IIS Stability: https://bugs.php.net/fix.php?id=73459&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=73459&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=73459&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=73459&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=73459&r=mysqlcfg

« previous php.bugs (#205183) next »