Skip to content

Commit 8c5c685

Browse files
committed
Updated fix to take into account other options passed to validation constraint
1 parent 05fab28 commit 8c5c685

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/Generator/TypeBuilder.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -638,8 +638,20 @@ protected function buildConstraints(array $constraints = [], bool $inClosure = t
638638
// Nested instance
639639
$instance->addArgument($this->buildConstraints($args, false));
640640
} elseif (isset($args['constraints'][0]) && is_array($args['constraints'][0])) {
641-
// Nested instance with explicit "constraints" key
642-
$instance->addArgument($this->buildConstraints($args['constraints'], false));
641+
// Nested instance with "constraints" key (full syntax)
642+
$options = [
643+
'constraints' => $this->buildConstraints($args['constraints'], false),
644+
];
645+
646+
// Check for additional options
647+
foreach ($args as $key => $option) {
648+
if ('constraints' === $key) {
649+
continue;
650+
}
651+
$options[$key] = $option;
652+
}
653+
654+
$instance->addArgument($options);
643655
} else {
644656
// Numeric or Assoc array?
645657
$instance->addArgument(isset($args[0]) ? $args : Collection::assoc($args));

0 commit comments

Comments
 (0)