Doc #77064 [Opn->Csd]: Return type is contradictory

From: Date: Wed, 07 Apr 2021 16:43:43 +0000
Subject: Doc #77064 [Opn->Csd]: Return type is contradictory
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-18692@lists.php.net to get a copy of this message
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
+Status:             Closed
 Type:               Documentation Problem
 Package:            Date/time related
 PHP Version:        Irrelevant
-Assigned To:        
+Assigned To:        cmb
 Block user comment: N
 Private report:     N

 New Comment:

This ticket is obsolete as of PHP 8.0.0, where the method no
longer returns false.  The documentation has already been updated.


Previous Comments:
------------------------------------------------------------------------
[2018-10-26 08:05:03] cmb@php.net

::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>

------------------------------------------------------------------------
[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)

« previous php.doc.bugs (#18692) next »