Skip to content

Fix PHP 8.4 deprecation warnings for implicitly nullable parameters #927

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

Merged
merged 2 commits into from
Apr 30, 2025

Conversation

khoaofgod
Copy link
Member

Proposed changes

This PR fixes the PHP 8.4 deprecation warnings related to implicitly nullable parameters. In PHP 8.4, parameters with a default value of null must be explicitly marked as nullable using the '?' prefix.

Fixes #924 and #926

Changes:

  1. Fixed Redis Config::setDatabase() method (issue PHP8.4 Deprecation message #924)
  2. Fixed PhpfastcacheIOException constructor (issue PHP 8.4 Deprecated Warning: Implicitly nullable parameter $previous in PhpfastcacheIOException::__construct #926)
  3. Fixed additional similar occurrences in:
    • PhpfastcacheCorruptedDataException constructor
    • Psr16Adapter constructor
    • ClusterAggregator::aggregateDriverByName
    • AggregatorInterface::aggregateDriverByName
    • CacheContract::get and __invoke methods

These changes ensure compatibility with PHP 8.4 while maintaining backward compatibility with PHP 8.0+.

Types of changes

What types of changes does your code introduce to Phpfastcache?
Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • Improvement (non-breaking change which improves an existing code/behavior)
  • Deprecated third party dependency update
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation/Typo/Resource update that does not involve any code modification

Agreement

I have read the CONTRIBUTING and CODING GUIDELINE docs

Further comments

If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...

@Geolim4
Copy link
Member

Geolim4 commented Apr 30, 2025

Ignore Travis fails as Travis has to be removed asap.

@khoaofgod khoaofgod enabled auto-merge April 30, 2025 04:59
@khoaofgod khoaofgod disabled auto-merge April 30, 2025 05:00
@khoaofgod khoaofgod merged commit 7c91d42 into master Apr 30, 2025
8 of 9 checks passed
@khoaofgod khoaofgod deleted the fix/php84-deprecation-warnings branch April 30, 2025 05:00
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.

PHP8.4 Deprecation message
2 participants