respect-validation/library/Exceptions/CallException.php
Henrique Moody 2fac861aa1
Do not trigger PHP errors in the "Call" rule
This commit make sure that when the callable is executed by the "Call"
rule and PHP triggers an error, the user does not have to deal with it,
and instead the rule will throw "CallException".

Because of the many changes that were made, it didn't make sense to keep
the class "Call" extending the "AbstractRelated" class.

One thing that is a bit problematic with this rule - and with other
rules as well - is that Validation only knows details of a validation
when it fails, because of that we cannot invert the validations that
passed, meaning that the "Not" rule cannot give the proper response to
a validation that passed. This is a know issue that can only be fixed
is we provide a way for Validation do have more granularity control.

Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2018-08-21 01:22:38 +02:00

34 lines
860 B
PHP

<?php
/*
* This file is part of Respect/Validation.
*
* (c) Alexandre Gomes Gaigalas <alexandre@gaigalas.net>
*
* For the full copyright and license information, please view the "LICENSE.md"
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
/**
* @author Alexandre Gomes Gaigalas <alexandre@gaigalas.net>
* @author Henrique Moody <henriquemoody@gmail.com>
*/
final class CallException extends NestedValidationException
{
/**
* {@inheritdoc}
*/
public static $defaultTemplates = [
self::MODE_DEFAULT => [
self::STANDARD => '{{input}} must be valid when executed with {{callable}}',
],
self::MODE_NEGATIVE => [
self::STANDARD => '{{input}} must not be valid when executed with {{callable}}',
],
];
}