• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

tito10047 / progressive-image-bundle / 20688684442

04 Jan 2026 06:11AM UTC coverage: 88.746%. Remained the same
20688684442

push

github

tito10047
update comments and exception messages: standardize English terminology in comments, exceptions, and test outputs across all source files and tests

0 of 5 new or added lines in 3 files covered. (0.0%)

623 of 702 relevant lines covered (88.75%)

185.41 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

52.38
/src/DependencyInjection/CheckCacheInterfacePass.php
1
<?php
2

3
/*
4
 * This file is part of the Progressive Image Bundle.
5
 *
6
 * (c) Jozef Môstka <https://github.com/tito10047/progressive-image-bundle>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11

12
namespace Tito10047\ProgressiveImageBundle\DependencyInjection;
13

14
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
15
use Symfony\Component\DependencyInjection\ContainerBuilder;
16
use Symfony\Contracts\Cache\TagAwareCacheInterface;
17

18
final class CheckCacheInterfacePass implements CompilerPassInterface
19
{
20
    public function process(ContainerBuilder $container): void
21
    {
22
        if ($container->hasParameter('progressive_image.image_cache_enabled') && !$container->getParameter('progressive_image.image_cache_enabled')) {
350✔
23
            return;
14✔
24
        }
25

26
        if (!$container->hasAlias('progressive_image.image_cache_service')) {
336✔
27
            return;
×
28
        }
29

30
        $cacheServiceId = (string) $container->getAlias('progressive_image.image_cache_service');
336✔
31
        if (!$container->hasDefinition($cacheServiceId)) {
336✔
32
            return;
×
33
        }
34

35
        $definition = $container->getDefinition($cacheServiceId);
336✔
36

37
        while ($definition->hasTag('container.service_alias')) {
336✔
38
            $tags = $definition->getTag('container.service_alias');
×
39
            $cacheServiceId = $tags[0]['alias'] ?? $cacheServiceId;
×
40
            if (!$container->hasDefinition($cacheServiceId)) {
×
41
                break;
×
42
            }
43
            $definition = $container->getDefinition($cacheServiceId);
×
44
        }
45

46
                // If it's a cache pool defined via FrameworkBundle, Symfony turns it at build time
47
                // into a definition whose class is e.g. Symfony\Component\Cache\Adapter\ArrayAdapter.
48
                // If it has tags enabled, Symfony wraps it in TagAwareAdapter.
49

50
        $class = $container->getParameterBag()->resolveValue($definition->getClass());
336✔
51

52
                // If class is empty, it might be a factory. In that case we try to look at the factory
53
        if (!$class && $definition->getFactory()) {
336✔
54
                        // Here it's difficult to determine the factory return type at compile time without executing code
55
        }
56

57
        if ($class && !is_subclass_of($class, TagAwareCacheInterface::class) && TagAwareCacheInterface::class !== $class) {
336✔
NEW
58
                        throw new \LogicException(sprintf('Cache service "%1$s" (class: %2$s) must implement TagAwareCacheInterface to be used in ProgressiveImageBundle. Check if you have "tags: true" enabled for this pool in framework.cache configuration and then set it in bundle configuration: progressive_image: { image_cache_service: "%1$s" }. Example pool configuration: framework: { cache: { pools: { %1$s: { adapter: cache.adapter.redis_tag_aware, tags: true } } } }', $cacheServiceId, $class));
×
59
        }
60

61
                // Special check for Symfony cache pools that don't have a class set immediately,
62
                // but we can find out if they are taggable.
63
        if (!$class || 'Symfony\Component\Cache\Adapter\ArrayAdapter' === $class || 'Symfony\Component\Cache\Adapter\FilesystemAdapter' === $class) {
336✔
64
            if (!$definition->hasTag('cache.taggable')) {
×
65
                                // If it doesn't have the cache.taggable tag and the class is not TagAware, we throw an error.
66
                                // Symfony TagAwareAdapter has the class set to TagAwareAdapter.
NEW
67
                                throw new \LogicException(sprintf('Cache service "%1$s" is not "tag aware". Check if you have "tags: true" enabled for this pool in framework.cache configuration and then set it in bundle configuration: progressive_image: { image_cache_service: "%1$s" }. Example pool configuration: framework: { cache: { pools: { %1$s: { adapter: cache.adapter.redis_tag_aware, tags: true } } } }', $cacheServiceId));
×
68
            }
69
        }
70
    }
71
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc