friends-of-behat/variadic-extension
...$args), ensuring alignment with modern Laravel (v9+) ecosystems.behat.yml and step definitions.--dev), avoiding production bloat.Given I have items: "a", "b", "c" vs. Given I have items: "a,b,c").Given I have 1 item, Given I have 2 items)?composer require friends-of-behat/variadic-extension --dev
behat.yml:
extensions:
FriendsOfBehat\VariadicExtension: ~
// Before
public function iHaveItems($item1, $item2) { ... }
public function iHaveItems($item1, $item2, $item3) { ... }
// After
public function iHaveItems(...$items) { ... }
Given I have items: "a", "b").Behat\Mink). Test with:
behat/mink (for browser testing).behat/mink-browserkit-driver (for Laravel apps).phpunit.xml or a dedicated behat.yml.@deprecated annotations.var_dump(...$args)).public function iHaveItems(...$items) {
if (empty($items)) {
throw new \InvalidArgumentException("At least one item is required.");
}
}
| Risk | Impact | Mitigation |
|---|---|---|
| Step definition breaks | Tests fail if arguments mismatch. | Use @throws annotations in feature files. |
| Overuse of variadic | Hard-to-read steps (e.g., 10 args). | Enforce limits (e.g., max 5 args). |
| CI flakiness | Argument parsing edge cases. | Add input validation in steps. |
CONTRIBUTING.md with step definition guidelines.How can I help you explore Laravel packages today?