Skip to content

Fix stale/inaccurate PHPDoc in core/API/Proxy, ResponseBuilder, Access#24736

Open
sgiehl wants to merge 3 commits into
5.x-devfrom
fix-comments-2
Open

Fix stale/inaccurate PHPDoc in core/API/Proxy, ResponseBuilder, Access#24736
sgiehl wants to merge 3 commits into
5.x-devfrom
fix-comments-2

Conversation

@sgiehl

@sgiehl sgiehl commented Jul 1, 2026

Copy link
Copy Markdown
Member

Summary

Part of an ongoing pass to fix PHPDoc comments across core/ and plugins/ (excluding @api-tagged classes/methods and API.php classes) that no longer match the actual code behavior, or whose @param/@return annotations are wrong/incomplete.

This PR covers:

  • core/API/Proxy.php: removed a stale claim about API-call performance logging via a log_api_call config setting that doesn't exist anywhere in the codebase; fixed a misleading registerClass() param example; corrected the $requiredParameters shape description used by two methods; added missing types on two untyped params.
  • core/API/ResponseBuilder.php: widened decorateExceptionWithDebugTrace()'s return type since it can return the original Throwable unchanged, not just Exception; documented a previously-untyped constructor param.
  • core/Access.php: fixed two copy-pasted docblocks — isUserHasSomeWriteAccess() was documented as checking "admin access" and checkUserHasWriteAccess() was documented as checking "VIEW or ADMIN access", both copied from sibling methods; completed getRoleForSite()'s return value example; added a missing param type.

One phpstan-baseline.neon entry was removed because the ResponseBuilder return type fix resolved a real, previously-suppressed PHPStan finding.

core/API/NoDefaultValue.php, core/API/Request.php (class-level @api, out of scope), core/Access/CapabilitiesProvider.php, core/Access/Capability.php, core/Access/Role.php, core/Access/Role/Admin.php, and core/Access/Role/View.php needed no changes.

Checklist

  • [✔] I have understood, reviewed, and tested all AI outputs before use
  • [✔] All AI instructions respect security, IP, and privacy rules
sgiehl added 3 commits July 1, 2026 18:01
Remove claims about API call performance logging via a "log_api_call"
config setting; no such logging or config key exists anywhere in the
codebase, so this was stale documentation of removed functionality.
Also correct registerClass()'s misleading param example (it takes a
fully qualified class name, not a bare module name), fix the
$requiredParameters shape description on the two
getXRequestParametersArray() methods (it's a map to
['default'=>.., 'type'=>..], not a flat name=>default pair), and add
missing types to two untyped params.
decorateExceptionWithDebugTrace() can return the original $e unchanged,
which may be a Throwable that isn't an Exception (eg. an Error); widen
the return type to match. Also document the previously-untyped
$shouldPrintBacktrace constructor param. The return type fix resolves
a PHPStan finding that was previously suppressed in the baseline.
isUserHasSomeWriteAccess() and checkUserHasWriteAccess() had docblocks
copy-pasted from their admin/view counterparts, describing "admin
access" and "VIEW or ADMIN access" respectively even though both
methods check write access. Also complete getRoleForSite()'s return
value example (it can also return 'write') and add a missing param
type on throwNoAccessException().
@sgiehl sgiehl added this to the 5.12.0 milestone Jul 1, 2026
@sgiehl sgiehl marked this pull request as ready for review July 1, 2026 16:16
@sgiehl sgiehl added not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. Technical debt Issues the will help to reduce technical debt labels Jul 1, 2026
@sgiehl sgiehl requested a review from a team July 1, 2026 16:16

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🤖 Codex Review: ✅ No findings

Summary

This PR is a narrow PHPDoc cleanup for core/API/Proxy, core/API/ResponseBuilder, and core/Access, plus removal of a now-obsolete PHPStan baseline entry. I found no blocking, medium, or polish issues in the reviewed diff.

Executable validation is delegated to CI per the review policy; the read-only inspection supports the branch intent and I consider it merge-ready from review.

Findings Overview

Severity Count
🚫 Blocking 0
⚠️ Medium 0
💬 Low / Polish 0

✅ No inline findings to place.

Diagnostics

Detailed review diagnostics are available in the codex-review-output workflow artifact.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. Technical debt Issues the will help to reduce technical debt

1 participant