Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$output throwing an error and not running command #15

Closed
rafatrace opened this issue Nov 20, 2015 · 5 comments
Closed

$output throwing an error and not running command #15

rafatrace opened this issue Nov 20, 2015 · 5 comments

Comments

@rafatrace
Copy link

Hi,
Silly looks amazing and faster and I want to use it instead of symfony/console but following your first page example I always get and error.

When I use this:

$app->command('greet [name] [--yell]', function ($name, $yell, OutputInterface $output) {

PHP Error log returns the following error:

PHP Catchable fatal error:  Argument 3 passed to {closure}() must be an instance of OutputInterface, instance of Symfony\Component\Console\Output\ConsoleOutput given in /Volumes/Macintosh Work/www/playground/f3-app/app/console/commands/new_package_command.php on line 8

To make this work I had to remove OutputInterface or change it with Symfony\Component\Console\Output\ConsoleOutput, is this de way to go or do you think I'm doing something wrong?

Cheers

@rafatrace rafatrace changed the title $output Error $output trowing an error and not runnin command Nov 20, 2015
@rafatrace rafatrace changed the title $output trowing an error and not runnin command $output throwing an error and not runnin command Nov 20, 2015
@rafatrace rafatrace changed the title $output throwing an error and not runnin command $output throwing an error and not running command Nov 20, 2015
@mnapoli
Copy link
Owner

mnapoli commented Nov 20, 2015

Hi, I admit the example assumes a bit too much. In fact you need to import the OutputInterface:

use Symfony\Component\Console\Output\OutputInterface;

@mnapoli
Copy link
Owner

mnapoli commented Nov 20, 2015

You can also use the fully qualified name:

$app->command('greet [name] [--yell]', function ($name, $yell, \Symfony\Component\Console\Output\OutputInterface $output) {

@mnapoli
Copy link
Owner

mnapoli commented Nov 20, 2015

I have fixed the example in the README with this commit: 2d74813

Thank you for taking the time to report it.

@rafatrace
Copy link
Author

Wow... fast reply.
It solved my problem @mnapoli
Another thing, in the docs you have "use" word twice ;)

Have a nice day

@mnapoli
Copy link
Owner

mnapoli commented Nov 20, 2015

Thanks I removed the typo :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants