Issues (210)

src/EventDispatcher/PreDeserializeEvent.php (2 issues)

1
<?php
2
3
declare(strict_types=1);
4
5
namespace JMS\Serializer\EventDispatcher;
6
7
use JMS\Serializer\DeserializationContext;
8
use JMS\Serializer\Type\Type;
9
10
/**
11
 * @phpstan-import-type TypeArray from Type
12
 */
13
class PreDeserializeEvent extends Event
14
{
15
    /**
16
     * @var mixed
17
     */
18
    private $data;
19
20
    /**
21
     * @param mixed $data
22
     * @param TypeArray $type
0 ignored issues
show
The type JMS\Serializer\EventDispatcher\TypeArray 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...
23
     */
24
    public function __construct(DeserializationContext $context, $data, array $type)
25
    {
26
        parent::__construct($context, $type);
27
28
        $this->data = $data;
29
    }
30
31
    public function setType(string $name, array $params = []): void
32
    {
33
        $this->type = ['name' => $name, 'params' => $params];
0 ignored issues
show
Documentation Bug introduced by
It seems like array('name' => $name, 'params' => $params) of type array<string,array|string> is incompatible with the declared type JMS\Serializer\EventDispatcher\TypeArray of property $type.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
34
    }
35
36
    /**
37
     * @return mixed
38
     */
39
    public function getData()
40
    {
41
        return $this->data;
42
    }
43
44
    /**
45
     * @param mixed $data
46
     */
47
    public function setData($data): void
48
    {
49
        $this->data = $data;
50
    }
51
}
52