1 | <?php |
||
21 | class EntityIndexNormalizer extends AbstractNormalizer |
||
22 | { |
||
23 | protected $indexType = IntegerIndex::class; |
||
24 | |||
25 | /** |
||
26 | * @param string $type |
||
27 | */ |
||
28 | public function setIndexType(string $type) |
||
32 | |||
33 | /** |
||
34 | * Denormalizes data back into an object of the given class. |
||
35 | * |
||
36 | * @param mixed $data data to restore |
||
37 | * @param string $class the expected class to instantiate |
||
38 | * @param string $format format the given data was extracted from |
||
|
|||
39 | * @param array $context options available to the denormalizer |
||
40 | * |
||
41 | * @return object |
||
42 | */ |
||
43 | 2 | public function denormalize($data, $class, $format = null, array $context = []) |
|
49 | |||
50 | /** |
||
51 | * Checks whether the given class is supported for denormalization by this normalizer. |
||
52 | * |
||
53 | * @param mixed $data Data to denormalize from |
||
54 | * @param string $type The class to which the data should be denormalized |
||
55 | * @param string $format The format being deserialized from |
||
56 | * |
||
57 | * @return bool |
||
58 | */ |
||
59 | 2 | public function supportsDenormalization($data, $type, $format = null) |
|
63 | |||
64 | /** |
||
65 | * Normalizes an object into a set of arrays/scalars. |
||
66 | * |
||
67 | * @param object $object object to normalize |
||
68 | * @param string $format format the normalization result will be encoded as |
||
69 | * @param array $context Context options for the normalizer |
||
70 | * |
||
71 | * @return array|scalar |
||
72 | */ |
||
73 | 2 | public function normalize($object, $format = null, array $context = []) |
|
77 | |||
78 | /** |
||
79 | * Checks whether the given class is supported for normalization by this normalizer. |
||
80 | * |
||
81 | * @param mixed $data Data to normalize |
||
82 | * @param string $format The format being (de-)serialized from or into |
||
83 | * |
||
84 | * @return bool |
||
85 | */ |
||
86 | 2 | public function supportsNormalization($data, $format = null) |
|
90 | } |
This check looks for
@param
annotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.