mirror of
https://github.com/Respect/Validation.git
synced 2024-06-20 14:35:06 +02:00
Make classes final
The rules "AllOf," "NotEmpty," and "Xdigit" cannot be final because other rules extend them. Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
This commit is contained in:
parent
c60ca7937b
commit
b340b74cfd
|
@ -17,7 +17,7 @@ namespace Respect\Validation\Exceptions;
|
|||
* @author Alexandre Gomes Gaigalas <alexandre@gaigalas.net>
|
||||
* @author Henrique Moody <henriquemoody@gmail.com>
|
||||
*/
|
||||
class AnyOfException extends NestedValidationException
|
||||
final class AnyOfException extends NestedValidationException
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace Respect\Validation\Exceptions;
|
|||
* @author Alexandre Gomes Gaigalas <alexandre@gaigalas.net>
|
||||
* @author Henrique Moody <henriquemoody@gmail.com>
|
||||
*/
|
||||
class DomainException extends NestedValidationException
|
||||
final class DomainException extends NestedValidationException
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace Respect\Validation\Exceptions;
|
|||
* @author Davide Pastore <pasdavide@gmail.com>
|
||||
* @author Henrique Moody <henriquemoody@gmail.com>
|
||||
*/
|
||||
class HexRgbColorException extends ValidationException
|
||||
final class HexRgbColorException extends ValidationException
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace Respect\Validation\Exceptions;
|
|||
/**
|
||||
* @author Henrique Moody <henriquemoody@gmail.com>
|
||||
*/
|
||||
class IdentityCardException extends ValidationException
|
||||
final class IdentityCardException extends ValidationException
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
|
|
@ -18,7 +18,7 @@ use function count;
|
|||
/**
|
||||
* @author Henrique Moody <henriquemoody@gmail.com>
|
||||
*/
|
||||
class KeySetException extends GroupedValidationException implements NonOmissibleException
|
||||
final class KeySetException extends GroupedValidationException implements NonOmissibleException
|
||||
{
|
||||
public const STRUCTURE = 'structure';
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace Respect\Validation\Exceptions;
|
|||
/**
|
||||
* @author Henrique Moody <henriquemoody@gmail.com>
|
||||
*/
|
||||
class KeyValueException extends ValidationException
|
||||
final class KeyValueException extends ValidationException
|
||||
{
|
||||
public const COMPONENT = 'component';
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ use Respect\Validation\Exceptions\ValidationException;
|
|||
/**
|
||||
* @author Henrique Moody <henriquemoody@gmail.com>
|
||||
*/
|
||||
class PlIdentityCardException extends ValidationException
|
||||
final class PlIdentityCardException extends ValidationException
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace Respect\Validation\Exceptions;
|
|||
/**
|
||||
* @author Henrique Moody <henriquemoody@gmail.com>
|
||||
*/
|
||||
class NoException extends ValidationException
|
||||
final class NoException extends ValidationException
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace Respect\Validation\Exceptions;
|
|||
* @author Alexandre Gomes Gaigalas <alexandre@gaigalas.net>
|
||||
* @author Henrique Moody <henriquemoody@gmail.com>
|
||||
*/
|
||||
class NoneOfException extends NestedValidationException
|
||||
final class NoneOfException extends NestedValidationException
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
|
|
@ -17,6 +17,6 @@ namespace Respect\Validation\Exceptions;
|
|||
* @author Alexandre Gomes Gaigalas <alexandre@gaigalas.net>
|
||||
* @author Henrique Moody <henriquemoody@gmail.com>
|
||||
*/
|
||||
class NotException extends GroupedValidationException
|
||||
final class NotException extends GroupedValidationException
|
||||
{
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace Respect\Validation\Exceptions;
|
|||
* @author Bradyn Poulsen <bradyn@bradynpoulsen.com>
|
||||
* @author Henrique Moody <henriquemoody@gmail.com>
|
||||
*/
|
||||
class OneOfException extends NestedValidationException
|
||||
final class OneOfException extends NestedValidationException
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace Respect\Validation\Exceptions;
|
|||
/**
|
||||
* @author Henrique Moody <henriquemoody@gmail.com>
|
||||
*/
|
||||
class OptionalException extends ValidationException
|
||||
final class OptionalException extends ValidationException
|
||||
{
|
||||
public const NAMED = 'named';
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace Respect\Validation\Exceptions;
|
|||
/**
|
||||
* @author Henrique Moody <henriquemoody@gmail.com>
|
||||
*/
|
||||
class PostalCodeException extends ValidationException
|
||||
final class PostalCodeException extends ValidationException
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
|
|
@ -20,7 +20,7 @@ use RecursiveIterator;
|
|||
/**
|
||||
* @author Henrique Moody <henriquemoody@gmail.com>
|
||||
*/
|
||||
class RecursiveExceptionIterator implements RecursiveIterator, Countable
|
||||
final class RecursiveExceptionIterator implements RecursiveIterator, Countable
|
||||
{
|
||||
/**
|
||||
* @var ArrayIterator|ValidationException[]
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace Respect\Validation\Exceptions;
|
|||
* @author Henrique Moody <henriquemoody@gmail.com>
|
||||
* @author Jean Pimentel <jeanfap@gmail.com>
|
||||
*/
|
||||
class RomanException extends ValidationException
|
||||
final class RomanException extends ValidationException
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace Respect\Validation\Exceptions;
|
|||
*
|
||||
* @author Henrique Moody <henriquemoody@gmail.com>
|
||||
*/
|
||||
class SizeException extends NestedValidationException
|
||||
final class SizeException extends NestedValidationException
|
||||
{
|
||||
public const BOTH = 'both';
|
||||
public const LOWER = 'lower';
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace Respect\Validation\Exceptions;
|
|||
* @author Henrique Moody <henriquemoody@gmail.com>
|
||||
* @author Mikhail Vyrtsev <reeywhaar@gmail.com>
|
||||
*/
|
||||
class SortedException extends ValidationException
|
||||
final class SortedException extends ValidationException
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace Respect\Validation\Exceptions;
|
|||
* @author Andre Ramaciotti <andre@ramaciotti.com>
|
||||
* @author Henrique Moody <henriquemoody@gmail.com>
|
||||
*/
|
||||
class SpaceException extends FilteredValidationException
|
||||
final class SpaceException extends FilteredValidationException
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace Respect\Validation\Exceptions;
|
|||
* @author Alexandre Gomes Gaigalas <alexandre@gaigalas.net>
|
||||
* @author Henrique Moody <henriquemoody@gmail.com>
|
||||
*/
|
||||
class StartsWithException extends ValidationException
|
||||
final class StartsWithException extends ValidationException
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace Respect\Validation\Exceptions;
|
|||
/**
|
||||
* @author Henrique Moody <henriquemoody@gmail.com>
|
||||
*/
|
||||
class UrlException extends ValidationException
|
||||
final class UrlException extends ValidationException
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace Respect\Validation\Exceptions;
|
|||
* @author Henrique Moody <henriquemoody@gmail.com>
|
||||
* @author Kleber Hamada Sato <kleberhs007@yahoo.com>
|
||||
*/
|
||||
class VowelException extends FilteredValidationException
|
||||
final class VowelException extends FilteredValidationException
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace Respect\Validation\Exceptions;
|
|||
* @author Andre Ramaciotti <andre@ramaciotti.com>
|
||||
* @author Henrique Moody <henriquemoody@gmail.com>
|
||||
*/
|
||||
class XdigitException extends FilteredValidationException
|
||||
final class XdigitException extends FilteredValidationException
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace Respect\Validation\Exceptions;
|
|||
* @author Alexandre Gomes Gaigalas <alexandre@gaigalas.net>
|
||||
* @author Henrique Moody <henriquemoody@gmail.com>
|
||||
*/
|
||||
class ZendException extends NestedValidationException
|
||||
final class ZendException extends NestedValidationException
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
|
|
@ -21,7 +21,7 @@ use function count;
|
|||
* @author Alexandre Gomes Gaigalas <alexandre@gaigalas.net>
|
||||
* @author Henrique Moody <henriquemoody@gmail.com>
|
||||
*/
|
||||
class AnyOf extends AbstractComposite
|
||||
final class AnyOf extends AbstractComposite
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
|
|
@ -29,12 +29,12 @@ final class Callback extends AbstractRule
|
|||
/**
|
||||
* @var callable
|
||||
*/
|
||||
public $callback;
|
||||
private $callback;
|
||||
|
||||
/**
|
||||
* @var mixed[]
|
||||
*/
|
||||
public $arguments;
|
||||
private $arguments;
|
||||
|
||||
/**
|
||||
* Initializes the rule.
|
||||
|
|
|
@ -28,23 +28,23 @@ use function mb_substr_count;
|
|||
* @author Nick Lombard <github@jigsoft.co.za>
|
||||
* @author Róbert Nagy <vrnagy@gmail.com>
|
||||
*/
|
||||
class Domain extends AbstractComposite
|
||||
final class Domain extends AbstractComposite
|
||||
{
|
||||
/**
|
||||
* @var Validatable
|
||||
*/
|
||||
protected $tld;
|
||||
private $tld;
|
||||
|
||||
/**
|
||||
* @var Validatable[]
|
||||
*/
|
||||
protected $checks = [];
|
||||
private $checks = [];
|
||||
|
||||
/**
|
||||
* @var AllOf
|
||||
*
|
||||
*/
|
||||
protected $otherParts;
|
||||
private $otherParts;
|
||||
|
||||
public function __construct(bool $tldCheck = true)
|
||||
{
|
||||
|
|
|
@ -33,12 +33,12 @@ final class EndsWith extends AbstractRule
|
|||
/**
|
||||
* @var mixed
|
||||
*/
|
||||
public $endValue;
|
||||
private $endValue;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
public $identical;
|
||||
private $identical;
|
||||
|
||||
/**
|
||||
* @param mixed $endValue
|
||||
|
|
|
@ -22,7 +22,7 @@ use function mb_substr;
|
|||
* @author Davide Pastore <pasdavide@gmail.com>
|
||||
* @author Henrique Moody <henriquemoody@gmail.com>
|
||||
*/
|
||||
class HexRgbColor extends Xdigit
|
||||
final class HexRgbColor extends Xdigit
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
|
|
@ -24,7 +24,7 @@ use function is_scalar;
|
|||
* @author Emmerson Siqueira <emmersonsiqueira@gmail.com>
|
||||
* @author Henrique Moody <henriquemoody@gmail.com>
|
||||
*/
|
||||
class Key extends AbstractRelated
|
||||
final class Key extends AbstractRelated
|
||||
{
|
||||
/**
|
||||
* @param mixed $reference
|
||||
|
|
|
@ -32,7 +32,7 @@ use function sprintf;
|
|||
* @author Henrique Moody <henriquemoody@gmail.com>
|
||||
* @author Ivan Zinovyev <vanyazin@gmail.com>
|
||||
*/
|
||||
class KeyNested extends AbstractRelated
|
||||
final class KeyNested extends AbstractRelated
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
|
|
@ -23,22 +23,22 @@ use function in_array;
|
|||
/**
|
||||
* @author Henrique Moody <henriquemoody@gmail.com>
|
||||
*/
|
||||
class KeyValue extends AbstractRule
|
||||
final class KeyValue extends AbstractRule
|
||||
{
|
||||
/**
|
||||
* @var int|string
|
||||
*/
|
||||
public $comparedKey;
|
||||
private $comparedKey;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $ruleName;
|
||||
private $ruleName;
|
||||
|
||||
/**
|
||||
* @var int|string
|
||||
*/
|
||||
public $baseKey;
|
||||
private $baseKey;
|
||||
|
||||
/**
|
||||
* @param int|string $comparedKey
|
||||
|
|
|
@ -24,7 +24,7 @@ use function preg_match;
|
|||
*
|
||||
* @author Henrique Moody <henriquemoody@gmail.com>
|
||||
*/
|
||||
class PlIdentityCard extends AbstractRule
|
||||
final class PlIdentityCard extends AbstractRule
|
||||
{
|
||||
private const ASCII_CODE_0 = 48;
|
||||
private const ASCII_CODE_7 = 55;
|
||||
|
|
|
@ -23,7 +23,7 @@ final class Multiple extends AbstractRule
|
|||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $multipleOf;
|
||||
private $multipleOf;
|
||||
|
||||
public function __construct(int $multipleOf)
|
||||
{
|
||||
|
|
|
@ -20,7 +20,7 @@ use const NOEXPR;
|
|||
/**
|
||||
* @author Henrique Moody <henriquemoody@gmail.com>
|
||||
*/
|
||||
class No extends AbstractEnvelope
|
||||
final class No extends AbstractEnvelope
|
||||
{
|
||||
public function __construct(bool $useLocale = false)
|
||||
{
|
||||
|
|
|
@ -20,7 +20,7 @@ use function count;
|
|||
* @author Alexandre Gomes Gaigalas <alexandre@gaigalas.net>
|
||||
* @author Henrique Moody <henriquemoody@gmail.com>
|
||||
*/
|
||||
class NoneOf extends AbstractComposite
|
||||
final class NoneOf extends AbstractComposite
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
|
|
@ -22,12 +22,12 @@ use function array_shift;
|
|||
* @author Caio César Tavares <caiotava@gmail.com>
|
||||
* @author Henrique Moody <henriquemoody@gmail.com>
|
||||
*/
|
||||
class Not extends AbstractRule
|
||||
final class Not extends AbstractRule
|
||||
{
|
||||
/**
|
||||
* @var Validatable
|
||||
*/
|
||||
public $rule;
|
||||
private $rule;
|
||||
|
||||
public function __construct(Validatable $rule)
|
||||
{
|
||||
|
|
|
@ -22,7 +22,7 @@ use function count;
|
|||
* @author Bradyn Poulsen <bradyn@bradynpoulsen.com>
|
||||
* @author Henrique Moody <henriquemoody@gmail.com>
|
||||
*/
|
||||
class OneOf extends AbstractComposite
|
||||
final class OneOf extends AbstractComposite
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
|
|
@ -18,7 +18,7 @@ use Respect\Validation\Helpers\CanValidateUndefined;
|
|||
/**
|
||||
* @author Henrique Moody <henriquemoody@gmail.com>
|
||||
*/
|
||||
class Optional extends AbstractWrapper
|
||||
final class Optional extends AbstractWrapper
|
||||
{
|
||||
use CanValidateUndefined;
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace Respect\Validation\Rules;
|
|||
* @author Henrique Moody <henriquemoody@gmail.com>
|
||||
* @author Jean Pimentel <jeanfap@gmail.com>
|
||||
*/
|
||||
class Roman extends AbstractEnvelope
|
||||
final class Roman extends AbstractEnvelope
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
|
|
|
@ -26,27 +26,27 @@ use function sprintf;
|
|||
*
|
||||
* @author Henrique Moody <henriquemoody@gmail.com>
|
||||
*/
|
||||
class Size extends AbstractRule
|
||||
final class Size extends AbstractRule
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $minSize;
|
||||
private $minSize;
|
||||
|
||||
/**
|
||||
* @var float|null
|
||||
*/
|
||||
public $minValue;
|
||||
private $minValue;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
public $maxSize;
|
||||
private $maxSize;
|
||||
|
||||
/**
|
||||
* @var float|null
|
||||
*/
|
||||
public $maxValue;
|
||||
private $maxValue;
|
||||
|
||||
/**
|
||||
* @param string|int|null $minSize
|
||||
|
|
|
@ -19,17 +19,17 @@ use function count;
|
|||
* @author Henrique Moody <henriquemoody@gmail.com>
|
||||
* @author Mikhail Vyrtsev <reeywhaar@gmail.com>
|
||||
*/
|
||||
class Sorted extends AbstractRule
|
||||
final class Sorted extends AbstractRule
|
||||
{
|
||||
/**
|
||||
* @var callable
|
||||
*/
|
||||
public $fn = null;
|
||||
private $fn = null;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
public $ascending = true;
|
||||
private $ascending = true;
|
||||
|
||||
public function __construct(?callable $fn = null, bool $ascending = true)
|
||||
{
|
||||
|
|
|
@ -20,7 +20,7 @@ use function ctype_space;
|
|||
* @author Henrique Moody <henriquemoody@gmail.com>
|
||||
* @author Nick Lombard <github@jigsoft.co.za>
|
||||
*/
|
||||
class Space extends AbstractFilterRule
|
||||
final class Space extends AbstractFilterRule
|
||||
{
|
||||
protected function validateFilteredInput(string $input): bool
|
||||
{
|
||||
|
|
|
@ -24,17 +24,17 @@ use function reset;
|
|||
* @author Henrique Moody <henriquemoody@gmail.com>
|
||||
* @author Marcelo Araujo <msaraujo@php.net>
|
||||
*/
|
||||
class StartsWith extends AbstractRule
|
||||
final class StartsWith extends AbstractRule
|
||||
{
|
||||
/**
|
||||
* @var mixed
|
||||
*/
|
||||
public $startValue;
|
||||
private $startValue;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
public $identical;
|
||||
private $identical;
|
||||
|
||||
/**
|
||||
* @param mixed $startValue
|
||||
|
|
|
@ -19,7 +19,7 @@ use function preg_match;
|
|||
* @author Henrique Moody <henriquemoody@gmail.com>
|
||||
* @author Nick Lombard <github@jigsoft.co.za>
|
||||
*/
|
||||
class Vowel extends AbstractFilterRule
|
||||
final class Vowel extends AbstractFilterRule
|
||||
{
|
||||
protected function validateFilteredInput(string $input): bool
|
||||
{
|
||||
|
|
|
@ -26,17 +26,17 @@ use function mb_stripos;
|
|||
* @author Henrique Moody <henriquemoody@gmail.com>
|
||||
* @author Hugo Hamon <hugo.hamon@sensiolabs.com>
|
||||
*/
|
||||
class Zend extends AbstractRule
|
||||
final class Zend extends AbstractRule
|
||||
{
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
protected $messages = [];
|
||||
private $messages = [];
|
||||
|
||||
/**
|
||||
* @var ZendValidator
|
||||
*/
|
||||
protected $zendValidator;
|
||||
private $zendValidator;
|
||||
|
||||
/**
|
||||
* @param string|ZendValidator $validator
|
||||
|
|
|
@ -37,9 +37,9 @@ final class KeyValueTest extends TestCase
|
|||
|
||||
$rule = new KeyValue($comparedKey, $ruleName, $baseKey);
|
||||
|
||||
self::assertSame($comparedKey, $rule->comparedKey);
|
||||
self::assertSame($ruleName, $rule->ruleName);
|
||||
self::assertSame($baseKey, $rule->baseKey);
|
||||
self::assertAttributeSame($comparedKey, 'comparedKey', $rule);
|
||||
self::assertAttributeSame($ruleName, 'ruleName', $rule);
|
||||
self::assertAttributeSame($baseKey, 'baseKey', $rule);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -92,7 +92,7 @@ final class SizeTest extends TestCase
|
|||
{
|
||||
$rule = new Size($size);
|
||||
|
||||
self::assertEquals($bytes, $rule->minValue);
|
||||
self::assertAttributeEquals($bytes, 'minValue', $rule);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue