laminas / laminas-cache

Caching implementation with a variety of storage options, as well as codified caching strategies for callbacks, classes, and output
https://docs.laminas.dev/laminas-cache/
BSD 3-Clause "New" or "Revised" License
103 stars 52 forks source link

Add missing template param for `StorageInterface` #319

Closed boesing closed 5 months ago

boesing commented 5 months ago
Q A
Bugfix yes
BC Break soft
New Feature no

Description

Since all laminas cache adapters are extending AbstractStorage, there was already a template TOptions available in that abstract class. Sadly, I forgot to add that to the StorageInterface which is problematic when it comes to interface usage.

This patch adds options template as a bugfix since we do not change any code (besides providing the options generic).

boesing commented 5 months ago

Out of interest, why do the templates not need to be co-variant?

I have absolutely no clue when it has to be and when not. I've used covariant once but I cannot remember when. AFAIR covariant is only used if you want to mix stuff such as "pets" where "dog" and "cat" has to be in there. Storage adapters only provide a single generic and thus covariant is not needed as from how I understand.

But I am not that deep into that stuff as I never really cared 😅