Bug->Doc #74405 [Opn]: Undocumented 4th parameter of DateTime::setTime
| From: | fabien dot villepinte at gmail dot com | Date: | Sat, 15 Apr 2017 11:02:40 +0000 |
| Subject: | Bug->Doc #74405 [Opn]: Undocumented 4th parameter of DateTime::setTime | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-14630@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=74405&edit=1
ID: 74405
User updated by: fabien dot villepinte at gmail dot com
Reported by: fabien dot villepinte at gmail dot com
Summary: Undocumented 4th parameter of DateTime::setTime
Status: Open
-Type: Bug
+Type: Documentation Problem
Package: Documentation problem
-PHP Version: Irrelevant
+PHP Version: 7.1
Block user comment: N
Private report: N
New Comment:
This new parameter has been added in PHP 7.1:
https://github.com/php/php-src/commit/55626549d81d0feadb1d160be78fcf2b898a48cc#diff-7b738accc3d60f74c259da18588ddc5dR3421
but the documentation has not been updated accordingly.
Previous Comments:
------------------------------------------------------------------------
[2017-04-10 11:56:28] fabien dot villepinte at gmail dot com
Description:
------------
According the documentation the methods DateTime::setTime and DateTimeImmutable::setTime have 3
parameters, but by using reflection we can see there is a 4th parameter ("microseconds").
http://php.net/manual/en/datetime.settime.php
http://php.net/manual/en/datetimeimmutable.settime.php
Test script:
---------------
<?php
$rm = new ReflectionMethod(DateTime::class, "setTime");
printf("%d\n%d\n", $rm->getNumberOfParameters(),
$rm->getNumberOfRequiredParameters());
foreach ($rm->getParameters() as $param) {
printf("Parameter #%d (%s) %s OPTIONAL\n", $param->getPosition(),
$param->getName(), $param->isOptional() ? "IS" : "IS NOT");
}
Actual result:
--------------
4
2
Parameter #0 (hour) IS NOT OPTIONAL
Parameter #1 (minute) IS NOT OPTIONAL
Parameter #2 (second) IS OPTIONAL
Parameter #3 (microseconds) IS OPTIONAL
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=74405&edit=1