mirror of
https://github.com/Respect/Validation.git
synced 2026-03-16 23:35:45 +01:00
I don't expect us to have more modes, hence a simple boolean value should be enough for indicating the mode of the teamplate. Apart from that, the name "inverted" woudln't always make sense, because if you invert something that is inverted, it gets back to its original mode. This commit will remove the `Mode` enum, and also improve the naming of some methods in the `Result`.
23 lines
552 B
PHP
23 lines
552 B
PHP
<?php
|
|
|
|
/*
|
|
* Copyright (c) Alexandre Gomes Gaigalas <alganet@gmail.com>
|
|
* SPDX-License-Identifier: MIT
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Respect\Validation\Rules;
|
|
|
|
use Attribute;
|
|
use Respect\Validation\Result;
|
|
use Respect\Validation\Rules\Core\Wrapper;
|
|
|
|
#[Attribute(Attribute::TARGET_PROPERTY | Attribute::TARGET_CLASS | Attribute::IS_REPEATABLE)]
|
|
final class Not extends Wrapper
|
|
{
|
|
public function evaluate(mixed $input): Result
|
|
{
|
|
return $this->rule->evaluate($input)->withToggledModeAndValidation()->withPrefix('not');
|
|
}
|
|
}
|