Skip to content

Commit 37f5341

Browse files
bug #60625 [FrameworkBundle] set NamespacedPoolInterface alias to cache.app (IndraGunawan)
This PR was merged into the 7.3 branch. Discussion ---------- [FrameworkBundle] set NamespacedPoolInterface alias to cache.app | Q | A | ------------- | --- | Branch? | 7.3 | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Issues | Fix #60583 | License | MIT <!-- Replace this notice by a description of your feature/bugfix. This will help reviewers and should be a good start for the documentation. Additionally (see https://symfony.com/releases): - Always add tests and ensure they pass. - Bug fixes must be submitted against the lowest maintained branch where they apply (lowest branches are regularly merged to upper ones so they get the fixes too). - Features and deprecations must be submitted against the latest branch. - For new features, provide some code snippets to help understand usage. - Changelog entry should follow https://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry - Never break backward compatibility (see https://symfony.com/bc). --> autowiring `CacheInterface|NamespacedPoolInterface` intersection type for cache pool works well but it does not work for `cache.app` Commits ------- 81854a5 [FrameworkBundle] set NamespacedPoolInterface alias to cache.app
2 parents 1023bc7 + 81854a5 commit 37f5341

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,10 @@ public function load(array $configs, ContainerBuilder $container): void
302302
// Load Cache configuration first as it is used by other components
303303
$loader->load('cache.php');
304304

305+
if (!interface_exists(NamespacedPoolInterface::class)) {
306+
$container->removeAlias(NamespacedPoolInterface::class);
307+
}
308+
305309
$configuration = $this->getConfiguration($configs, $container);
306310
$config = $this->processConfiguration($configuration, $configs);
307311

src/Symfony/Bundle/FrameworkBundle/Resources/config/cache.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
use Symfony\Component\Cache\Messenger\EarlyExpirationHandler;
2929
use Symfony\Component\HttpKernel\CacheClearer\Psr6CacheClearer;
3030
use Symfony\Contracts\Cache\CacheInterface;
31+
use Symfony\Contracts\Cache\NamespacedPoolInterface;
3132
use Symfony\Contracts\Cache\TagAwareCacheInterface;
3233

3334
return static function (ContainerConfigurator $container) {
@@ -250,6 +251,8 @@
250251

251252
->alias(CacheInterface::class, 'cache.app')
252253

254+
->alias(NamespacedPoolInterface::class, 'cache.app')
255+
253256
->alias(TagAwareCacheInterface::class, 'cache.app.taggable')
254257
;
255258
};

0 commit comments

Comments
 (0)