mirror of
https://github.com/Respect/Validation.git
synced 2024-06-04 23:02:16 +02:00
Remove "Interface" suffix from exceptions
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
This commit is contained in:
parent
167c97bb83
commit
d7ebb8c1a7
|
@ -124,10 +124,10 @@ $usernameValidator->validate('#$%'); //false
|
|||
|
||||
## Exception types
|
||||
|
||||
- `Respect\Validation\Exceptions\ExceptionInterface`:
|
||||
- `Respect\Validation\Exceptions\Exception`:
|
||||
- All exceptions implement this interface;
|
||||
- `Respect\Validation\Exceptions\ValidationException`:
|
||||
- Implements the `Respect\Validation\Exceptions\ExceptionInterface` interface
|
||||
- Implements the `Respect\Validation\Exceptions\Exception` interface
|
||||
- Thrown when the `check()` fails
|
||||
- All validation exceptions extend this class
|
||||
- Available methods:
|
||||
|
|
|
@ -13,7 +13,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace Respect\Validation\Exceptions;
|
||||
|
||||
class AttributeException extends NestedValidationException implements NonOmissibleExceptionInterface
|
||||
class AttributeException extends NestedValidationException implements NonOmissibleException
|
||||
{
|
||||
public const NOT_PRESENT = 'not_present';
|
||||
public const INVALID = 'invalid';
|
||||
|
|
|
@ -13,6 +13,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace Respect\Validation\Exceptions;
|
||||
|
||||
class CallException extends GroupedValidationException implements NonOmissibleExceptionInterface
|
||||
class CallException extends GroupedValidationException implements NonOmissibleException
|
||||
{
|
||||
}
|
||||
|
|
|
@ -13,8 +13,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace Respect\Validation\Exceptions;
|
||||
|
||||
use Exception;
|
||||
|
||||
class ComponentException extends Exception implements ExceptionInterface
|
||||
class ComponentException extends \Exception implements Exception
|
||||
{
|
||||
}
|
||||
|
|
|
@ -13,6 +13,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace Respect\Validation\Exceptions;
|
||||
|
||||
interface NonOmissibleExceptionInterface extends ExceptionInterface
|
||||
use Throwable;
|
||||
|
||||
interface Exception extends Throwable
|
||||
{
|
||||
}
|
|
@ -13,7 +13,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace Respect\Validation\Exceptions;
|
||||
|
||||
class KeyException extends AttributeException implements NonOmissibleExceptionInterface
|
||||
class KeyException extends AttributeException implements NonOmissibleException
|
||||
{
|
||||
public static $defaultTemplates = [
|
||||
self::MODE_DEFAULT => [
|
||||
|
|
|
@ -13,7 +13,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace Respect\Validation\Exceptions;
|
||||
|
||||
class KeyNestedException extends AttributeException implements NonOmissibleExceptionInterface
|
||||
class KeyNestedException extends AttributeException implements NonOmissibleException
|
||||
{
|
||||
public static $defaultTemplates = [
|
||||
self::MODE_DEFAULT => [
|
||||
|
|
|
@ -13,7 +13,7 @@ declare(strict_types=1);
|
|||
|
||||
namespace Respect\Validation\Exceptions;
|
||||
|
||||
class KeySetException extends GroupedValidationException implements NonOmissibleExceptionInterface
|
||||
class KeySetException extends GroupedValidationException implements NonOmissibleException
|
||||
{
|
||||
public const STRUCTURE = 'structure';
|
||||
|
||||
|
|
|
@ -53,11 +53,11 @@ class NestedValidationException extends ValidationException implements IteratorA
|
|||
/**
|
||||
* Returns weather an exception should be omitted or not.
|
||||
*
|
||||
* @param ExceptionInterface $exception
|
||||
* @param Exception $exception
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function isOmissible(ExceptionInterface $exception)
|
||||
private function isOmissible(Exception $exception)
|
||||
{
|
||||
if (!$exception instanceof self) {
|
||||
return false;
|
||||
|
@ -67,7 +67,7 @@ class NestedValidationException extends ValidationException implements IteratorA
|
|||
$relatedExceptions->rewind();
|
||||
$childException = $relatedExceptions->current();
|
||||
|
||||
return 1 === $relatedExceptions->count() && !$childException instanceof NonOmissibleExceptionInterface;
|
||||
return 1 === $relatedExceptions->count() && !$childException instanceof NonOmissibleException;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -13,6 +13,6 @@ declare(strict_types=1);
|
|||
|
||||
namespace Respect\Validation\Exceptions;
|
||||
|
||||
interface ExceptionInterface
|
||||
interface NonOmissibleException extends Exception
|
||||
{
|
||||
}
|
|
@ -18,7 +18,7 @@ use function in_array;
|
|||
use function is_numeric;
|
||||
use function Respect\Stringifier\stringify;
|
||||
|
||||
class ValidationException extends InvalidArgumentException implements ExceptionInterface
|
||||
class ValidationException extends InvalidArgumentException implements Exception
|
||||
{
|
||||
public const MODE_DEFAULT = 'default';
|
||||
public const MODE_NEGATIVE = 'negative';
|
||||
|
|
|
@ -20,7 +20,7 @@ class ValidationExceptionTest extends TestCase
|
|||
public function testItImplementsExceptionInterface(): void
|
||||
{
|
||||
$validationException = new ValidationException();
|
||||
self::assertInstanceOf(ExceptionInterface::class, $validationException);
|
||||
self::assertInstanceOf(Exception::class, $validationException);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue