Add $traceFileMap parameter to HtmlRenderer (#171)#171
Merged
vjik merged 4 commits intoyiisoft:masterfrom Apr 2, 2026
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #171 +/- ##
============================================
+ Coverage 86.92% 87.18% +0.25%
- Complexity 216 225 +9
============================================
Files 19 19
Lines 696 710 +14
============================================
+ Hits 605 619 +14
Misses 91 91 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
$traceFileMap parameter to HtmlRenderer$traceFileMap parameter to HtmlRenderer (#171)
vjik
requested changes
Mar 28, 2026
There was a problem hiding this comment.
Pull request overview
Adds support in HtmlRenderer to remap file path prefixes used in stack trace display/link generation (e.g., container paths → host paths), addressing docker/IDE path mismatches (Issue #155).
Changes:
- Add new
HtmlRenderer::$traceFileMapconstructor parameter and implement prefix-based path mapping viamapFilePath(). - Apply mapped file paths when rendering call stack items (affecting both displayed path and trace link URL).
- Add PHPUnit coverage for mapping behavior and an integration-style assertion that mapping appears in rendered call stack output.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/Renderer/HtmlRenderer.php |
Introduces traceFileMap, implements mapFilePath(), and applies mapping during call stack item rendering. |
tests/Renderer/HtmlRendererTest.php |
Adds unit tests for mapping rules and verifies mapping appears in rendered call stack output. |
CHANGELOG.md |
Documents the new traceFileMap feature in the changelog. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
samdark
approved these changes
Mar 29, 2026
vjik
approved these changes
Apr 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Adds
$traceFileMapparameter toHtmlRendererfor mapping file path prefixes in trace display and links, useful when the app runs inside Docker and IDE needs host paths.Use cases
When running PHP inside a Docker container, stack trace file paths point to container paths (e.g.
/app/src/index.php) which the IDE cannot open. This parameter maps container path prefixes to host machine paths:The mapping applies to both the displayed file path and the trace link URL. First matching prefix wins. Source code reading still uses the original (container) path so that code snippets render correctly.
Matching is path-boundary-aware:
['/app' => '/local']maps/app/src/index.phpbut not/application/src/index.php. Both/and\separators are supported. Empty keys are silently skipped, root prefix (/) is handled as a special case.BC
No BC break: new constructor parameter with a default value of
[], existing code unaffected.