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

Commit 3881efb

Browse files
committed
chore: even if it was working, it makes more sense to have try catch inside key block
1 parent 7c70175 commit 3881efb

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/Rule/All.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -41,23 +41,23 @@ public function assert(mixed $value, string $name): void
4141
);
4242
}
4343

44-
try {
45-
foreach ($value as $key => $input) {
46-
foreach ($this->constraints as $constraint) {
44+
foreach ($value as $key => $input) {
45+
foreach ($this->constraints as $constraint) {
46+
try {
4747
$constraint->assert($input, $name);
4848
}
49+
catch (ValidationException $exception) {
50+
throw new AllException(
51+
message: $this->options['message'],
52+
parameters: [
53+
'value' => $value,
54+
'name' => $name,
55+
'key' => $key,
56+
'message' => $exception->getMessage()
57+
]
58+
);
59+
}
4960
}
5061
}
51-
catch (ValidationException $exception) {
52-
throw new AllException(
53-
message: $this->options['message'],
54-
parameters: [
55-
'value' => $value,
56-
'name' => $name,
57-
'key' => $key,
58-
'message' => $exception->getMessage()
59-
]
60-
);
61-
}
6262
}
6363
}

0 commit comments

Comments
 (0)