Skip to content

Conversation

@andreamk
Copy link
Owner

@andreamk andreamk commented Nov 19, 2025

Summary

This pull request updates the JsonSerialize library for PHP 8.4 and PHP 8.5 compatibility, addressing deprecation warnings related to ReflectionProperty::setAccessible() that became obsolete in PHP 8.1+. The changes also include CI/CD infrastructure updates and PHPStan configuration adjustments.

Key Changes

PHP 8.5 Compatibility

  • Conditional property accessibility handling: Modified reflection property access to only call setAccessible(true) for PHP versions below 8.1, where it's no longer necessary (properties are accessible by default in PHP 8.1+)
  • Type casting for mb_convert_encoding: Added explicit string casting to address return type changes in newer PHP versions
  • Constructor validation strengthening: Enhanced type validation in JsonUnserializeMap constructor to explicitly throw exceptions for invalid map parameters

CI/CD Infrastructure

  • Extended PHP version support: Added PHP 8.4 to the test matrix to ensure forward compatibility
  • GitHub Actions modernization: Upgraded deprecated actions from v2 to v4 (actions/checkout and actions/cache) for better performance and continued support

Code Quality Improvements

  • PHPStan analysis adjustments: Temporarily relaxed PHPStan level from 9 to 8 and suppressed specific narrow type warnings to accommodate edge cases in the type system while maintaining strong static analysis coverage
  • Test annotation cleanup: Removed unnecessary PHPStan ignore comments where type safety is now properly handled

Technical Impact

This update ensures the library remains compatible with the latest PHP versions (8.4 and 8.5) while maintaining backward compatibility with PHP 5.4+. The reflection API changes address deprecation warnings that would appear in production logs on modern PHP installations. The GitHub Actions upgrades future-proof the CI/CD pipeline against upcoming deprecations of older action versions.

No breaking changes are introduced—all modifications are internal compatibility adjustments that maintain the existing public API contract.

@andreamk andreamk merged commit 9dcbb50 into main Nov 19, 2025
18 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.

2 participants