Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit 7451c90

Browse files
committed
chore: more ocd
1 parent ae127a3 commit 7451c90

4 files changed

Lines changed: 10 additions & 10 deletions

File tree

src/ChainedValidatorInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ public function greaterThan(mixed $constraint, array $options = []): ChainedVali
2121

2222
public function lessThan(mixed $constraint, array $options = []): ChainedValidatorInterface;
2323

24-
public function choice(array $constraints, bool $isMultiple = false, ?int $minConstraint = null, ?int $maxConstraint = null, array $options = []): ChainedValidatorInterface;
24+
public function choice(array $constraints, bool $multiple = false, ?int $minConstraint = null, ?int $maxConstraint = null, array $options = []): ChainedValidatorInterface;
2525
}

src/Rule/Choice.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class Choice extends AbstractRule implements RuleInterface
1212

1313
public function __construct(
1414
private readonly array $constraints,
15-
private readonly bool $isMultiple = false,
15+
private readonly bool $multiple = false,
1616
private readonly ?int $minConstraint = null,
1717
private readonly ?int $maxConstraint = null,
1818
array $options = []
@@ -37,13 +37,13 @@ public function __construct(
3737

3838
public function assert(mixed $value, string $name): void
3939
{
40-
if ($this->isMultiple && !\is_array($value)) {
40+
if ($this->multiple && !\is_array($value)) {
4141
throw new UnexpectedValueException(
42-
\sprintf('Expected value of type "array" when is multiple, "%s" given', get_debug_type($value))
42+
\sprintf('Expected value of type "array" when multiple, "%s" given', get_debug_type($value))
4343
);
4444
}
4545

46-
if ($this->isMultiple) {
46+
if ($this->multiple) {
4747
foreach ($value as $input) {
4848
if (!\in_array($input, $this->constraints, true)) {
4949
throw new ChoiceException(

src/StaticValidatorInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ public static function greaterThan(mixed $constraint, array $options = []): Chai
1010

1111
public static function lessThan(mixed $constraint, array $options = []): ChainedValidatorInterface;
1212

13-
public static function choice(array $constraints, bool $isMultiple = false, ?int $minConstraint = null, ?int $maxConstraint = null, array $options = []): ChainedValidatorInterface;
13+
public static function choice(array $constraints, bool $multiple = false, ?int $minConstraint = null, ?int $maxConstraint = null, array $options = []): ChainedValidatorInterface;
1414
}

tests/ChoiceTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class ChoiceTest extends AbstractTest
1919
public static function provideRuleUnexpectedValueData(): \Generator
2020
{
2121
yield 'multiple but not array' => [
22-
new Choice([1, 2], true), 1, '/Expected value of type "array" when is multiple, "(.*)" given/'
22+
new Choice([1, 2], true), 1, '/Expected value of type "array" when multiple, "(.*)" given/'
2323
];
2424
}
2525

@@ -68,7 +68,7 @@ public static function provideRuleMessageOptionData(): \Generator
6868
yield 'multiple message' => [
6969
new Choice(
7070
constraints: $constraints,
71-
isMultiple: true,
71+
multiple: true,
7272
options: [
7373
'multipleMessage' => 'The "{{ name }}" value "{{ value }}" is not a valid choice.'
7474
]
@@ -77,7 +77,7 @@ public static function provideRuleMessageOptionData(): \Generator
7777
yield 'min message' => [
7878
new Choice(
7979
constraints: $constraints,
80-
isMultiple: true,
80+
multiple: true,
8181
minConstraint: 2,
8282
options: [
8383
'minMessage' => 'The "{{ name }}" value should have at least {{ minConstraint }} choices.'
@@ -87,7 +87,7 @@ public static function provideRuleMessageOptionData(): \Generator
8787
yield 'max message' => [
8888
new Choice(
8989
constraints: $constraints,
90-
isMultiple: true,
90+
multiple: true,
9191
maxConstraint: 2,
9292
options: [
9393
'maxMessage' => 'The "{{ name }}" value should have at most {{ maxConstraint }} choices.'

0 commit comments

Comments
 (0)