With parameter binding
, the parameters of task function are automatically pulled from container, options or arguments.
example:
$app->task(function(\PDO $db, array $args) {
// $db will be pulled from container
// equivalent to
// /** @var \PDO $db */
// $db = $this->db;
});
For $options and $arguments which is the parameters for task prior to 1.5.0, there must be a special rule for them.
$options
and$opts
are reserved argument forarray $options
$arguments
and$args
are reserved argument forarray $arguments
$context
are reserved argument forContext $context
- It's possible to specify those should be array or Hash or whatever classes accept array to its constructor. The default is
array
.