respect-validation/library/Rules/Not.php
Henrique Moody 901774f6b7
Improve naming and delete unnecessary Mode
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`.
2025-01-17 10:51:18 +01:00

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');
}
}