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

BindScope::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
cc 2
nc 2
nop 1
crap 6
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