Skip to content

Commit d0f8a8f

Browse files
Don't enable tracing unless the profiler is enabled
1 parent b3832cb commit d0f8a8f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Validator/TraceableValidator.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ class TraceableValidator implements ValidatorInterface, ResetInterface
2929

3030
public function __construct(
3131
private ValidatorInterface $validator,
32+
protected readonly ?\Closure $disabled = null,
3233
) {
3334
}
3435

@@ -56,6 +57,10 @@ public function validate(mixed $value, Constraint|array|null $constraints = null
5657
{
5758
$violations = $this->validator->validate($value, $constraints, $groups);
5859

60+
if ($this->disabled?->__invoke()) {
61+
return $violations;
62+
}
63+
5964
$trace = debug_backtrace(\DEBUG_BACKTRACE_IGNORE_ARGS, 7);
6065

6166
$file = $trace[0]['file'];

0 commit comments

Comments
 (0)