laravel / tinker

Powerful REPL for the Laravel framework.
https://laravel.com/docs/artisan#tinker
MIT License
7.34k stars 130 forks source link

Issue registering StorageLinkCommand #143

Closed michaelhume closed 2 years ago

michaelhume commented 2 years ago

Description:

I have recently encountered a problem attempting to bind the StorageLinkCommand into tinker.

This was working, but I've been using Tinkerwell for a while now (which has no issue) so I'm not exactly sure at what point it stopped working, but I now get a TypeError when attempting to start tinker.

  Psy\Shell::add(): Argument #1 ($command) must be of type Symfony\Component\Console\Command\Command, null given, called in /path/to/my/code/vendor/symfony/console/Application.php on line 478

In config/tinker.php I have:

'commands' => [
        \Illuminate\Foundation\Console\StorageLinkCommand::class,
    ],

If I remove this - all is well.

In TinkerCommand.php the command is failing to resolve from the app

foreach ($config->get('tinker.commands', []) as $command) {
            $commands[] = $this->getApplication()->resolve($command);   // <-- this is returning null
        }

Any idea what might be happening here?

Steps To Reproduce:

Add the following to config/tinker.php and try to start tinker

'commands' => [
        \Illuminate\Foundation\Console\StorageLinkCommand::class,
    ],
driesvints commented 2 years ago

Actually, I now notice that none of the artisan commands work anymore within Tinker with Laravel 9. I'll investigate. Thanks

driesvints commented 2 years ago

Fixed with https://github.com/laravel/tinker/pull/144