Bug #76131 [Opn->Csd]: ReflectionParameter names and documentation variable names not matching up
| From: | krakjoe@php.net | Date: | Tue, 27 Mar 2018 20:01:07 +0000 |
| Subject: | Bug #76131 [Opn->Csd]: ReflectionParameter names and documentation variable names not matching up | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-214499@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=76131&edit=1
ID: 76131
Updated by: krakjoe@php.net
Reported by: timothy dot fisher at riosalado dot edu
Summary: ReflectionParameter names and documentation variable
names not matching up
-Status: Open
+Status: Closed
Type: Bug
Package: Reflection related
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of carusogabriel34@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=63934ea71e719cfc43e94167474f936d8da938de
Log: Fix #76131 some arginfo params are different from the documentation
Previous Comments:
------------------------------------------------------------------------
[2018-03-24 13:12:17] cmb@php.net
See <https://github.com/php/php-src/pull/3193>.
------------------------------------------------------------------------
[2018-03-21 22:47:10] timothy dot fisher at riosalado dot edu
Description:
------------
---
From:
http://php.net/manual/en/datetime.construct.php
http://php.net/manual/en/arrayobject.construct.php
---
---
See: https://stackoverflow.com/q/49416234/5749974
---
When reflecting on some native PHP class constructs, the names of the parameters do not match up to
the names of the variables in the PHP docs. It also seems as if the type-hint in the docs of the
DateTime constructor are missing when using the ReflectionParameter::getClass() method.
Test script:
---------------
---
See: https://stackoverflow.com/q/49416234/5749974
---
$reflector = new ReflectionClass('DateTime');
$constructor = $reflector->getConstructor();
if ($constructorParams = $constructor->getParameters()) {
foreach ($constructorParams as $i => $param) {
$name = $param->getClass() ? $param->getClass()->name : $param->name;
var_dump($name);
}
}
$reflector = new ReflectionClass('ArrayObject');
$constructor = $reflector->getConstructor();
if ($constructorParams = $constructor->getParameters()) {
foreach ($constructorParams as $i => $param) {
$name = $param->getClass() ? $param->getClass()->name : $param->name;
var_dump($name);
}
}
Expected result:
----------------
DateTime: According to the docs, the names of the parameters should be "time" and
"timezone". The type-hints are also missing, for example "timezone" is a
"DateTimeZone".
ArrayObject: According to the docs, the names of the parameters should be "input",
"flags", and "iterator_class".
Actual result:
--------------
DateTime: Names of the parameters are "time" and "object", with no type-hints.
ArrayObject: Names of the parameters are "input", "ar_flags", and
"iterator_class"
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=76131&edit=1