Passed
Pull Request — master (#1190)
by butschster
11:23
created

BindScope   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 8
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 4
c 1
b 0
f 0
dl 0
loc 8
ccs 0
cts 2
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Spiral\Boot\Attribute;
6
7
#[\Attribute(\Attribute::TARGET_METHOD)]
8
final class BindScope
9
{
10
    public readonly string $scope;
11
12
    public function __construct(string|\BackedEnum $scope)
13
    {
14
        $this->scope = \is_object($scope) ? (string) $scope->value : $scope;
0 ignored issues
show
Bug introduced by
The property scope is declared read-only in Spiral\Boot\Attribute\BindScope.
Loading history...
Bug introduced by
Accessing value on the interface BackedEnum suggest that you code against a concrete implementation. How about adding an instanceof check?
Loading history...
15
    }
16
}
17