Brandon Kelly

Feb 17, 2025

Variadic CLI arguments in Yii 2.0.52

Yii 2.0.52 was released last week, which includes a little PR that I submitted making it possible for console controllers to accept variadic arguments.

public function actionMyAction(string ...$args): int
{
    // $args is an array of strings!
}

Thanks to that, we can now ship an improvement to the fields/merge command: the ability to specify an arbitrary number of field handles as arguments.

php craft fields/merge foo bar baz qux

Coming in Craft 5.7!