Replace deprecated DateTimeInterface::RFC7231 with literal format string#173
Replace deprecated DateTimeInterface::RFC7231 with literal format string#173
Conversation
DateTimeInterface::RFC7231 is deprecated in PHP 8.5 because the format hardcodes GMT timezone, ignoring the actual timezone of the instance. Since gmdate() is used here (always GMT), the behavior is unchanged. See: php/php-src#12989
|
@coderabbitai review |
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the
📝 WalkthroughWalkthroughAdded a new RFC7231 date format constant to Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
✅ Actions performedReview triggered.
|
Greptile OverviewGreptile Summary
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Caller
participant EtagSetter
participant DevEtagSetter
participant Header
participant RO as ResourceObject
Note over Caller,RO: Setting ETag + Last-Modified
Caller->>EtagSetter: __invoke(ro, time, httpCache)
EtagSetter->>RO: headers['ETag']=getEtag(...)
EtagSetter->>Header: RFC7231
EtagSetter->>RO: headers['Last-Modified']=gmdate(Header::RFC7231, time)
Caller->>DevEtagSetter: __invoke(ro, time?, httpCache?)
DevEtagSetter->>RO: headers['ETag']=uriEtag
DevEtagSetter->>Header: RFC7231
DevEtagSetter->>RO: headers['Last-Modified']=gmdate(Header::RFC7231, 0)
Note over Header: RFC7231 = "D, d M Y H:i:s \\G\\M\\T"
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 1.x #173 +/- ##
===========================================
Coverage 100.00% 100.00%
Complexity 246 246
===========================================
Files 53 53
Lines 746 746
===========================================
Hits 746 746 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@greptileai review |
|
✅ Actions performedReview triggered.
|
Additional Comments (1)
This PR introduces Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time! |
|
@greptile-apps Fixed in 0d58311. All three EtagSetter implementations now use |
|
Perfect! The fix looks good. You've:
This centralizes the date format in one place and avoids the PHP 8.5 deprecation. The implementation is cleaner and more maintainable than having the literal string or the deprecated constant scattered across multiple files. |
Summary
DateTimeInterface::RFC7231is deprecated in PHP 8.5 (php-src#12989)'D, d M Y H:i:s \G\M\T'inEtagSetterandDevEtagSettergmdate()always outputs GMTTest plan
composer testall tests passcomposer cs-fixno violations