Skip to content

Suppress Psalm UndefinedDocblockClass for Internal\RepeatedField#1959

Draft
bobstrecansky wants to merge 1 commit into
open-telemetry:mainfrom
bobstrecansky:fix/psalm-protobuf-repeatedfield
Draft

Suppress Psalm UndefinedDocblockClass for Internal\RepeatedField#1959
bobstrecansky wants to merge 1 commit into
open-telemetry:mainfrom
bobstrecansky:fix/psalm-protobuf-repeatedfield

Conversation

@bobstrecansky
Copy link
Copy Markdown
Contributor

Summary

  • Suppress Psalm UndefinedDocblockClass issues that reference
    Google\Protobuf\Internal\RepeatedField.

Why

google/protobuf 4.x deprecated Google\Protobuf\Internal\RepeatedField in
favor of Google\Protobuf\RepeatedField. The Internal class is now defined
as an if (false) { class RepeatedField extends \Google\Protobuf\RepeatedField {} } stub plus a runtime class_alias.
Psalm's static parser can see only the stub, not the alias, so getters on the
generated proto messages that return Internal\RepeatedField (e.g.
ExportMetricsServiceRequest::getResourceMetrics()) trigger
UndefinedDocblockClass on every Otlp converter file.

This is the same workaround pattern already used for offsetGet/offsetSet
on the same class. No source changes; once google/protobuf removes the
Internal stub entirely we can revisit.

Unblocks PHP QA on PHP 8.2/8.3/8.4 main builds.

Test plan

  • PHP QA workflow goes green on 8.2/8.3/8.4

google/protobuf 4.x deprecated Google\Protobuf\Internal\RepeatedField in favor
of Google\Protobuf\RepeatedField. The Internal class is now a stub guarded by
`if (false)` with a runtime class_alias, so Psalm's static analysis sees it as
undefined. The generated proto messages still reference it in their getter
return-type docblocks, which surfaces as UndefinedDocblockClass across the Otlp
converters. Suppress the issue for that single referenced class, matching the
existing pattern used for offsetGet/offsetSet on the same class.
@codecov
Copy link
Copy Markdown

codecov Bot commented May 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 67.71%. Comparing base (471b51d) to head (845c4d0).

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##               main    #1959      +/-   ##
============================================
- Coverage     67.75%   67.71%   -0.05%     
  Complexity     3044     3044              
============================================
  Files           459      459              
  Lines          8883     8883              
============================================
- Hits           6019     6015       -4     
- Misses         2864     2868       +4     
Flag Coverage Δ
8.5 67.71% <ø> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 5 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 471b51d...845c4d0. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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