Closed neclimdul closed 3 years ago
FWIW if you're running into this I worked around it by adding this to my service provider. Obviously it would be better if it worked out of the box or provided a failure and some useful feedback instead of crashing out entirely though.
/**
* The application instance.
*
* @var \Illuminate\Container\Container
*/
protected $app;
Description Binding job handle dependencies causes psalm to crash. The crash matches this earlier bug report #125.
From the documentation, if you need to specify how dependencies get injected to your job's handle method you need to use the
bindMethod
container method. This is a requirement if you have named services for any reason that can't be automatically resolved. https://laravel.com/docs/8.x/queues#handle-method-dependency-injectionThe problem seems to be this method doesn't exist on the container interface(hinted in the ServiceProvider abstract parent class) but it does exist on the actual container object. I'm not sure why this causes a crash instead of a failure but that is the behavior.
An example provider:
Impacted Versions my composer output as required. Though this binding behavior reaches well back into the 5.x releases of Laravel if not earlier.