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

Commit 0498dc3

Browse files
committed
chore: small readibility improvements
1 parent 08a1543 commit 0498dc3

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/Validator.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
*/
1414
class Validator implements RuleInterface
1515
{
16+
/** @var RuleInterface[] */
1617
private array $rules;
1718

1819
public function __construct(RuleInterface ...$rules)
@@ -49,11 +50,11 @@ public function __call(string $ruleName, array $arguments = []): self
4950
*/
5051
public function assert(mixed $value, ?string $name = null): void
5152
{
52-
if (empty($this->getRules())) {
53+
if (empty($this->rules)) {
5354
throw new UnexpectedValueException('Validator rules not found: at least one rule is required.');
5455
}
5556

56-
foreach ($this->getRules() as $rule) {
57+
foreach ($this->rules as $rule) {
5758
$rule->assert($value, $name);
5859
}
5960
}
@@ -70,9 +71,6 @@ public function validate(mixed $value): bool
7071
return true;
7172
}
7273

73-
/**
74-
* @return RuleInterface[]
75-
*/
7674
public function getRules(): array
7775
{
7876
return $this->rules;

0 commit comments

Comments
 (0)