Skip to content

Conversation

@yassinedoghri
Copy link
Contributor

@yassinedoghri yassinedoghri commented Nov 27, 2025

Description
Following the previous PR (#9809), this is the second part of the CacheInterface refactor.

This PR adds native return types to all CacheInterface methods and updates the user guides accordingly.

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value (without duplication)
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@yassinedoghri yassinedoghri force-pushed the fix/cache-interface-2 branch 2 times, most recently from 8065d0f to 622dd8b Compare November 27, 2025 11:20
@yassinedoghri yassinedoghri changed the title DRAFT: feat(cache): add native return types to all CacheInterface methods feat(cache): add native return types to all CacheInterface methods Nov 27, 2025
+ remove deprecated `false` type in `getMetaData()` method
+ remove unnecessary @inheritdoc annotation
+ clarify deprecation removal of `false` type for `CacheInterface::getMetaData()`
* @param mixed $value
*/
public function save(string $key, $value, int $ttl = 60)
public function save(string $key, $value, int $ttl = 60): bool
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can natively type the mixed param without breaking LSP, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, the type is actually bool, so I removed the docs declaration.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, what I meant was you can write mixed $value in the method signature.

Copy link
Contributor Author

@yassinedoghri yassinedoghri Nov 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, my bad! I was too quick 😅

Yes, just tried it, you can natively type the mixed param without breaking LSP.

That being said, should I not just change the $value signature in the CacheInterface as well? (so it's explicit)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, pls replicate the change to other handlers and the interface itself.

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