Skip to content

Conversation

@ossinkine
Copy link
Contributor

Add type of cached items to improve type checking

@ossinkine ossinkine force-pushed the cache-item-generic branch from f323b37 to 47b1bbc Compare July 10, 2022 18:25
@VincentLanglet
Copy link
Contributor

Hi @ossinkine, adding generics with a phpstan stub is always tricky, because if someone use both psalm and phpstan
writes CacheItemInterface<Foo> psalm will report an error because it's not a generic.

Best would be to do the PR directly on php-fig/cache and symfony/symfony repository.
(Symfony now accepts to add generics)

Or at least to provide the same PR on psalm-plugin https://github.com/psalm/psalm-plugin-symfony/tree/master/src/Stubs/common/Contracts/Cache

@stof
Copy link
Contributor

stof commented Mar 24, 2025

As this is about adding generic types for the PSR Cache interface, which is not specific to Symfony, I'm not sure this should be done by the phpstan-symfony extension (and this should probably be discussed with FIG first to try to get them upstream)

@ondrejmirtes
Copy link
Member

Agreed.

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.

4 participants