Re: DateTimeImmutable
| From: | Derick Rethans | Date: | Fri, 29 Mar 2013 09:35:01 +0000 |
| Subject: | Re: DateTimeImmutable | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-66855@lists.php.net to get a copy of this message | ||
On Wed, 27 Mar 2013, Jordi Boggiano wrote:
> On 27.03.2013 13:18, Lars Strojny wrote:
>
> > Not really, as an interface guarantees behavior, which is not
> > possible for DateTimeImmutable and DateTime.
>
> The interface could be a subset of DateTime public methods, including
> only the readonly ones.
>
> I can't imagine how this could possibly be named in a sane way though :/
Name aside, an interface is sort of very useful otherwise we're ending
up with code like this all over the time:
first_arg_ce = zend_get_class_entry(start);
if ((first_arg_ce != date_ce_date) && (first_arg_ce != date_ce_immutable)) {
And that's a real pain, so an interface for just the gettings (and other
methods not modifying/changing anything is probably a good idea. I'll
see if I can work on this over the Easter weekend.
cheers,
Derick