bolt / bolt/docs

Incorrect argument in NutCommands

Open
#915 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
45
Forks
189
PR merge metrics
No merged PRs in 30d

Description

If you take a look here,
https://github.com/bolt/docs/blame/3.0/docs/extensions/intermediate/nut-commands.md#L39
you'll notice that argument is `$container`
```php
protected function registerNutCommands(Container $container)
{
return [
new Nut\DropBearCommand(),
new Nut\KoalaCommand($container),
];
}
```

If `KoalaCommand` extends `Symfony\Component\Console\Command\Command` it causes an error, because it expects `$name` as __constructor's argument.
[Symfony/Component/Console/Command/Command.php#L69](https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Console/Command/Command.php#L69) :
```php
public function __construct(string $name = null) {
//...
}
```

If you extend `Bolt\Nut\BaseCommand` you can pass `$container` as argument and it works.

[Nut/BaseCommand.php#L69](https://github.com/bolt/bolt/blob/3.5/src/Nut/BaseCommand.php#L27) :
```php
public function __construct(Container $app = null) {
//...
}
```

But in this example `KoalaCommand` extends symfony's class.
```php
class KoalaCommand extends Command {
//...
}
```

It deserves a comment in documents.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.