Handle the DateTimeImmutable class.#82
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughDateTimeExtension's type hints are widened from DateTime to DateTimeInterface across formatTimestamp, dateTime(), and timestamp() methods. A new dateTimeImmutable() public method is added returning DateTimeImmutable. Tests are extended to validate the new method's return type and timestamp bounds. ChangesDateTimeInterface widening and immutable support
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
nikophil
left a comment
There was a problem hiding this comment.
💯 for this, it is needed for a longtime in the original FakerPHP lib.
But I really think a DateTimeExtension should rely on an implementation of psr/clock, WDYT?
I opened another PR that would give us the opportunity to use a fixed seed and get reproducible results. However, some extensions are not fully ready for that yet, and Thanks to the seed, the calculated time offsets become reproducible, but the extension still relies on Using |
💯 OK with this |
Add the support of
DateTimeImmutableclass in theDateTimeExtension. Both as a valid argument forformatTimestamp,dateTime, andtimestampexisting methods, plus an additionaldateTimeImmutable. This is a must have feature for projects that preferDateTimeImmutableoverDateTimeand it fix a known issue of the oldFakerPHPimplementation.Summary by CodeRabbit
New Features
Bug Fixes
Tests