Re: Add an interface to a class dynamically.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Extend DateTime class, perhaps?

class MyDateTime extends DateTime implements DateTimeInterface
{
    ...
}

On Wed, Mar 9, 2016 at 3:59 PM, Richard Quadling <rquadling@xxxxxxxxx>
wrote:

> Hi.
>
> I'm still on PHP5.4 (please don't either (a) laugh, (b) cry).
>
> Wanting to use DateTimeImmutable. No problem with polyfilling
> DateTimeInterface and DateTimeImmutable.
>
> Issue is currently DateTime does not implement DateTimeInterface.
>
> Once you've all mopped the tears from your eyes, I'm guessing there's no
> way to "coerce" DateTime to allow it to pass typehints of
> DateTimeInterface?
>
> Regards,
>
> Richard Quadling.
>

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux