Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Validators/AllOf.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
use Respect\Validation\Message\Template;
use Respect\Validation\Result;
use Respect\Validation\Validator;
use Respect\Validation\Validators\Core\Composite;
use Respect\Validation\Validators\Core\LogicalComposite;
use Respect\Validation\Validators\Core\ShortCircuitable;

use function array_filter;
Expand All @@ -38,7 +38,7 @@
'{{subject}} must pass all the rules',
self::TEMPLATE_ALL,
)]
final class AllOf extends Composite implements ShortCircuitable
final class AllOf extends LogicalComposite implements ShortCircuitable
{
use CanEvaluateShortCircuit;

Expand Down
4 changes: 2 additions & 2 deletions src/Validators/AnyOf.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
use Respect\Validation\Message\Template;
use Respect\Validation\Result;
use Respect\Validation\Validator;
use Respect\Validation\Validators\Core\Composite;
use Respect\Validation\Validators\Core\LogicalComposite;
use Respect\Validation\Validators\Core\ShortCircuitable;

use function array_map;
Expand All @@ -30,7 +30,7 @@
'{{subject}} must pass at least one of the rules',
'{{subject}} must pass at least one of the rules',
)]
final class AnyOf extends Composite implements ShortCircuitable
final class AnyOf extends LogicalComposite implements ShortCircuitable
{
use CanEvaluateShortCircuit;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

use function array_merge;

abstract class Composite implements Validator
abstract class LogicalComposite implements Validator
{
/** @var non-empty-array<Validator> */
protected readonly array $validators;
Expand Down
4 changes: 2 additions & 2 deletions src/Validators/NoneOf.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
use Respect\Validation\Helpers\CanEvaluateShortCircuit;
use Respect\Validation\Message\Template;
use Respect\Validation\Result;
use Respect\Validation\Validators\Core\Composite;
use Respect\Validation\Validators\Core\LogicalComposite;
use Respect\Validation\Validators\Core\ShortCircuitable;

use function count;
Expand All @@ -34,7 +34,7 @@
'{{subject}} must pass all the rules',
self::TEMPLATE_ALL,
)]
final class NoneOf extends Composite implements ShortCircuitable
final class NoneOf extends LogicalComposite implements ShortCircuitable
{
use CanEvaluateShortCircuit;

Expand Down
4 changes: 2 additions & 2 deletions src/Validators/OneOf.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
use Respect\Validation\Message\Template;
use Respect\Validation\Result;
use Respect\Validation\Validator;
use Respect\Validation\Validators\Core\Composite;
use Respect\Validation\Validators\Core\LogicalComposite;
use Respect\Validation\Validators\Core\ShortCircuitable;

use function array_filter;
Expand All @@ -40,7 +40,7 @@
'{{subject}} must pass only one of the rules',
self::TEMPLATE_MORE_THAN_ONE,
)]
final class OneOf extends Composite implements ShortCircuitable
final class OneOf extends LogicalComposite implements ShortCircuitable
{
use CanEvaluateShortCircuit;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
namespace Respect\Validation\Test\Validators\Core;

use Respect\Validation\Result;
use Respect\Validation\Validators\Core\Composite;
use Respect\Validation\Validators\Core\LogicalComposite;

final class ConcreteComposite extends Composite
final class ConcreteLogicalComposite extends LogicalComposite
{
public function evaluate(mixed $input): Result
{
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/Validators/Core/CompositeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\Test;
use Respect\Validation\Test\TestCase;
use Respect\Validation\Test\Validators\Core\ConcreteComposite;
use Respect\Validation\Test\Validators\Core\ConcreteLogicalComposite;
use Respect\Validation\Test\Validators\Stub;

#[Group('core')]
#[CoversClass(Composite::class)]
#[CoversClass(LogicalComposite::class)]
final class CompositeTest extends TestCase
{
#[Test]
public function itShouldReturnItsChildren(): void
{
$expected = [Stub::daze(), Stub::daze(), Stub::daze()];
$sut = new ConcreteComposite(...$expected);
$sut = new ConcreteLogicalComposite(...$expected);
$actual = $sut->getValidators();

self::assertCount(3, $actual);
Expand Down