Test Failed
Pull Request — master (#870)
by Aleksei
08:56
created

ScopeContainerLeakedException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 7
c 0
b 0
f 0
dl 0
loc 17
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Spiral\Core\Exception\Scope;
6
7
final class ScopeContainerLeakedException extends ScopeException
8
{
9
    /**
10
     * @param null|string $scope
11
     * @param array<int<0, max>, string|null> $parents
0 ignored issues
show
Documentation Bug introduced by
The doc comment array<int<0, max>, string|null> at position 2 could not be parsed: Expected '>' at position 2, but found 'int'.
Loading history...
12
     */
13
    public function __construct(
14
        ?string $scope,
15
        array $parents,
16
    ) {
17
        $scopes = \implode('->', \array_map(
18
            static fn (?string $scope): string => $scope === null ? 'null' : "\"$scope\"",
19
            [...\array_reverse($parents), $scope],
20
        ));
21
        parent::__construct(
22
            $scope,
23
            \sprintf('Scoped container has been leaked. Scope: %s.', $scopes),
24
        );
25
    }
26
}
27