Skip to content

Conversation

@RikudouSage
Copy link
Contributor

While the official signature (public DateTimeInterface::format ( string $format ) : string) doesn't contain the false part, in return value description you can read:

Returns the formatted date string on success or FALSE on failure.

While the official signature (`public DateTimeInterface::format ( string $format ) : string`) doesn't contain the `false` part, in [return value description](https://www.php.net/manual/en/datetime.format.php#refsect1-datetime.format-returnvalues) you can read:

`Returns the formatted date string on success or FALSE on failure.`
@ondrejmirtes
Copy link
Member

When the failure can occur? I want to avoid that everyone would have to check that they don't have false before manipulating the string.

@RikudouSage
Copy link
Contributor Author

Don't know what's the condition for it to actually return false, but the problem is when extending some of the classes - if you return anything else than string phpstan tells you it should return a string (in my case I was returning string|false which is valid as per documentation).

@ondrejmirtes
Copy link
Member

Please report that as a bug with phpstan.org link. Thanks.

@RikudouSage RikudouSage deleted the patch-1 branch September 16, 2020 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants