title: Symfony. Cache Component. Does not return CacheItemInterface
body: <p>I don't know why it's happening. I have this code. I've got it from here <a href="https://symfony.com/doc/current/components/cache.html" rel="nofollow noreferrer">https://symfony.com/doc/current/components/cache.html</a></p>
  <pre><code>private function createCacheItem(string $key): CacheItemInterface {
      return $this-&gt;cache-&gt;get($key, function (ItemInterface $item) {
          return $item;
      });
  }
  </code></pre>
  <p>And in the local machine, it's OK. But in production, I have sometimes this error.</p>
  <p>Return value must be of type Psr\Cache\CacheItemInterface, int returned.</p>
  <p>I see that this function get(), return a mixed value. But how to avoid this error?</p>