diff --git a/src/Arguments.php b/src/Arguments.php index f8f1a0b..a246aa2 100644 --- a/src/Arguments.php +++ b/src/Arguments.php @@ -379,11 +379,13 @@ private function assertValues(): void $pos ); } else { - $variadicKeys = array_diff( + $variadicKeys = array_filter( array_keys($this->arguments), - $this->parameters->keys() + fn (string|int $key) => ! in_array($key, $this->parameters->keys(), true) + && ! (is_int($key) && $key < $pos) ); } + foreach ($variadicKeys as $id) { try { $this->assertSetArgument($name, $this->arguments[$id], $id);