Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: "Find listeners helper" bug. If listener listens to more than one event, those events don't know that they are listened by that listener #1131

Open
AlAdler opened this issue Jan 10, 2025 · 1 comment

Comments

@AlAdler
Copy link

AlAdler commented Jan 10, 2025

Bug description

  • There are two or more events. There is a listener that listens to both events (using union types).

Expected: The "find listeners" helper (the little yellow lightning bolt to the left of the event class definition) should show the listener when clicked.

Actual: The "find listeners" helper does not show the listener.

Plugin version

9.1.0.243

Operating system

MacOS

Steps to reproduce

No response

Relevant log output

No response

@adamjsturge
Copy link

This happened to me too, I attached a code example. With the listener the second type (or anything other than the first if you have multiple) clicking on the not first event Listener Helper Button will not show all the listeners

Example Created Event
<?php

namespace App\Events;

use App\Models\User;
use Illuminate\Foundation\Events\Dispatchable;

class UserCreated
{
    use Dispatchable;

    public function __construct(
        public readonly User $user
    ) {}
}
Example Updated Event
<?php

namespace App\Events;

use App\Models\User;
use Illuminate\Foundation\Events\Dispatchable;

class UserUpdated
{
    use Dispatchable;

    public function __construct(
        public readonly User $user
    ) {}
}
Example Event Listener
<?php

namespace App\Listeners;

use App\Contracts\DoesNotQueue;
use App\Events\UserCreated;
use App\Events\UserUpdated;
use App\Services\ExternalTableService;

readonly class UpsertTableListener implements DoesNotQueue
{
    public function __construct(
        private ExternalTableService $tableService
    ) {}

    public function handle(UserCreated|UserUpdated $event): void
    {
        // Handle
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants