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

fractalzombie / frzb-dependency-injection / 4355207088

pending completion
4355207088

push

github

Mykhailo Shtanko
[DependencyInjection] Added SonarCloud checks, refactor GitHub actions, refactor for using not only id as class

44 of 50 new or added lines in 9 files covered. (88.0%)

7 existing lines in 5 files now uncovered.

210 of 247 relevant lines covered (85.02%)

4.77 hits per line

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

0.0
/Compiler/RegisterAsDecoratorAttributesPass.php
1
<?php
2

3
declare(strict_types=1);
4

5
/*
6
 * This is package for Symfony framework.
7
 *
8
 * (c) Mykhailo Shtanko <fractalzombie@gmail.com>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13

14
namespace FRZB\Component\DependencyInjection\Compiler;
15

16
use FRZB\Component\DependencyInjection\Attribute\AsDecorator;
17
use FRZB\Component\DependencyInjection\Helper\EnvironmentHelper;
18
use Symfony\Component\DependencyInjection\ContainerBuilder;
19
use Symfony\Component\DependencyInjection\Definition;
20

21
/**
22
 * @internal
23
 *
24
 * Register #[AsDecorator] attribute on definition that is autowired
25
 *
26
 * @author Mykhailo Shtanko <fractalzombie@gmail.com>
27
 */
28
final class RegisterAsDecoratorAttributesPass extends AbstractRegisterAttributePass
29
{
30
    public function __construct()
31
    {
32
        parent::__construct(AsDecorator::class);
×
33
    }
34

35
    public function register(ContainerBuilder $container, \ReflectionClass $reflectionClass, AsDecorator $attribute): void
36
    {
NEW
37
        if (!EnvironmentHelper::isPermittedEnvironment($container, $reflectionClass)) {
×
38
            return;
×
39
        }
40

41
        $container->getDefinition($reflectionClass->getName())
×
42
            ->setDecoratedService($attribute->decorates, $attribute->innerName, $attribute->priority, $attribute->onInvalid->value)
×
43
        ;
×
44
    }
45

46
    protected function accept(Definition $definition): bool
47
    {
48
        return $definition->isAutowired() && $this->isAttributesIgnored($definition);
×
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