Skip to content
This repository has been archived by the owner on Apr 2, 2019. It is now read-only.

Support for DateTimeInterface #2

Open
rquadling opened this issue Mar 9, 2016 · 4 comments
Open

Support for DateTimeInterface #2

rquadling opened this issue Mar 9, 2016 · 4 comments

Comments

@rquadling
Copy link
Contributor

Hi.

Wanting to use DateTimeImmutable for DateRange, but the typehint is current DateTime.

Moving to DateTimeInterface would be ideal, but this is PHP5.5+ only.

Polyfilling of the DateTimeInterface and DateTimeImmutable is all possible, but the issue is that you cannot add the DateTimeInterface to DateTime so you would lose compatibility at some stage.

Maybe a branch for PHP5.5+ that uses DateTimeInterface typehint, rather than DateTime would be nice.

@gws
Copy link
Owner

gws commented Mar 10, 2016

Yeah, I agree with this.

I'm OK cutting a new release which just uses DateTimeInterface and drops support for anything less than PHP 5.5. PHP 5.4 is EOLed and people can continue to use older releases of this project if they cannot upgrade.

I'd also rather use DateTimeImmutable internally which would make all of the defensive cloning unnecessary.

@rquadling
Copy link
Contributor Author

Sounds good.

@rquadling
Copy link
Contributor Author

Hi. Time to do this now then? I think a major release that requires PHP7+? PHP 5.5 is now security fixes only.

@gws
Copy link
Owner

gws commented Feb 24, 2017

@rquadling I opened #9 for this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants