[GH-ISSUE #1926] Rename Monolog\DateTimeImmutable to something else, e.g. JsonSerializableDateTimeImmutable #828

Closed
opened 2026-03-04 03:01:06 +03:00 by kerem · 4 comments
Owner

Originally created by @ruudk on GitHub (Nov 21, 2024).
Original GitHub issue: https://github.com/Seldaek/monolog/issues/1926

First of all, thanks for this amazing package 💙

So this is something that I'm bothered by for a long time. Every time I want to import DateTimeImmutable, PHPStorm asks me which one I want to import:

Screenshot 2024-11-21 at 12 14 13@2x

Even though the version of Monolog is namespaced, it's still annoying to think which one to pick.

I want to propose the following:

  • Rename Monolog\DateTimeImmutable to something different, for example: Monolog\JsonSerializableDateTimeImmutable
  • Keep the old Monolog\DateTimeImmutable as an alias for Monolog\JsonSerializableDateTimeImmutable, and mark it as deprecated.
  • In the next major, remove Monolog\DateTimeImmutable

Or if there is a better way to do this, I'm all ears. I would be happy to create the PR.

/cc @Seldaek

Originally created by @ruudk on GitHub (Nov 21, 2024). Original GitHub issue: https://github.com/Seldaek/monolog/issues/1926 First of all, thanks for this amazing package 💙 So this is something that I'm bothered by for a long time. Every time I want to import `DateTimeImmutable`, PHPStorm asks me which one I want to import: ![Screenshot 2024-11-21 at 12 14 13@2x](https://github.com/user-attachments/assets/1db5f8ae-25e0-4b9e-9319-448c0b09d7d4) Even though the version of Monolog is namespaced, it's still annoying to think which one to pick. I want to propose the following: * Rename `Monolog\DateTimeImmutable` to something different, for example: `Monolog\JsonSerializableDateTimeImmutable` * Keep the old `Monolog\DateTimeImmutable` as an alias for `Monolog\JsonSerializableDateTimeImmutable`, and mark it as deprecated. * In the next major, remove `Monolog\DateTimeImmutable` Or if there is a better way to do this, I'm all ears. I would be happy to create the PR. /cc @Seldaek
kerem 2026-03-04 03:01:06 +03:00
  • closed this issue
  • added the
    Feature
    label
Author
Owner

@Seldaek commented on GitHub (Nov 21, 2024):

Yeah i wonder if marking it internal would help? Can you try that locally maybe? There's a minor use case of passing it directly to addRecord but i dont think many people do that..

Renaming would be cleaner but a longer term solution.

Not sure what else is possible.

<!-- gh-comment-id:2490997116 --> @Seldaek commented on GitHub (Nov 21, 2024): Yeah i wonder if marking it internal would help? Can you try that locally maybe? There's a minor use case of passing it directly to addRecord but i dont think many people do that.. Renaming would be cleaner but a longer term solution. Not sure what else is possible.
Author
Owner

@ruudk commented on GitHub (Nov 21, 2024):

Marking it as internal won't do anything for PHPStorm.

<!-- gh-comment-id:2491009550 --> @ruudk commented on GitHub (Nov 21, 2024): Marking it as internal won't do anything for PHPStorm.
Author
Owner

@Seldaek commented on GitHub (Nov 21, 2024):

And did you try if an alias helps? Because I'm guessing it would also still suggest the alias, if so that'd only be fixed in 4.0

<!-- gh-comment-id:2491106876 --> @Seldaek commented on GitHub (Nov 21, 2024): And did you try if an alias helps? Because I'm guessing it would also still suggest the alias, if so that'd only be fixed in 4.0
Author
Owner

@ruudk commented on GitHub (Nov 21, 2024):

The alias won't hide it :(

So it will be a long time before I can enjoy it, but I still think it's good to prepare this for 4.0, so I created the PR:

<!-- gh-comment-id:2491201032 --> @ruudk commented on GitHub (Nov 21, 2024): The alias won't hide it :( So it will be a long time before I can enjoy it, but I still think it's good to prepare this for 4.0, so I created the PR: - https://github.com/Seldaek/monolog/pull/1928
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/monolog#828
No description provided.