Skip to content

Add RequestContextPanel#553

Draft
WarLikeLaux wants to merge 11 commits intoyiisoft:masterfrom
WarLikeLaux:feature/request-context-panel
Draft

Add RequestContextPanel#553
WarLikeLaux wants to merge 11 commits intoyiisoft:masterfrom
WarLikeLaux:feature/request-context-panel

Conversation

@WarLikeLaux
Copy link
Copy Markdown

@WarLikeLaux WarLikeLaux commented Mar 7, 2026

Q A
Is bugfix?
New feature? ✔️
Tests added? ✔️
Breaks BC?
Tests pass? ✔️
Fixed issues 552

What does this PR do?

Adds RequestContextPanel - a new debug panel that shows request context: route, controller/action with line number, layout, rendered views tree, controller behaviors, and route parameters.

Features

  • Route, controller class/file, action method and line number, layout path
  • View tree with type classification (View, Layout, Widget, Partial) and duplicate grouping
  • Controller behaviors table
  • Route parameters table
  • Click-to-copy on all values
  • "Copy as text" button for full summary
  • Toolbar summary with ⚙ icon

Coverage

58 tests.

Request-context classes coverage:

  • RequestContextPanel: 102/113 lines (90.27%), 14/19 methods
  • RequestContextTextFormatter: 37/38 lines (97.37%), 2/3 methods
  • RequestContextTreeFormatter: 54/55 lines (98.18%), 6/7 methods
  • RequestContextValueRenderer: 14/14 lines (100.00%), 2/2 methods

Combined for request-context classes: 207/220 lines (94.09%), 24/31 methods (77.42%).

Uncovered: getSummary()/getDetail() (require full Yii module view context), catch (ReflectionException) branches (unreachable in normal conditions), malformed-node skip path in tree grouping, and a few panel wiring branches around formatter lazy initialization.

image

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 7, 2026

Codecov Report

❌ Patch coverage is 81.61994% with 59 lines in your changes missing coverage. Please review.
✅ Project coverage is 23.89%. Comparing base (587dd75) to head (398df51).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/views/default/panels/requestContext/detail.php 33.33% 44 Missing ⚠️
src/panels/RequestContextPanel.php 90.15% 13 Missing ⚠️
src/panels/RequestContextTextFormatter.php 97.56% 1 Missing ⚠️
src/panels/RequestContextTreeFormatter.php 98.38% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master     #553      +/-   ##
============================================
+ Coverage     18.36%   23.89%   +5.52%     
- Complexity      657      758     +101     
============================================
  Files            78       84       +6     
  Lines          3496     3817     +321     
============================================
+ Hits            642      912     +270     
- Misses         2854     2905      +51     

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

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@WarLikeLaux WarLikeLaux force-pushed the feature/request-context-panel branch from 8b918b9 to 0060891 Compare March 7, 2026 11:34
Also make behavior class values copyable and clean up PHPStan baseline.
Replace direct Yii::$app access with getWebApplication() helper,
add PHPStan type aliases, extract buildActionInfo() method, and
use requestedParams instead of query params for route parameters.
Use getWebApplication() helper, fix event listener cleanup,
add tests for standalone action and missing action method cases,
and include 'file' key in groupNodes test data.
@WarLikeLaux WarLikeLaux force-pushed the feature/request-context-panel branch from 44aa581 to e06256b Compare March 7, 2026 11:50
- Replace FQCN with use-imports for Reflection classes
- Remove redundant getApplication()/getWebApplication() wrappers,
  use Yii::$app directly as in other panels
- Pass controller/action as parameters to resolve methods
  instead of re-fetching from Yii::$app in each method
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.

1 participant