Skip to content

Support DateTimeImmutable #2604

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
tmarsteel opened this issue Sep 8, 2017 · 0 comments
Open

Support DateTimeImmutable #2604

tmarsteel opened this issue Sep 8, 2017 · 0 comments

Comments

@tmarsteel
Copy link

tmarsteel commented Sep 8, 2017

In several places the Code assumes that \DateTime is being used. That is a problem for me and i would like the bundle to support \DateTimeImmutable. From what i've seen by searching for DateTime its only a few places to change so i will not do a fork & PR for this:

Based off of v2.0.1 (4f92bfb):

  • Change the Signatures of UserInterface::setLastLogin and UserInterface::setPasswordRequestedAt (and implementation in User accordingly) to accept \DateTimeInterface instead of \DateTime.
  • In User.php line 479 change the instanceof check from \DateTime to \DateTimeInterface

I can currently not reset the password of my users because the password reset date is a DateTimeImmutable. That is caused by that instanceof check. I can work around this pretty easily but i still think that code with as much usage as this bundle should not have that kind of bug. You have to, at the very least, throw an exception near that instanceof so that people know what the issue is and dont have to dig into the code.

On the Background of this feature request:

I use \DateTimeImmutable exclusively because the mutability of \DateTime has caused a great deal of trouble for me in the past.

@tmarsteel tmarsteel changed the title Support DaetTimeImmutable Support DateTimeImmutable Sep 8, 2017
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

No branches or pull requests

1 participant