1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | namespace Marcosh\PhpValidationDSL\Basic; |
||
6 | |||
7 | use Marcosh\PhpValidationDSL\Result\ValidationResult; |
||
8 | use Marcosh\PhpValidationDSL\Validation; |
||
9 | |||
10 | final class Errors extends ComposingAssertion implements Validation |
||
11 | { |
||
12 | public const MESSAGE = 'errors.invalid-data'; |
||
13 | |||
14 | /** |
||
15 | * @template T |
||
16 | * @psalm-param T $data |
||
17 | * @param mixed $data |
||
18 | * @param array $context |
||
19 | * @return ValidationResult |
||
20 | */ |
||
21 | public function validate($data, array $context = []): ValidationResult |
||
22 | { |
||
23 | $alwaysFalse = |
||
24 | /** |
||
25 | * @param mixed $data |
||
26 | * @psalm-param T $data |
||
27 | * @return false |
||
28 | */ |
||
29 | function ($data): bool { |
||
0 ignored issues
–
show
|
|||
30 | return false; |
||
31 | }; |
||
32 | |||
33 | return $this->validateAssertion($alwaysFalse, $data, $context); |
||
34 | } |
||
35 | } |
||
36 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.