Repository navigation
Issue/536 event foundation and boot stage lifecycle events - #573
Conversation
Introduce Quantum\Event\EventManager and the event() helper as the replacement for the Hook package. Event names need no pre-registration, listeners persist across dispatches and run in registration order, and the manager does not read config, so it is safe to use during boot. The Hook package is removed in a follow-up commit. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Delete Quantum\Hook (HookManager, HookException, hook() helper) and its tests, and read the debugger Hooks tab from event()->getRegistered(). Event replaces Hook with no aliases; no other caller existed. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Boot stages may declare BEFORE/AFTER constants naming an event. BootPipeline dispatches them around each stage with the AppContext as a named payload, and skips dispatch while the event() helper is not loaded yet. Environment, config, error handler, HTTP and modules stages declare boot.<stage>.before/after; the helpers and debugger stages declare none. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…t names Cover registering an event listener from an app helper during web boot: it fires at boot.modules.before, registers before the app config is loaded, and is not registered again on a second boot in the same process (helpers load with require_once). Align the Event and boot pipeline tests with repo conventions: name methods test<Subject><Behavior>, move the pipeline event tests into BootPipelineTest, and add EventExceptionTest to mirror EventException. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ngelog Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Test that logDebugInfo() records registered event listeners in the debugger Hooks cell, records nothing without listeners or when debug is disabled, and reset the shared debugger store in tearDown() so the static store does not leak between test classes. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 36 seconds. View limit detailsLimit details: You’ve used the included review currently available. Review configuration: ⚙️ Run configuration
📒 Files selected for processing (8)
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (23)
💤 Files with no reviewable changes (6)
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe Hook API is replaced by an Event API with persistent listeners and named payloads. Boot stages declare before and after event names, and ChangesEvents and boot lifecycle
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Feature Sequence Diagram(s)sequenceDiagram
participant BootPipeline
participant EventHelper as event()
participant EventManager
participant Stage
participant Listener
BootPipeline->>EventHelper: Dispatch BEFORE event with context
EventHelper->>EventManager: Resolve manager
EventManager->>Listener: Invoke listener with payload
BootPipeline->>Stage: Process stage with context
BootPipeline->>EventHelper: Dispatch AFTER event with context
EventHelper->>EventManager: Resolve manager
EventManager->>Listener: Invoke listener with payload
Merge Risk: ⚪ Minimal · up to No actionable merge-blocking issue is established; the change is mergeable after normal checks. 🚥 Pre-merge checks | ✅ 2 | ❌ 3❌ Failed checks (3 warnings)
✅ Passed checks (2 passed)
Full details: Linked Issues checkExplanation The implementation satisfies the new lifecycle behavior in Resolution Keep the existing Hook-style API available while adding the new event API, including compatible Full details: Out of Scope Changes checkExplanation The whole-PR diff adds unrelated CHANGELOG entries for adapter-based language providers and removal of Full details: Docstring CoverageExplanation Docstring coverage is 12.90% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 62 functions across 16 files. (1 skipped: 1 unsupported.) ✨ 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 |
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Delete the unused hooks_dir() helper and its test, rename the debugger tab constant Debugger::HOOKS to Debugger::EVENTS (tab value "events"), and drop the obsolete tests/_root hooks.php config fixture. Record the removal and rename in the changelog as part of the Hook to Event change. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Closes #536
What changed
Hookpackage withQuantum\Event:event()->listen()andevent()->dispatch(). Event names need no registration, sohooks.phpis no longer read; an empty name throwsEventException. Listeners now persist after dispatch and run in registration order.BootPipelinedispatchesBEFORE/AFTERevents that stages declare, with theAppContextas a named payload. The environment, config, error handler, HTTP and modules stages declareboot.<stage>.before|after.LoadHelpersStageandInitDebuggerStagedeclare none, and dispatch is skipped whileevent()is not loaded.Why
Optional integrations such as debugbar need to hook into specific boot points without hardcoded stages in core. This is the foundation for #537, #538 and #539.
Breaking changes
hook(),HookManagerandHookExceptionare removed with no aliases; listeners are no longer one-shot;shared/config/hooks.phpis obsolete. Documented inCHANGELOG.md.Validation
vendor/bin/phpunit: 1568 tests, 3840 assertions, 4 skipped (optional Twig not installed)composer cs:checkandcomposer phpstanpassedquantum-php-project: web and API routes respond, the debugbar renders, and a temporary helper listener received all ten boot events in ordercomposer rector:checkreports 22 files, none touched by this PRSummary by CodeRabbit