respect-validation/library/Mixins/StaticLength.php
Henrique Moody 97b243daa1
Allow building rules using prefixes
Although helpful, the changes in the Min, Max, and Length rules made
using those rules more verbose. This commit will simplify their use by
allowing users to use them as prefixes.

Because I was creating prefixes for those rules, I made other cool
prefixes. Doing that is scary because it will generate more code to
support, and I would have liked to avoid that. However, that's a
valuable addition, and it's worth the risk.

I might reconsider that in the future, but for now, that looks like a
good idea.

Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2024-03-24 16:58:24 +01:00

54 lines
1.7 KiB
PHP

<?php
/*
* Copyright (c) Alexandre Gomes Gaigalas <alganet@gmail.com>
* SPDX-License-Identifier: MIT
*/
declare(strict_types=1);
namespace Respect\Validation\Mixins;
interface StaticLength
{
public static function lengthBetween(mixed $minValue, mixed $maxValue): ChainedValidator;
public static function lengthBetweenExclusive(mixed $minimum, mixed $maximum): ChainedValidator;
public static function lengthEquals(mixed $compareTo): ChainedValidator;
public static function lengthEquivalent(mixed $compareTo): ChainedValidator;
public static function lengthEven(): ChainedValidator;
public static function lengthFactor(int $dividend): ChainedValidator;
public static function lengthFibonacci(): ChainedValidator;
public static function lengthFinite(): ChainedValidator;
public static function lengthGreaterThan(mixed $compareTo): ChainedValidator;
public static function lengthGreaterThanOrEqual(mixed $compareTo): ChainedValidator;
public static function lengthIdentical(mixed $compareTo): ChainedValidator;
public static function lengthIn(mixed $haystack, bool $compareIdentical = false): ChainedValidator;
public static function lengthInfinite(): ChainedValidator;
public static function lengthLessThan(mixed $compareTo): ChainedValidator;
public static function lengthLessThanOrEqual(mixed $compareTo): ChainedValidator;
public static function lengthMultiple(int $multipleOf): ChainedValidator;
public static function lengthOdd(): ChainedValidator;
public static function lengthPerfectSquare(): ChainedValidator;
public static function lengthPositive(): ChainedValidator;
public static function lengthPrimeNumber(): ChainedValidator;
}