Skip to content

[Bug]: Inconsistent behavior of Event::commit return value. #245

Description

@tsterker

See PR with a proposed backwards-compatible fix: #238

What happened?

Depending on the registration of additional handle methods, the return value of a Event::commit can either be the exact return value of the event's handle method, or a collection of the handle return value` plus the return values of any additionally registered handlers.

This makes using the Event::commit return value virtually impossible, as there is no way to protect your events to get additional handlers registered.

The current Verbs documentation is also proposing a use case for Event::commit which is brittle: #218 (comment)

How to reproduce the bug

See this original ticket and the linked PR: #218

Package Version

v0.7.1

PHP Version

8.4.6

Laravel Version

N/A

Which operating systems does with happen with?

macOS

Notes

I prepared a PR that supports customizing the handle return resolution logic to stay backward-compatible (if this is considered a hard requirement), but allows people to opt into a more consistent behavior: #238

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions