Passed
Pull Request — master (#1038)
by Aleksei
11:08
created

ScopeContainerLeakedException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
eloc 7
c 1
b 0
f 1
dl 0
loc 16
ccs 0
cts 8
cp 0
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 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...
11
     */
12
    public function __construct(
13
        ?string $scope,
14
        array $parents,
15
    ) {
16
        $scopes = \implode('->', \array_map(
17
            static fn (?string $scope): string => $scope === null ? 'null' : "\"$scope\"",
18
            [...\array_reverse($parents), $scope],
19
        ));
20
        parent::__construct(
21
            $scope,
22
            \sprintf('Scoped container has been leaked. Scope: %s.', $scopes),
23
        );
24
    }
25
}
26