Skip to content

[#532] Fix debugger replay for array payloads#558

Merged
armanist merged 2 commits into
quantum-php:masterfrom
armanist:issue/532-debugger-followup
Jul 6, 2026
Merged

[#532] Fix debugger replay for array payloads#558
armanist merged 2 commits into
quantum-php:masterfrom
armanist:issue/532-debugger-followup

Conversation

@armanist

@armanist armanist commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • Bug Fixes
    • Improved debugger message recording so array-style payloads are preserved and displayed correctly in the debug output.
    • Fixed cases where debugger information might not render reliably, improving consistency of the debug bar’s logged messages across tabs.

@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Debugger::createTab now resolves a MessagesCollector for each tab and logs stored messages through log($fn, $message[$fn]). Tests update the renderer and collector mocks and add coverage for replaying array payloads into the expected nested store shape.

Changes

Debugger createTab log fix

Layer / File(s) Summary
createTab log() invocation
src/Debugger/Debugger.php
Message recording now uses a resolved MessagesCollector and calls log($fn, $message[$fn]) instead of dynamically invoking a method from the message key.
Test updates for log-based recording
tests/Unit/Debugger/DebuggerTest.php
Renderer mocking and collector stubbing are adjusted, and a new test verifies array payloads are replayed through MessagesCollector::log and stored in the expected nested structure.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Suggested labels: enhancement

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: fixing debugger replay behavior for array payloads.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@codecov-commenter

codecov-commenter commented Jul 6, 2026

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 77.77778% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/Debugger/Debugger.php 77.77% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/Debugger/Debugger.php (1)

174-174: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Optional: prefer array_key_first() over key().

key($message) relies on the array's internal pointer being at the first element; array_key_first($message) (PHP 7.3+) is more explicit about intent and avoids any pointer-state dependency, even though it's safe here since $message always has exactly one key.

♻️ Optional refactor
-            $fn = key($message);
+            $fn = array_key_first($message);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/Debugger/Debugger.php` at line 174, Replace the use of key($message) in
Debugger::debugMessage handling with array_key_first($message) to make the
intent explicit and avoid relying on the array’s internal pointer state. Keep
the surrounding logic unchanged, and use the existing $fn assignment in that
method as the place to update.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/Debugger/Debugger.php`:
- Line 174: Replace the use of key($message) in Debugger::debugMessage handling
with array_key_first($message) to make the intent explicit and avoid relying on
the array’s internal pointer state. Keep the surrounding logic unchanged, and
use the existing $fn assignment in that method as the place to update.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 84a37304-ecaa-489f-9a9e-a224372db696

📥 Commits

Reviewing files that changed from the base of the PR and between 58c8f1a and dfe79cc.

📒 Files selected for processing (2)
  • src/Debugger/Debugger.php
  • tests/Unit/Debugger/DebuggerTest.php
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/Unit/Debugger/DebuggerTest.php

@armanist armanist merged commit 1554648 into quantum-php:master Jul 6, 2026
5 checks passed
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