Skip to content

Fix newly reported PHPStan errors#221

Merged
swissspidy merged 1 commit into
mainfrom
fix/phpstan
Jul 20, 2026
Merged

Fix newly reported PHPStan errors#221
swissspidy merged 1 commit into
mainfrom
fix/phpstan

Conversation

@swissspidy

@swissspidy swissspidy commented Jul 20, 2026

Copy link
Copy Markdown
Member

Description

This PR resolves 3 static analysis errors reported by PHPStan:

  1. src/Formatter.php: Ensures rows passed to cli\Table::addRow() and footers passed to cli\Table::setFooters() are properly typed as array<int, string> by casting scalar cell values to strings.
  2. src/Profiler.php: Resolves object class names using get_class() before concatenating with :: in get_name_location_from_callback() to prevent binary concatenation issues between objects and strings.

Checks

  • composer lint passes
  • composer phpcs passes
  • composer phpstan passes

Summary by CodeRabbit

  • Bug Fixes
    • Improved table rendering by safely displaying non-scalar cell and total values as blank entries.
    • Corrected profiler callback naming for callbacks associated with object instances.

@swissspidy
swissspidy requested a review from a team as a code owner July 20, 2026 17:05
@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: e03848b4-c815-4d3a-8c12-af1d1d723510

📥 Commits

Reviewing files that changed from the base of the PR and between e6e9fa3 and c673897.

📒 Files selected for processing (2)
  • src/Formatter.php
  • src/Profiler.php

📝 Walkthrough

Walkthrough

Formatter table rows and footers now normalize values to strings, and profiler callback naming now derives object callback class names from the callback target.

Changes

Table output normalization

Layer / File(s) Summary
Normalize table rows and footers
src/Formatter.php
show_table() converts scalar row and footer values to strings and replaces non-scalars with empty strings before rendering.

Callback name resolution

Layer / File(s) Summary
Resolve object callback classes
src/Profiler.php
get_name_location_from_callback() uses the actual class of object callback targets when forming callback names.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 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 accurately reflects the main purpose of the change: fixing newly reported PHPStan errors.
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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/phpstan

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

@codecov

codecov Bot commented Jul 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@swissspidy swissspidy added this to the 2.1.8 milestone Jul 20, 2026
@swissspidy
swissspidy merged commit e622714 into main Jul 20, 2026
66 of 67 checks passed
@swissspidy
swissspidy deleted the fix/phpstan branch July 20, 2026 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant