Issues (218)

src/Metadata/Driver/AttributeDriver.php (4 issues)

1
<?php
2
3
declare(strict_types=1);
4
5
namespace JMS\Serializer\Metadata\Driver;
6
7
use JMS\Serializer\Annotation\SerializerAttribute;
8
9
class AttributeDriver extends AnnotationOrAttributeDriver
10
{
11
    /**
12
     * @return list<SerializerAttribute>
0 ignored issues
show
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...
13
     */
14
    protected function getClassAnnotations(\ReflectionClass $class): array
15
    {
16
        return array_map(
0 ignored issues
show
Bug Best Practice introduced by
The expression return array_map(functio...ribute::IS_INSTANCEOF)) returns the type array which is incompatible with the documented return type JMS\Serializer\Metadata\Driver\list.
Loading history...
17
            static fn (\ReflectionAttribute $attribute): object => $attribute->newInstance(),
18
            $class->getAttributes(SerializerAttribute::class, \ReflectionAttribute::IS_INSTANCEOF),
19
        );
20
    }
21
22
    /**
23
     * @return list<SerializerAttribute>
24
     */
25
    protected function getMethodAnnotations(\ReflectionMethod $method): array
26
    {
27
        return array_map(
0 ignored issues
show
Bug Best Practice introduced by
The expression return array_map(functio...ribute::IS_INSTANCEOF)) returns the type array which is incompatible with the documented return type JMS\Serializer\Metadata\Driver\list.
Loading history...
28
            static fn (\ReflectionAttribute $attribute): object => $attribute->newInstance(),
29
            $method->getAttributes(SerializerAttribute::class, \ReflectionAttribute::IS_INSTANCEOF),
30
        );
31
    }
32
33
    /**
34
     * @return list<SerializerAttribute>
35
     */
36
    protected function getPropertyAnnotations(\ReflectionProperty $property): array
37
    {
38
        return array_map(
0 ignored issues
show
Bug Best Practice introduced by
The expression return array_map(functio...ribute::IS_INSTANCEOF)) returns the type array which is incompatible with the documented return type JMS\Serializer\Metadata\Driver\list.
Loading history...
39
            static fn (\ReflectionAttribute $attribute): object => $attribute->newInstance(),
40
            $property->getAttributes(SerializerAttribute::class, \ReflectionAttribute::IS_INSTANCEOF),
41
        );
42
    }
43
}
44