laravel-idea / plugin

Laravel Idea plugin for PhpStorm
https://laravel-idea.com/
176 stars 7 forks source link

[Bug]: Schedule macro generated as returning void #688

Closed dmason30 closed 1 year ago

dmason30 commented 1 year ago

Bug description

I have this package which registers a macro on the Schedule class which return an instance of Illuminate\Console\Scheduling\Event but when running Generate Helper Code the generated macro code says that the queueCommand method returns void.

I tried adding a return type of Event to the closure but this does not seem to solve it. Is there a way to do it with the ide.json?

Source: https://github.com/fidum/laravel-schedule-queue-command/blob/main/src/LaravelScheduleQueueCommandServiceProvider.php

Code:

Schedule::macro('queueCommand', function (
    string $command,
    array $parameters = [],
    ?string $queue = null,
    ?string $connection = null
) {
    $arguments = Container::getInstance()
        ->make(Request::class)
        ->server('argv') ?: [];

    if (in_array('schedule:list', $arguments)) {
        return $this->command($command, $parameters);
    }

    return $this->call(function () use ($command, $parameters, $queue, $connection) {
        Container::getInstance()
            ->make(Kernel::class)
            ->queue($command, $parameters)
            ->onQueue($queue)
            ->onConnection($connection);
    })->description($command);
});

app/Concosle/Kernel.php image

Plugin version

6.2.2.223

Operating system

MacOS

Steps to reproduce

No response

Relevant log output

No response

adelf commented 1 year ago

Fixed in 7.0