Skip to content
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

Getting MismatchingDocblockParamType error even when there's no docblock #11013

Open
toviet opened this issue Jun 14, 2024 · 2 comments
Open

Comments

@toviet
Copy link

toviet commented Jun 14, 2024

Hi,

Since upgrading to v5.2.1, Psalm seems to show these weird MismatchingDocblockParamType errors on my codes which have no docblock at all.

For example

$featureResult = $this->cache->get(
        $key,
        function (ItemInterface $item) use ($feature, $dataCache) {
            $item->expiresAfter(Time::SIX_HOURS_IN_SECONDS);

            return $this->compileFeatureResult($feature, $dataCache);

And I get:

Service.php:173:27: MismatchingDocblockParamType: Parameter $item has wrong type 'Psr\Cache\CacheItemInterface', should be 'Symfony\Contracts\Cache\ItemInterface' (see https://psalm.dev/141)

Even more odd that this only happens on a selected of files which use similar caching pattern, but not all of them.

Does anyone know what's the issue here?

@orklah
Copy link
Collaborator

orklah commented Jun 14, 2024

Can you check what the docblock of the get() function on cache is?

@toviet
Copy link
Author

toviet commented Jun 17, 2024

The cache is drawn from Symfony Memcache Adapter (https://symfony.com/doc/current/components/cache/adapters/memcached_adapter.html) so should be the standard. We have other places where the same adapter is used but having no Psalm error at all.

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

No branches or pull requests

2 participants