Closed
Description
Symfony version(s) affected
7.3.0
Description
Symfony 7.3 has a great improvement on cache component https://symfony.com/blog/new-in-symfony-7-3-namespaced-caches
additional assert($this->cache instanceof NamespacedPoolInterface);
required before calling the $this->cache->withSubNamespace('sub-ns');
even all caches adapters implement NamespacedPoolInterface, otherwise phpstan will complain about call to undefined method
How to reproduce
had tried to use intersection types
public function __construct(
private CacheInterface&NamespacedPoolInterface $appCache
)
but get this error
In DefinitionErrorExceptionPass.php line 48:
[Symfony\Component\DependencyInjection\Exception\RuntimeException]
Cannot autowire service "App\Command\TestCommand": argument "$appCache" of method "__construct()" has type "Symfony\Contracts\Cache\CacheInterface&Symfony\Contracts\Cache\NamespacedPoolInterface" but this class
was not found.
Possible Solution
No response
Additional Context
No response