Doc #77064 [Opn]: Return type is contradictory
Edit report at https://bugs.php.net/bug.php?id=77064&edit=1
ID: 77064
Updated by: cmb@php.net
Reported by: fabian dot picone at gmail dot com
Summary: Return type is contradictory
Status: Open
Type: Documentation Problem
-Package: PHP Language Specification
+Package: Date/time related
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
::format() returns FALSE, if an argument has an incompatible
type[1], or if the DateTimeImmutable instance has not been
properly initialized[2].
Regarding the return type declaration, see
<http://news.php.net/php.doc/969386834>ff.
[1] <https://github.com/php/php-src/blob/php-7.3.0RC4/ext/date/php_date.c#L3170-L3172>
[2] <https://github.com/php/php-src/blob/php-7.3.0RC4/ext/date/php_date.c#L3174>
Previous Comments:
------------------------------------------------------------------------
[2018-10-26 06:22:18] fabian dot picone at gmail dot com
Description:
------------
---
From manual page: https://php.net/datetime.format
---
This doc has something that does not match.
The description of the method is "public string DateTimeImmutable::format ( string $format
)".
But the return value is documented as "Returns the formatted date string on success or FALSE on
failure." .
What is correct now, is the return a string or mixed?
My tests showed up to result in string, could not break it to receive bool.
So is this internally casted to string? Then you should adapt the return documentation.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=77064&edit=1
Thread (3 messages)