Repository navigation
Add getFlashAll() and getFlashNextAll() to FlashSegmentInterface - #3
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe flash segment interface adds methods to retrieve all flash values for the current and next request. The contract test fixture, README, and changelog document the new methods and beta2 compatibility change. ChangesFlash all-getter contract
Priority: ⬇️ Low — Defer the flash interface additions because they are a narrow pre-release contract change with no broader product-impact evidence. Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This change adds documented flash-value collection methods to the pre-release interface and updates its contract coverage. No current merge-blocking risk remains. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 26.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 15 functions across 2 files. (2 skipped: 2 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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 |
There was no way to read flash values without knowing their keys in advance, so rendering a list of flash messages meant reaching into $_SESSION directly. ManageableSegmentInterface::getSegment() covers this for plain values; these two do the same for the current and next request. Neither takes an alternative value. Unlike getFlash(), an all-getter has no "set to null" case to distinguish from "not set", so the empty array is the only sensible default. Proposed for Aura.Session by Jake Johns in 2016 (auraphp/Aura.Session#47 and #52) and deferred because it changed a published interface; the 7.0 line is still a pre-release, so the change is free to make now.
5a92939 to
66f1724
Compare
Summary
Adds two methods to
FlashSegmentInterface:They return every flash value for the current or the next request, so a
consumer can render flash messages without knowing the keys in advance.
ManageableSegmentInterface::getSegment()already covers this for plainvalues; there was no flash equivalent, which meant reaching into
$_SESSION[Session::FLASH_NOW][$name]directly. Symfony's FlashBag (all(),peekAll()) and Laravel both provide the equivalent.Why now
This was proposed for Aura.Session by @jakejohns in 2016
(auraphp/Aura.Session#47, auraphp/Aura.Session#52) and deferred for one
reason — adding methods to a published interface breaks every implementer.
The 7.0 line is still a pre-release (
7.0.0-beta1), so that objection does notapply yet. Once 7.0.0 is tagged final this becomes an 8.0 change.
On the signature
Neither method takes an
$altargument, which followsgetSegment()ratherthan the key-based getters.
$altexists to tell "key not set" apart from "keyset to null", and an all-getter has no such ambiguity: there are values or there
are none, and none is
[]. In this package every$altis on a key-basedgetter (
get(),getFlash(),getFlashNext()); the one whole-collectiongetter,
getSegment(), has none.Both return
arrayrather than?array, so the result is always safe toiterate. This differs slightly from
getSegment(), which returnsnullwhenthe segment is unset.
Impact
FlashSegmentInterface— free to do before7.0.0 final, and no released version declares it yet.
SegmentInterface(get/set),and its
NullSegment/ArraySegmentnever implement the flash contract.7.0.0-beta2first, since that branch implements methods this interfaceneeds to declare.
Tests
InterfaceContractTestcovers both — the signature/return-type table, and theanonymous class that proves the contracts compose without clashing. 23 tests
pass.
Summary by CodeRabbit
New Features
Documentation
Breaking Changes