| Total Complexity | 5 |
| Total Lines | 38 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | abstract class ComposingAssertion |
||
| 12 | { |
||
| 13 | public const MESSAGE = 'composing-assertion.not-as-asserted'; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * @var callable $data -> string[] |
||
| 17 | */ |
||
| 18 | private $errorFormatter; |
||
| 19 | |||
| 20 | public function __construct(?callable $errorFormatter = null) |
||
| 21 | { |
||
| 22 | $this->errorFormatter = $errorFormatter; |
||
| 23 | } |
||
| 24 | |||
| 25 | public static function withFormatter(callable $errorFormatter): self |
||
| 26 | { |
||
| 27 | return new static($errorFormatter); |
||
| 28 | } |
||
| 29 | |||
| 30 | public static function withTranslator(Translator $translator): self |
||
| 34 | }); |
||
| 35 | } |
||
| 36 | |||
| 37 | abstract public function validate($data, array $context = []): ValidationResult; |
||
| 38 | |||
| 39 | protected function validateAssertion(callable $assertion, $data, array $context = []): ValidationResult |
||
| 49 | } |
||
| 50 | } |
||
| 51 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.