1 | <?php |
||
24 | class Serializer |
||
25 | { |
||
26 | /** |
||
27 | * @var SerializerInterface|DenormalizerInterface|JMSSerializerInterface|ArrayTransformerInterface |
||
28 | */ |
||
29 | private $serializer; |
||
30 | |||
31 | /** |
||
32 | * @param SerializerInterface|DenormalizerInterface|JMSSerializerInterface|ArrayTransformerInterface $serializer |
||
33 | */ |
||
34 | public function __construct($serializer) |
||
38 | |||
39 | /** |
||
40 | * @param array $data |
||
41 | * @param string $class |
||
42 | * |
||
43 | * @return Subscriber |
||
44 | */ |
||
45 | public function denormalize(array $data, $class) |
||
49 | |||
50 | /** |
||
51 | * @param Subscriber $data |
||
52 | * @param string $format |
||
53 | * |
||
54 | * @return MindbazSubscriber |
||
55 | */ |
||
56 | public function serialize(Subscriber $data, $format) |
||
60 | |||
61 | /** |
||
62 | * @param MindbazSubscriber $data |
||
63 | * @param string $type |
||
64 | * @param string $format |
||
65 | * |
||
66 | * @return Subscriber |
||
67 | */ |
||
68 | public function deserialize(MindbazSubscriber $data, $type, $format) |
||
72 | } |
||
73 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: