| Total Complexity | 6 |
| Total Lines | 55 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 8 | abstract class AbstractValidator implements Validator |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * Has this validator been used before? |
||
| 12 | * if no, getErrorMessage() will throw an exception |
||
| 13 | * @var bool $validated |
||
| 14 | */ |
||
| 15 | protected $validated = false; |
||
| 16 | /** |
||
| 17 | * Stores the error message on validation failure |
||
| 18 | * @var string|null $error |
||
| 19 | */ |
||
| 20 | protected $error; |
||
| 21 | /** |
||
| 22 | * Error code to allow for search with int rather than string |
||
| 23 | * @var integer $errorCode |
||
| 24 | */ |
||
| 25 | protected $errorCode; |
||
| 26 | /** |
||
| 27 | * Return the error message upon validation, null returned if no errors are set |
||
| 28 | * @return string $error |
||
| 29 | * @throws PrematureErrorCallException |
||
| 30 | */ |
||
| 31 | public function getErrorMessage(): ?string |
||
| 32 | { |
||
| 33 | /** |
||
| 34 | * Extra check to make sure someone doesn't call this method before actually calling isValid() |
||
| 35 | */ |
||
| 36 | if ($this->validated == false) { |
||
| 37 | throw new PrematureErrorCallException(); |
||
| 38 | } |
||
| 39 | |||
| 40 | return $this->error; |
||
| 41 | } |
||
| 42 | |||
| 43 | /** |
||
| 44 | * Probably doesn't need to be included in the interface |
||
| 45 | * @return int|null |
||
| 46 | * @throws PrematureErrorCallException |
||
| 47 | */ |
||
| 48 | public function getErrorCode() : ?int |
||
| 55 | } |
||
| 56 | |||
| 57 | protected function success() |
||
| 58 | { |
||
| 59 | return new Result(true); |
||
| 60 | } |
||
| 61 | protected function failure($errors = []) { |
||
| 63 | } |
||
| 64 | } |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths