Passed
Pull Request — master (#38)
by Sergei
05:23 queued 02:36
created

SubclassOf::match()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Classifier\Filter;
6
7
use ReflectionClass;
8
9
final class SubclassOf implements FilterInterface
10
{
11
    /**
12
     * @param class-string $class
0 ignored issues
show
Documentation Bug introduced by
The doc comment class-string at position 0 could not be parsed: Unknown type name 'class-string' at position 0 in class-string.
Loading history...
13
     */
14 4
    public function __construct(private string $class)
15
    {
16 4
    }
17
18 6
    public function match(ReflectionClass $reflectionClass): bool
19
    {
20 6
        return $reflectionClass->isSubclassOf($this->class);
21
    }
22
}
23