Add types Data ArrayAccess methods#912
Conversation
📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #912 +/- ##
==========================================
- Coverage 89.78% 87.56% -2.23%
==========================================
Files 59 85 +26
Lines 1449 1801 +352
==========================================
+ Hits 1301 1577 +276
- Misses 148 224 +76 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/Contracts/Data.php (1)
9-16: Tighten PHPDoc array generics for better static-analysis precision.
@var array<mixed>and@param array<mixed>work, butarray<array-key, mixed>is more explicit about allowed keys and typically gives better analyzer feedback.Suggested diff
/** - * `@var` array<mixed> + * `@var` array<array-key, mixed> */ protected array $data = []; /** - * `@param` array<mixed> $data + * `@param` array<array-key, mixed> $data */ public function __construct(array $data = [])Based on learnings, docblock type annotations in this repository are used as static-analysis contracts.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/Contracts/Data.php` around lines 9 - 16, Update the docblock array generics to be explicit about allowed keys: replace occurrences of "@var array<mixed>" on the protected $data property and any "@param array<mixed>" annotations (e.g., on the Data class constructor or setData method) with "@var array<array-key, mixed>" and "@param array<array-key, mixed>" respectively to improve static-analysis precision for the Data class and its $data member.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/Contracts/Data.php`:
- Around line 9-16: Update the docblock array generics to be explicit about
allowed keys: replace occurrences of "@var array<mixed>" on the protected $data
property and any "@param array<mixed>" annotations (e.g., on the Data class
constructor or setData method) with "@var array<array-key, mixed>" and "@param
array<array-key, mixed>" respectively to improve static-analysis precision for
the Data class and its $data member.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 47888c32-21cb-4ac8-a181-f383f38b9add
📒 Files selected for processing (1)
src/Contracts/Data.php
Data ArrayAccess methods
Pull Request
Related issue
Fixes #849
What does this PR do?
PR checklist
Please check if your PR fulfills the following requirements:
Summary by CodeRabbit
Release Notes
This release includes internal code quality improvements with no user-facing changes. Type annotations have been strengthened to enhance code reliability and maintainability for developers.