Closed Erikvv closed 7 years ago
OMG this would cause BC break for me please don't do it now even if this is desired behavior.
Closing as per @svycka's review.
The API of the validators should generally be changed as such (or similar) when having a chance:
interface Validator
{
public function validate($inputValue) : ValidationResult;
}
class ValidationResult
{
public function isValid() : bool { ... }
public function inputValue() { ... }
public function validValue() { ... }
public function errorMessages() : array { ... }
}
Just pseudo-code, but you get the gist.
If the validation failed, according to the docblock, it should throw an exception if you try to get the filtered values anyways.
However this does not happen.
What Exception type should it throw? Should we define a new type "ValidationFailedException" or sth?
This is still a relevant question for when we get stateless InputFilters