Bug #73470 [NEW]: Regression - ReflectionType::__toString() omits nullable type (?) prefix

From: Date: Mon, 07 Nov 2016 00:25:48 +0000
Subject: Bug #73470 [NEW]: Regression - ReflectionType::__toString() omits nullable type (?) prefix
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-205214@lists.php.net to get a copy of this message
From: ezzatron at gmail dot com Operating system: N/A PHP version: 7.1.0RC5 Package: Reflection related Bug Type: Bug Bug description:Regression - ReflectionType::__toString() omits nullable type (?) prefix Description: ------------ When a ReflectionType of a nullable type is obtained, its string representation does not include the question mark (?) prefix. This behavior seems to have changed in 7.1.0RC3. See https://3v4l.org/c21Nq Test script: --------------- <?php $r = new ReflectionFunction(function (?int $a): ?int {}); var_dump((string) $r->getParameters()[0]->getType()); var_dump((string) $r->getReturnType()); Expected result: ---------------- string(4) "?int" string(4) "?int" Actual result: -------------- string(3) "int" string(3) "int" -- Edit bug report at https://bugs.php.net/bug.php?id=73470&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73470&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73470&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73470&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=73470&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=73470&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=73470&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=73470&r=needscript Try newer version: https://bugs.php.net/fix.php?id=73470&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=73470&r=support Expected behavior: https://bugs.php.net/fix.php?id=73470&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=73470&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=73470&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=73470&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73470&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=73470&r=dst IIS Stability: https://bugs.php.net/fix.php?id=73470&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=73470&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=73470&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=73470&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=73470&r=mysqlcfg

« previous php.bugs (#205214) next »