Page MenuHomePhabricator

Support PSR-20
Open, Needs TriagePublic

Description

PSR-20 standardizes how to inject a (possibly fake) clock into another library, so it would be natural for a timestamp library to implement it. It would allow the use of ConvertibleTimestamp::setFakeTime() in tests involving PSR-20 compliant libraries.

Unfortunately the interface consists of a now() method, and ConvertibleTimestamp already has a static method by the same name (even if almost nothing uses it).

One approach would be to create a PSR-20 compatible wrapper object, and a method for generating one from a ConvertibleTimestamp. The other would be to deprecate now() (in a new 4.2.0 release?) and then replace it with the new PSR-20 version which has a different signature and purpose (in 5.0.0?).