How can I investigate an exception in console?

I have created a console command that requires two dependencies:

public function __construct(LoopInterface $loop, ClientImpl $asteriskClient)
{
parent::__construct();

    $this->loop = $loop;
    $this->asteriskClient = $asteriskClient;
}

I have written a service provider for both of these. I know that the one for the client is working (since it isn’t new and I’ve used it before), but here is how I’ve added the React event loop:

namespace AppProviders;

use IlluminateSupportServiceProvider;
use ReactEventLoopFactory;

class ReactLoopServiceProvider extends ServiceProvider
{

    protected $defer = true;

    /**
     * Bootstrap the application services.
     *
     * @return void
     */
    public function boot()
    {
        //
    }

    /**
     * Register the application services.
     *
     * @return void
     */
    public function register()
    {
        $loop = Factory::create();
        $this->app->bind('ReactEventLoopLoopInterface', $loop);
    }

    public function provides()
    {
        return 'ReactEventLoopLoopInterface';
    }
}

And here is how I’ve registered it:

'providers' => [
    AppProvidersPamiServiceProvider::class,
    AppProvidersReactLoopServiceProvider::class,
]

However, when I run my command (php artisan app:push-server -vvv), I get this output:

  [ErrorException]
  Invalid argument supplied for foreach()

As you can see, there’s no traceback here. How can I investigate this?


Source: laravel

Leave a Reply