Conditions | 3 |
Paths | 3 |
Total Lines | 21 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 5 |
CRAP Score | 4.125 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
23 | 4 | public function validate(mixed $value, object $rule, ValidationContext $context): Result |
|
24 | { |
||
25 | 4 | if (!$rule instanceof Embedded) { |
|
26 | throw new UnexpectedRuleException(Embedded::class, $rule); |
||
27 | } |
||
28 | |||
29 | 4 | if (!is_object($value)) { |
|
30 | $formattedMessage = $this->formatter->format( |
||
|
|||
31 | 'Value should be an object, {type} given.', |
||
32 | [ |
||
33 | 'attribute' => $context->getAttribute(), |
||
34 | 'value' => $value, |
||
35 | 'type' => get_debug_type($value), |
||
36 | ] |
||
37 | ); |
||
38 | return (new Result())->addError($formattedMessage); |
||
39 | } |
||
40 | |||
41 | 4 | $dataSet = new ObjectDataSet($value, $rule->getPropertyVisibility()); |
|
42 | |||
43 | 4 | return $context->getValidator()->validate($dataSet); |
|
44 | } |
||
46 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.