Skip to content

[#570] Fix PHPStan analysis errors - #571

Merged
armanist merged 1 commit into
quantum-php:masterfrom
armanist:issue/570-fix-phpstan-failures
Oct 5, 2026
Merged

armanist merged 1 commit into
quantum-php:masterfrom
armanist:issue/570-fix-phpstan-failures

Conversation

@armanist

@armanist armanist commented Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #570

Summary by CodeRabbit

  • Bug Fixes
    • Cache reads now handle a broader range of errors when restoring cached values. When a cached value cannot be restored, the invalid entry is removed and the configured default is returned, helping prevent the error from disrupting cache reads.

@coderabbitai

coderabbitai Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 11e8b40d-912a-4daf-9de6-93deba112651
📥 Commits

Reviewing files that changed from the base of the PR and between 3e3273e and d156f79.

📒 Files selected for processing (5)
  • CHANGELOG.md
  • src/Cache/Adapters/FileAdapter.php
  • src/Cache/Adapters/MemcachedAdapter.php
  • src/Cache/Adapters/RedisAdapter.php
  • src/Model/ModelCollection.php

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The cache adapters now catch Throwable during deserialization and retain their existing failure behavior. ModelCollection PHPDoc now describes its iterator and internal array key types.

Changes

PHPStan compatibility fixes

Layer / File(s) Summary
Cache deserialization handling
src/Cache/Adapters/FileAdapter.php, src/Cache/Adapters/MemcachedAdapter.php, src/Cache/Adapters/RedisAdapter.php
The adapters catch Throwable during unserialization. On failure, each adapter deletes the cache entry and returns the supplied default.
ModelCollection key types and changelog
src/Model/ModelCollection.php, CHANGELOG.md
ModelCollection PHPDoc documents `int

Priority: ➖ Normal

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

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to d156f

No actionable regression was identified. The PHPStan result remains unverified because its executable is unavailable.

🚥 Pre-merge checks | ✅ 4 | ❓ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Linked Issues check ❓ Inconclusive For #570, the three cache adapters now catch Throwable and retain the existing delete-and-default behavior. ModelCollection now documents iterator keys as int|TKey and internal model keys as `in… Provide the composer phpstan result to confirm that the reported analysis failures are resolved.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title identifies the PHPStan analysis errors addressed by the cache deserialization handling and ModelCollection key type changes.
Out of Scope Changes check ✅ Passed The reported changes are limited to the cache adapters, ModelCollection, and a changelog entry for #570. Each change supports the linked issue. No unrelated changes are identified.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 4 files. (1 skipped: 1 …
Full details: Linked Issues check

Explanation

For #570, the three cache adapters now catch Throwable and retain the existing delete-and-default behavior. ModelCollection now documents iterator keys as int|TKey and internal model keys as int, which addresses the reported key-type assignments while preserving the existing key behavior. However, no composer phpstan result is available, so the required passing analysis cannot be confirmed.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autopilot · 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

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

@codecov-commenter

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 0% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/Cache/Adapters/FileAdapter.php 0.00% 1 Missing ⚠️
src/Cache/Adapters/MemcachedAdapter.php 0.00% 1 Missing ⚠️
src/Cache/Adapters/RedisAdapter.php 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@armanist
armanist merged commit 896864d into quantum-php:master Oct 5, 2026
6 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.

Fix PHPStan failures after dependency update

2 participants