Visitar URL original
[4.x] Document passing an event object to dispatch() and the 5.0 removals by Hackwar · Pull Request #60 · joomla-framework/event · GitHub
Skip to content

[4.x] Document passing an event object to dispatch() and the 5.0 removals - #60

Open
Hackwar wants to merge 1 commit into
joomla-framework:4.x-devfrom
Hackwar:4.x-document-event-objects
Open

Hackwar wants to merge 1 commit into
joomla-framework:4.x-devfrom
Hackwar:4.x-document-event-objects

Conversation

@Hackwar

@Hackwar Hackwar commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Summary of Changes

Since 2.0, calling Dispatcher::dispatch() without an event object, the default event objects (setEvent(), addEvent(), hasEvent(), getEvent(), removeEvent(), getEvents(), clearEvents(), countEvents()), Dispatcher::triggerEvent() and Event::stop() are deprecated, and the deprecation notices say they will be removed in 5.0. docs/overview.md still uses dispatch('onAfterSomething') without an event in "Dispatching Events" and in the "Observable classes" example, and says the default event objects will be removed "in 3.0".

This PR updates the docs only:

  • "Registering Custom Events": removal version corrected to 5.0, with the replacement (create the event object and pass it to dispatch()).
  • "Dispatching Events": the example without an event object is gone; the text says to always pass an event object with a matching name and lists the deprecated calls and their replacements.
  • "Observable classes": the example now passes new Event(...) to dispatch().

The removal itself is a separate 5.x PR.

Testing Instructions

Documentation only; review the text.

Documentation Changes Required

This is the documentation change (docs/overview.md).

Related to #50 (also edits docs/overview.md, in a different section).

🤖 Generated with Claude Code

The overview still showed dispatch() without an event object and said
the default event objects would be removed in 3.0. Both have been
deprecated since 2.0 and go away in 5.0. Show the replacement in every
example and name the 5.0 removals.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Hackwar

Hackwar commented Nov 13, 2026

Copy link
Copy Markdown
Contributor Author

CI fails in "Install PHP dependencies" before any check runs, independent of this change: joomla/console (require-dev) requires joomla/event ^4.0, but the checked-out root package gets a dev-<branch|sha> version that does not satisfy it ("joomla/event dev-… is the root package and cannot be modified"). The scheduled runs on 4.x-dev fail the same way (every run since at least 2026-08-31). Locally, with COMPOSER_ROOT_VERSION=4.0.x-dev, phpunit, phpcs (src) and phpstan pass. Fixing it needs a root version in CI (e.g. COMPOSER_ROOT_VERSION in the shared workflow, or a branch-alias plus enough git history for Composer to guess the version), which is outside the scope of this PR.

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

Successfully merging this pull request may close these issues.

1 participant