Bug #74742 [Opn->Wfx]: ReflectionParameter::getType returns "int", gettype returns "integer"

From: Date: Sun, 11 Jun 2017 08:02:48 +0000
Subject: Bug #74742 [Opn->Wfx]: ReflectionParameter::getType returns "int", gettype returns "integer"
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-209474@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=74742&edit=1 ID: 74742 Updated by: requinix@php.net Reported by: pierre at lgse dot com -Summary: ReflectionParameter::getType +Summary: ReflectionParameter::getType returns "int", gettype returns "integer" -Status: Open +Status: Wont fix Type: Bug -Package: Reflection related +Package: Variables related Operating System: CentOS PHP Version: 7.0Git-2017-06-11 (Git) Block user comment: N Private report: N New Comment: PHP has decided to go with "int", as seen in https://wiki.php.net/rfc/scalar_type_hints_v5 https://wiki.php.net/rfc/reserve_more_types_in_php_7 so gettype() is the one that doesn't match, however it cannot be changed due to backwards compatibility. Besides, the is_* functions are generally recommended over gettype() anyways. Previous Comments: ------------------------------------------------------------------------ [2017-06-11 07:53:49] joey@php.net Above code returns: string(3) "int" string(7) "integer" ------------------------------------------------------------------------ [2017-06-11 07:52:46] joey@php.net <?php class A { public function __construct(int $a){ $this->a = $a; } } var_dump((string)(new ReflectionClass('A'))->getConstructor()->getParameters()[0]->getType(), gettype(0)); ------------------------------------------------------------------------ [2017-06-11 07:37:06] spam2 at rhsoft dot net Provide a code sample - I have written a fuzzy testsuite based on reflection and didn't face such issurs6 ------------------------------------------------------------------------ [2017-06-11 07:24:55] pierre at lgse dot com Description: ------------ ReflectionParameter::getType should return "integer" and not "int" on a constructor parameter of type "int". The types returned by ReflectionParameter::getType and the gettype() function should be the same. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=74742&edit=1

« previous php.bugs (#209474) next »