LaravelCollective/bus

Dispatcher implementation not compatible with Bus interface

Closed this issue ยท 27 comments

After upgrading to the 5.3 branch of Laravel and this package, I am receiving the following error:

PHP Fatal error: Declaration of Collective\Bus\Dispatcher::dispatchNow($command, Closure $afterResolving = NULL) must be compatible with Illuminate\Contracts\Bus\Dispatcher::dispatchNow($command, $handler = NULL)

It looks like the interface was recently updated in the commit below:

laravel/framework@1eade80

I'm having this same issue.

Me too!

You can use https://github.com/AltThree/Bus for a L5.3 version, or simply just switch back to Laravel 5.3's native stuff. We've added back the way to define handlers to the core, it's not not an automatic mapping. My alt three package just plugs that gap with a L5.1 like mapping registration.

Here's a usage example from a real app:

image

Getting the same error as well, right after upgrading to Laravel 5.3 and Collective\Bus 5.3

I had this same issue and temporarily fixed it by going to \vendor\laravelcollective\bus\src\Dispatcher.php and removing the Closure binding from the $afterResolving parameter of the dispatchNow function.

I'm not sure though if this is secure, and if it won't break any other functionality in the framework.

Any thoughts on this?

I had same issue ๐Ÿ˜ข

Same issue here.

there is an PR open for this.

As I've said already, this is a non-issue since there already exists another package that mimics L5.1 behaviour on L5.3, and other than that, you don't need this package, because the features that were removed in 5.2 are RESTORED TO THE CORE in L5.3.

It's like talking to a parrot...

On Nov 15, 2016 21:55, "Graham Campbell" notifications@github.com wrote:

As I've said already, this is a non-issue since there already exists
another package that mimics L5.1 behaviour on L5.3, and other than that,
you don't need this package, because the features that were removed in 5.2
are RESTORED TO THE CORE in L5.3.

โ€”
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#13 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAOIgmSHrgKw2KCaaQgidDiKjfxCxB37ks5q-hw6gaJpZM4JrFjj
.

@GrahamCampbell Are you able to point us to the core docs for 5.3 that cover this? I've had a look through and can't find anything.

@spronkey, it's not in the docs anymore (not since v5), the only thing I could find on the bus is the API docs: https://laravel.com/api/5.3/Illuminate/Bus.html

Are you able to point us to the core docs for 5.3 that cover this? I've had a look through and can't find anything.

I've already pointed you to github.com/AltThree/Bus that mimics the 5.1 style bus on laravel 5.3, and provides a replacement, similar to this package for laravel 5.2.

If you read the source code for https://github.com/AltThree/Bus/blob/master/src/Dispatcher.php, it should become immidately clear how it works.

Speaking frankly, I'm not sure why this issue is still open, because there is already a solution. This package works great on laravel 5.2, but it's totally unsuitable for Laravel 5.3, by design. This is not a simple patch it up and ship it problem.

On laravel 5.3+, you could use that other package, or just no package at all, since 5.3 brings back the features needed from 5.1, and the alt thee package just wraps them in a similar, but not identical, way to how it worked in 5.1.

@GrahamCampbell Offering an alternative package is fine and sometimes helpful. But in this case, a cursory look at this package shows it has scant documentation and will require a decent time investment into reading source code to see what it does and whether it's actually suitable for my particular use case.

Regardless, you've made a claim that 5.3 brings back features from 5.1, It would be helpful if you could explain what 5.3 brought back, as I've looked through the docs and release notes for 5.3 and can't see any mention of restoration of Commands, Commands with separate handlers, handler resolution etc.

@gvlatko Agreed, it's poor form.

as a side note: #14

Yeh, that PR doesn't work, because you need to basically start again to get it working, since the internals are totally different. Anyway, I'm unwatching this repo now.

Already spent half an hour trying to figure out what I am supposed to do with this now. No docs on this alternative package either. This is really bad.

@HectorOrdonez wait for it. Graham will show up, copy paste the same sentence (to use his package) and add another contribution to his Github profile.

of course it won't be of any help to you.

Upon upgrade to L5.3 from L5.2, I removed this module from package.json and error gone.

Upon upgrade to L5.3 from L5.2, I removed this module from package.json and error gone.

Yes, correct, upgrading from L5.2 to L5.3,

  1. Remove this collective/bus package from your composer.json,
  2. update your config/app.php to have Illuminate based BusServiceProvider
  3. Remove SelfHandling Contract, if still present on your jobs.

Done, your jobs should work flawlessly.