Passed
Push — master ( 12666c...576d22 )
by Asmir
14:13 queued 11:54
created

AnnotationDriver::getMethodAnnotations()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
ccs 0
cts 0
cp 0
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace JMS\Serializer\Metadata\Driver;
6
7
use Doctrine\Common\Annotations\Reader;
8
use JMS\Serializer\Expression\CompilableExpressionEvaluatorInterface;
9
use JMS\Serializer\Naming\PropertyNamingStrategyInterface;
10
use JMS\Serializer\Type\ParserInterface;
11
12
class AnnotationDriver extends AnnotationOrAttributeDriver
13
{
14
    /**
15
     * @var Reader
16
     */
17
    private $reader;
18
19
    public function __construct(Reader $reader, PropertyNamingStrategyInterface $namingStrategy, ?ParserInterface $typeParser = null, ?CompilableExpressionEvaluatorInterface $expressionEvaluator = null)
20
    {
21
        parent::__construct($namingStrategy, $typeParser, $expressionEvaluator);
22
23
        $this->reader = $reader;
24
    }
25
26
    /**
27
     * @return list<object>
0 ignored issues
show
Bug introduced by
The type JMS\Serializer\Metadata\Driver\list was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
28
     */
29
    protected function getClassAnnotations(\ReflectionClass $class): array
30
    {
31
        return $this->reader->getClassAnnotations($class);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->reader->getClassAnnotations($class) returns the type array<mixed,object> which is incompatible with the documented return type JMS\Serializer\Metadata\Driver\list.
Loading history...
32
    }
33
34
    /**
35
     * @return list<object>
36
     */
37
    protected function getMethodAnnotations(\ReflectionMethod $method): array
38
    {
39
        return $this->reader->getMethodAnnotations($method);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->reader->ge...hodAnnotations($method) returns the type array<mixed,object> which is incompatible with the documented return type JMS\Serializer\Metadata\Driver\list.
Loading history...
40
    }
41
42
    /**
43
     * @return list<object>
44
     */
45
    protected function getPropertyAnnotations(\ReflectionProperty $property): array
46
    {
47
        return $this->reader->getPropertyAnnotations($property);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->reader->ge...yAnnotations($property) returns the type array<mixed,object> which is incompatible with the documented return type JMS\Serializer\Metadata\Driver\list.
Loading history...
48
    }
49
}
50