Skip to content

Refactor internal request state into DispatchContext#165

Merged
alganet merged 1 commit into
masterfrom
dispatch-context
Mar 17, 2026
Merged

Refactor internal request state into DispatchContext#165
alganet merged 1 commit into
masterfrom
dispatch-context

Conversation

@alganet

@alganet alganet commented Mar 17, 2026

Copy link
Copy Markdown
Member

Replace the old local Request wrapper with an explicitly internal DispatchContext built around the PSR-7 server request.

Changes:

  • rename src/Request.php to src/DispatchContext.php
  • keep the PSR request as the canonical transport object via $request
  • replace shadow request fields with explicit context accessors and mutators for effective method/path
  • rename Router::$request to Router::$context
  • rename Router::dispatchRequest() to Router::dispatchContext()
  • update router dispatch flow, routes, and routines to accept DispatchContext instead of the misleading Request type
  • migrate tests and stubs to the new terminology and API
  • add router regressions for empty global OPTIONS handling and Router stringification through the active dispatch context

Verification:

  • composer qa
  • changed executable lines verified at 100% coverage

Replace the old local Request wrapper with an explicitly internal
DispatchContext built around the PSR-7 server request.

Changes:
- rename src/Request.php to src/DispatchContext.php
- keep the PSR request as the canonical transport object via $request
- replace shadow request fields with explicit context accessors and mutators
  for effective method/path
- rename Router::$request to Router::$context
- rename Router::dispatchRequest() to Router::dispatchContext()
- update router dispatch flow, routes, and routines to accept
  DispatchContext instead of the misleading Request type
- migrate tests and stubs to the new terminology and API
- add router regressions for empty global OPTIONS handling and Router
  stringification through the active dispatch context

Verification:
- composer qa
- changed executable lines verified at 100% coverage
@codecov-commenter

codecov-commenter commented Mar 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.14%. Comparing base (e2a76c4) to head (f4ba645).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master     #165      +/-   ##
============================================
+ Coverage     96.46%   97.14%   +0.67%     
- Complexity      441      445       +4     
============================================
  Files            27       27              
  Lines          1076     1085       +9     
============================================
+ Hits           1038     1054      +16     
+ Misses           38       31       -7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@alganet alganet marked this pull request as ready for review March 17, 2026 22:45
@alganet alganet merged commit 2cf5a76 into master Mar 17, 2026
6 checks passed
@alganet alganet deleted the dispatch-context branch March 17, 2026 22:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants