1 | <?php |
||
17 | class CheckParser implements ValidatorInterface |
||
18 | { |
||
19 | /** |
||
20 | * @var ParserInterface |
||
21 | */ |
||
22 | private $parser; |
||
23 | |||
24 | /** |
||
25 | * @var string |
||
26 | */ |
||
27 | private $error; |
||
28 | |||
29 | /** |
||
30 | * @param ParserInterface $parser the InputParser (usually a Field) which should attempt to parse the input |
||
31 | * @param string $error error message template (the "{field}" token will be substituted) |
||
32 | */ |
||
33 | 3 | public function __construct(ParserInterface $parser, $error) |
|
38 | |||
39 | 1 | public function validate(FieldInterface $field, InputModel $model, InputValidation $validation) |
|
51 | } |
||
52 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.