1 | <?php |
||
8 | class ScalarNormalizer extends AbstractAggregateNormalizerAware implements NormalizerInterface, DenormalizerInterface |
||
9 | { |
||
10 | private $castFunctionMap = [ |
||
11 | 'integer' => 'intval', |
||
12 | 'string' => 'strval', |
||
13 | 'boolean' => 'boolval', |
||
14 | 'float' => 'floatval', |
||
15 | 'double' => 'doubleval', |
||
16 | ]; |
||
17 | |||
18 | /** |
||
19 | * Normalizes an object into a set of arrays/scalars. |
||
20 | * |
||
21 | * @param object $object object to normalize |
||
|
|||
22 | * @param string $format format the normalization result will be encoded as |
||
23 | * @param array $context Context options for the normalizer |
||
24 | * |
||
25 | * @return array|scalar |
||
26 | */ |
||
27 | public function normalize($value, $format = null, array $context = array()) |
||
31 | |||
32 | /** |
||
33 | * Checks whether the given class is supported for normalization by this normalizer. |
||
34 | * |
||
35 | * @param mixed $data Data to normalize |
||
36 | * @param string $format The format being (de-)serialized from or into |
||
37 | * |
||
38 | * @return bool |
||
39 | */ |
||
40 | public function supportsNormalization($data, $format = null) |
||
44 | |||
45 | /** |
||
46 | * Denormalizes data back into an object of the given class. |
||
47 | * |
||
48 | * @param mixed $data data to restore |
||
49 | * @param string $class the expected class to instantiate |
||
50 | * @param string $format format the given data was extracted from |
||
51 | * @param array $context options available to the denormalizer |
||
52 | * |
||
53 | * @return object |
||
54 | */ |
||
55 | public function denormalize($data, $type, $format = null, array $context = array()) |
||
65 | |||
66 | /** |
||
67 | * Checks whether the given class is supported for denormalization by this normalizer. |
||
68 | * |
||
69 | * @param mixed $data Data to denormalize from |
||
70 | * @param string $type The class to which the data should be denormalized |
||
71 | * @param string $format The format being deserialized from |
||
72 | * |
||
73 | * @return bool |
||
74 | */ |
||
75 | public function supportsDenormalization($data, $type, $format = null) |
||
79 | } |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.