mirror of
https://github.com/Respect/Validation.git
synced 2026-03-16 15:25:45 +01:00
We want to release version 3.0 as fresh as possible, without having to maintain backward compatibility with the previous versions. Acked-by: Alexandre Gomes Gaigalas <alganet@gmail.com>
31 lines
624 B
PHP
31 lines
624 B
PHP
<?php
|
|
|
|
/*
|
|
* Copyright (c) Alexandre Gomes Gaigalas <alganet@gmail.com>
|
|
* SPDX-License-Identifier: MIT
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Respect\Validation\Rules\Core;
|
|
|
|
use Respect\Validation\Rule;
|
|
|
|
use function array_merge;
|
|
|
|
abstract class Composite implements Rule
|
|
{
|
|
/** @var non-empty-array<Rule> */
|
|
protected readonly array $rules;
|
|
|
|
public function __construct(Rule $rule1, Rule $rule2, Rule ...$rules)
|
|
{
|
|
$this->rules = array_merge([$rule1, $rule2], $rules);
|
|
}
|
|
|
|
/** @return non-empty-array<Rule> */
|
|
public function getRules(): array
|
|
{
|
|
return $this->rules;
|
|
}
|
|
}
|