You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class TestEvent
{
public function __construct(
public string $test
) {}
}
And
class TestListener
{
public function handle(TestEvent $exampleEvent)
{
// Some code
}
}
Those snippets dont produce the same behavior:
// Does not work, throws a error in the listener class (listener excepts the TestEvent class, but is given a string)
Event::dispatch(TestEvent::class, ['hello']);
// Works as expected
Event::dispatch(new TestEvent('hello'));
I dont know if this is the intended behavior or not.
Laravel Version
11.20.0
PHP Version
8.3.7
Database Driver & Version
No response
Description
There is a inconsistency when dispatching events.
Given the classes:
And
Those snippets dont produce the same behavior:
I dont know if this is the intended behavior or not.
Links to #owen-it/laravel-auditing#963
Steps To Reproduce
The steps do reproduce are in the description above.
The text was updated successfully, but these errors were encountered: