| Conditions | 4 |
| Paths | 6 |
| Total Lines | 21 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 38 | 4 | public function normalizeField( |
|
| 39 | string $path, |
||
| 40 | $object, |
||
| 41 | NormalizerContextInterface $context, |
||
| 42 | NormalizerInterface $normalizer = null |
||
| 43 | ) { |
||
| 44 | 4 | $value = $this->fieldNormalizer->normalizeField($path, $object, $context, $normalizer); |
|
| 45 | |||
| 46 | 4 | if (is_string($value)) { |
|
| 47 | try { |
||
| 48 | 2 | $value = new \DateTime($value); |
|
| 49 | 1 | } catch (\Exception $exception) { |
|
| 50 | } |
||
| 51 | } |
||
| 52 | |||
| 53 | 4 | if (!$value instanceof \DateTimeInterface) { |
|
| 54 | 2 | return $value; |
|
| 55 | } |
||
| 56 | |||
| 57 | 2 | return $value->format($this->format); |
|
| 58 | } |
||
| 59 | } |
||
| 60 |
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
$italyis not defined by the methodfinale(...).The most likely cause is that the parameter was removed, but the annotation was not.