Skip to content

Commit

Permalink
Fix message handler generator for Laravel > v5.7
Browse files Browse the repository at this point in the history
  • Loading branch information
KinaneD committed Dec 11, 2020
1 parent ffc49e3 commit ee98bd5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/Console/Commands/QueueCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Vinelab\Bowler\Console\Commands;

use Exception;
use Illuminate\Support\Str;
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputArgument;
use Vinelab\Bowler\Generators\HandlerGenerator;
Expand Down Expand Up @@ -43,7 +44,7 @@ public function handle()
$handlerGenerator = new HandlerGenerator();

$queue = $this->argument('queueName');
$handler = studly_case(preg_replace('/Handler(\.php)?$/', '', $this->argument('handler')).'Handler');
$handler = Str::studly(preg_replace('/Handler(\.php)?$/', '', $this->argument('handler')).'Handler');

try {
$handlerGenerator->generate($queue, $handler, self::TYPE);
Expand Down
3 changes: 2 additions & 1 deletion src/Console/Commands/SubscriberCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Vinelab\Bowler\Console\Commands;

use Exception;
use Illuminate\Support\Str;
use Illuminate\Console\Command;
use Vinelab\Bowler\Generators\HandlerGenerator;

Expand Down Expand Up @@ -43,7 +44,7 @@ public function handle()
$queue = $queue.'-pub-sub';
}

$handler = studly_case(preg_replace('/Handler(\.php)?$/', '', $this->argument('handler')).'Handler');
$handler = Str::studly(preg_replace('/Handler(\.php)?$/', '', $this->argument('handler')).'Handler');

try {
$handlerGenerator->generate($queue, $handler, self::TYPE);
Expand Down
4 changes: 2 additions & 2 deletions src/Generators/stubs/handler.stub
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ class {{handler}}
*
* @return void
*/
public function handle($msg)
public function handle(AMQPMessage $msg)
{
//
}

/**
* Handle error
*
* @param Exception $e
* @param Exception|Throwable $e
* @param MessageBroker $broker
*
* @return void
Expand Down

0 comments on commit ee98bd5

Please sign in to comment.