Completed
Push — 2.x ( ae114c...98cb65 )
by Akihito
27s queued 11s
created

SubclassesOfMatcher   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 23
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A matchesClass() 0 7 2
A matchesMethod() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Ray\Aop\Matcher;
6
7
use Ray\Aop\AbstractMatcher;
8
use Ray\Aop\Exception\InvalidAnnotationException;
9
10
final class SubclassesOfMatcher extends AbstractMatcher
11
{
12
    /**
13
     * {@inheritdoc}
14
     */
15
    public function matchesClass(\ReflectionClass $class, array $arguments) : bool
16
    {
17
        /** @var array<class-string> $arguments */
0 ignored issues
show
Documentation introduced by
The doc-type array<class-string> could not be parsed: Unknown type name "class-string" at position 6. (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
18
        [$superClass] = $arguments;
0 ignored issues
show
Bug introduced by
The variable $superClass does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
19 1
20
        return $class->isSubclassOf($superClass) || ($class->name === $superClass);
21 1
    }
22 1
23
    /**
24 1
     * {@inheritdoc}
25
     */
26
    public function matchesMethod(\ReflectionMethod $method, array $arguments) : bool
27
    {
28
        unset($method, $arguments);
29
30 1
        throw new InvalidAnnotationException('subclassesOf is only for class match');
31
    }
32
}
33