|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #77064 Return type is contradictory
Submitted: 2018-10-26 06:22 UTC Modified: 2018-10-26 08:05 UTC
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: fabian dot picone at gmail dot com Assigned:
Status: Open Package: Date/time related
PHP Version: Irrelevant OS:
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: fabian dot picone at gmail dot com
New email:
PHP Version: OS:


 [2018-10-26 06:22 UTC] fabian dot picone at gmail dot com
From manual page:

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.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2018-10-26 08:05 UTC]
-Package: PHP Language Specification +Package: Date/time related
 [2018-10-26 08:05 UTC]
::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

[1] <>
[2] <>
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Feb 28 15:01:24 2021 UTC