Skip to content

chore: normalise Psalm annotations - #59

Merged
roxblnfk merged 1 commit into
4.xfrom
chore/psalm-annotations
Nov 3, 2026
Merged

roxblnfk merged 1 commit into
4.xfrom
chore/psalm-annotations

Conversation

@roxblnfk

@roxblnfk roxblnfk commented Nov 3, 2026

Copy link
Copy Markdown
Member

🔍 What was changed

  • Psalm annotations in src/ follow one style: plain @param instead of @psalm-param, @var mixed instead of MixedAssignment suppressions, list<Item> where a list is built.
  • Suppressions Psalm reports as unused are removed, and wrong or redundant inline @var on protobuf getItems() results are dropped now that Psalm infers RepeatedField<Item>.
  • No runtime or signature changes; Psalm goes from 2 errors to 0.

Review notes

  • psalm.xml stubs vendor/google/protobuf/src/Google/Protobuf/RepeatedField.php: when ext-protobuf is loaded, it shadows the generic vendor class with an untemplated one, so the DTO's RepeatedField<Item> failed with TooManyTemplateParams. The stub makes Psalm read the vendor class with or without the extension.
  • Left open: set/setMultiple/setAsync/setMultipleAsync narrow the TTL to positive-int with a suppression, while PSR-16 and AsyncStorageInterface allow any int (zero or less means delete).
  • Left open: withSerializer() declares @return $this but returns a clone; static is correct but widens a public return type.
  • Left open: Cache::createIndex() returns array<string, Item>, but digit-only keys become int, so the true type is array<array-key, Item>.

Checklist

  • How was this tested:
    • Psalm, Testo suite and php-cs-fixer dry run pass locally, Psalm with and without ext-protobuf

build: read the generic protobuf RepeatedField in Psalm

With ext-protobuf loaded, Psalm reflects the extension's untemplated RepeatedField instead of the vendor class, so the generated DTO's `RepeatedField<Item>` failed with TooManyTemplateParams; a stub of the vendor file fixes it with or without the extension.

Suppressions Psalm reports as unused are dropped, and MixedAssignment suppressions become `@var mixed`, matching DefaultSerializer.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
@roxblnfk
roxblnfk requested a review from a team November 3, 2026 20:19
@coderabbitai

coderabbitai Bot commented Nov 3, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 45 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d53ba6d5-078f-4a27-b02c-b8eb2621febd
Commits

Reviewing files that changed from the base of the PR and between 056450d and 1609a6c.

Files selected for processing: 4
  • psalm.xml
  • src/AsyncCache.php
  • src/Cache.php
  • src/Factory.php
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.

@codecov

codecov Bot commented Nov 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.58%. Comparing base (056450d) to head (1609a6c).

Additional details and impacted files
@@            Coverage Diff             @@
##              4.x      #59      +/-   ##
==========================================
- Coverage   94.08%   93.58%   -0.51%     
==========================================
  Files          13       13              
  Lines         186      187       +1     
==========================================
  Hits          175      175              
- Misses         11       12       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

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

@roxblnfk
roxblnfk merged commit eed8bb2 into 4.x Nov 3, 2026
16 of 17 checks passed
@roxblnfk
roxblnfk deleted the chore/psalm-annotations branch November 3, 2026 20:21
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