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

fractalzombie / frzb-dependency-injection / 7325061485

25 Dec 2023 11:51PM UTC coverage: 84.36%. Remained the same
7325061485

push

github

fractalzombie
[DependencyInjection] Update functional library with breaking changes

28 of 29 new or added lines in 9 files covered. (96.55%)

21 existing lines in 8 files now uncovered.

178 of 211 relevant lines covered (84.36%)

13.68 hits per line

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

85.71
/Compiler/RegisterAsTaggedAttributesPass.php
1
<?php
2

3
declare(strict_types=1);
4

5
/**
6
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
7
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
8
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
9
 *
10
 * Copyright (c) 2023 Mykhailo Shtanko fractalzombie@gmail.com
11
 *
12
 * For the full copyright and license information, please view the LICENSE.MD
13
 * file that was distributed with this source code.
14
 */
15

16
namespace FRZB\Component\DependencyInjection\Compiler;
17

18
use FRZB\Component\DependencyInjection\Attribute\AsTagged;
19
use FRZB\Component\DependencyInjection\Helper\DefinitionHelper;
20
use FRZB\Component\DependencyInjection\Helper\EnvironmentHelper;
21
use FRZB\Component\DependencyInjection\Helper\TagHelper;
22
use Symfony\Component\DependencyInjection\ContainerBuilder;
23
use Symfony\Component\DependencyInjection\Definition;
24

25
/**
26
 * @internal
27
 *
28
 * Register #[AsTagged] attribute on definition that is autoconfigured
29
 *
30
 * @author Mykhailo Shtanko <fractalzombie@gmail.com>
31
 */
32
final class RegisterAsTaggedAttributesPass extends AbstractRegisterAttributePass
33
{
34
    public function __construct()
35
    {
36
        parent::__construct(AsTagged::class);
9✔
37
    }
38

39
    public function register(ContainerBuilder $container, \ReflectionClass $reflectionClass, AsTagged $attribute): void
40
    {
41
        if (!EnvironmentHelper::isPermittedEnvironment($container, $reflectionClass)) {
9✔
UNCOV
42
            return;
×
43
        }
44

45
        $container
9✔
46
            ->getDefinition(DefinitionHelper::getServiceId($container, $reflectionClass, $attribute->id))
9✔
47
            ->addTag($attribute->name, TagHelper::toTag($attribute))
9✔
48
        ;
9✔
49
    }
50
}
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

© 2025 Coveralls, Inc