Bug #73105 [Opn]: ReflectionParameter returns nullable type when one is not used

From: Date: Sun, 18 Sep 2016 16:19:46 +0000
Subject: Bug #73105 [Opn]: ReflectionParameter returns nullable type when one is not used
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-204115@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73105&edit=1 ID: 73105 Updated by: cmb@php.net Reported by: mail at ciaranmcnulty dot com Summary: ReflectionParameter returns nullable type when one is not used Status: Open Type: Bug Package: Class/Object related Operating System: OSX PHP Version: 7.1.0RC2 Block user comment: N Private report: N New Comment: Related discussion: <http://marc.info/?t=147145076000010&r=1&w=2>. Previous Comments: ------------------------------------------------------------------------ [2016-09-18 12:08:04] mail at ciaranmcnulty dot com Description: ------------ Reflection normalises typehints on parameters with defaults of null to be Nullable typehints. This is a change of behaviour and caused issues in Prophecy (Mocking library) and probably other tools that lean on reflection. It's not appropriate for a minor version number. Test script: --------------- function foo(Bar $bar = null){} echo ((new ReflectionFunction('foo'))->getParameters()[0]->getType()); Expected result: ---------------- output 'Bar' Actual result: -------------- output '?Bar' ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=73105&edit=1

« previous php.bugs (#204115) next »