Skip to content

date('u') #6613

@sylfabre

Description

@sylfabre

Feature request

According to the documentation, the date() function always returns '000000' when used with the 'u' parameter: you have to use DateTime to actually get the microseconds.

I'm wondering if this should be detected by phpstan, it is not detected right now: https://phpstan.org/r/32f5f74f-baba-41d2-8ba7-59a0c1d81169

If yes, I'm willing to contribute with a PR but I have two questions:

  • Which level should report this issue?
  • How to detect this? Looking for the "u" letter doesn't work as "previous" contains it and can used like this: "first day of the previous month"

Have a nice day!

Did PHPStan help you today? Did it make you happy in any way?

Yes it sure did by detecting issues in my CI pipeline :)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions