respect-validation/library/Mixins/ChainedLength.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.6 KiB
PHP

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