|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74742 ReflectionParameter::getType returns "int", gettype returns "integer"
Submitted: 2017-06-11 07:24 UTC Modified: 2017-06-11 08:02 UTC
From: pierre at lgse dot com Assigned:
Status: Wont fix Package: Variables related
PHP Version: 7.0Git-2017-06-11 (Git) OS: CentOS
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: pierre at lgse dot com
New email:
PHP Version: OS:


 [2017-06-11 07:24 UTC] pierre at lgse dot com
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.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-06-11 07:37 UTC] 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:52 UTC]
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:53 UTC]
Above code returns:

string(3) "int"
string(7) "integer"
 [2017-06-11 08:02 UTC]
-Summary: ReflectionParameter::getType +Summary: ReflectionParameter::getType returns "int", gettype returns "integer" -Status: Open +Status: Wont fix -Package: Reflection related +Package: Variables related
 [2017-06-11 08:02 UTC]
PHP has decided to go with "int", as seen in
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.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Feb 25 01:01:27 2024 UTC