-
-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathCompare.php
33 lines (29 loc) · 1.34 KB
/
Compare.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
declare(strict_types=1);
namespace Yiisoft\Validator\Rule;
use Attribute;
/**
* Defines validation options to compare the specified value with "target" value provided directly
* ({@see GreaterThanOrEqual::$targetValue}) or within a property ({@see GreaterThanOrEqual::$targetProperty}).
*
* The default comparison is based on number values (including float values). It's also possible to compare values as
* strings byte by byte and compare original values as is. See {@see GreaterThanOrEqual::$type} for all possible
* options.
*
* It supports different comparison operators, specified via the {@see Compare::$operator}.
*
* There are shortcut classes to use instead of specifying operator manually:
*
* - {@see Equal} is a shortcut for `new Compare(operator: '==')` and `new Compare(operator: '===')`.
* - {@see NotEqual} is a shortcut for `new Compare(operator: '!=')` and `new Compare(operator: '!==')`.
* - {@see GreaterThan} is a shortcut for `new Compare(operator: '>')`.
* - {@see GreaterThanOrEqual} is a shortcut for `new Compare(operator: '>=')`.
* - {@see LessThan} is a shortcut for `new Compare(operator: '<')`.
* - {@see LessThanOrEqual} is a shortcut for `new Compare(operator: '<=')`.
*
* @see CompareHandler
*/
#[Attribute(Attribute::TARGET_PROPERTY | Attribute::IS_REPEATABLE)]
final class Compare extends AbstractCompare
{
}