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

fractalzombie / frzb-dependency-injection / 4355095441

pending completion
4355095441

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%)

1 existing line in 1 file 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

55.56
/Attribute/AsAlias.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\Attribute;
15

16
use FRZB\Component\DependencyInjection\Enum\AliasType;
17
use JetBrains\PhpStorm\Immutable;
18

19
#[Immutable]
20
#[\Attribute(\Attribute::TARGET_CLASS | \Attribute::IS_REPEATABLE)]
21
final class AsAlias
22
{
23
    public readonly AliasType $aliasType;
24

25
    public function __construct(
26
        public readonly string $service,
27
        public readonly bool $isPublic = true,
28
        public readonly ?string $aliasForArgument = null,
29
    ) {
30
        $this->aliasType = match (true) {
4✔
31
            !empty($this->aliasForArgument) => AliasType::WithArgumentName,
4✔
32
            empty($this->aliasForArgument) => AliasType::WithoutArgumentName,
4✔
33
            default => AliasType::LogicException,
4✔
34
        };
4✔
35
    }
36

37
    public function getServiceAlias(): string
38
    {
NEW
39
        return match ($this->aliasType) {
×
NEW
40
            AliasType::WithArgumentName => sprintf('%s %s', $this->service, $this->aliasForArgument),
×
NEW
41
            AliasType::WithoutArgumentName, AliasType::LogicException => $this->service,
×
NEW
42
        };
×
43
    }
44
}
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