-
Notifications
You must be signed in to change notification settings - Fork 33
Fix PHP 8.1+ deprecation warning in jsonSerialize() method #160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Fix PHP 8.1+ deprecation warning by adding explicit return type declaration to Failure::jsonSerialize() method. This change is backward compatible with PHP 7.0+ which already supports return type declarations.
WalkthroughConfiguration files updated to support PHP 8.2–8.4 with modern CI/CD practices. Source code enhancements include adding return type hints, improving error handling robustness, and exposing internal locators via new protected properties. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (5)
🔇 Additional comments (8)
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 |
- Update actions/cache from v2 to v4 - Replace deprecated set-output command with GITHUB_OUTPUT
PHP 5.6 and 7.0 are no longer supported by Composer 2.x. These versions reached EOL years ago and cannot run modern CI tools.
- PHP 7.1 is not supported by Composer 2.3+ (requires PHP 7.2.5+) - Add PHP 8.2 and 8.3 to ensure compatibility with recent versions
- Add return type declaration to jsonSerialize() method (PHP 8.1+) - Fix DateTime::getLastErrors() null check (PHP 8+) - Declare properties in ValueFilter to prevent dynamic property warnings (PHP 8.2+)
- Configure PHP 8.4 environment. - Add "default-jammy" build image and analysis nodes. - Remove deprecated tools for streamlined analysis.
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
| * | ||
| */ | ||
| public function jsonSerialize() | ||
| public function jsonSerialize(): array |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change will be problematic right ?
|
It looks we never have released 3.x . May be we need 4.x or something else ? |
Yes, let's do that! |
Summary
This PR fixes PHP 8.1+ deprecation warnings by adding an explicit return type declaration to the
Failure::jsonSerialize()method in the 3.x branch.Problem
Since PHP 8.1, the
JsonSerializableinterface requires return type declarations. Without it, the following deprecation warning is triggered:Solution
Add
: arrayreturn type declaration to thejsonSerialize()method (line 115).Backward Compatibility
✅ This change is fully backward compatible:
Testing
The change maintains the same return value and behavior. All existing tests should continue to pass.
Related
aura/filter: ^3.x-devSummary by CodeRabbit
Release Notes