Skip to content

refactor(console): resolve handle()-or-fire() in Command::execute() (task 3.8) - #44

Open
agissept wants to merge 1 commit into
migration/3.7-events-fire-dispatchfrom
migration/3.8-console-fire-handle
Open

refactor(console): resolve handle()-or-fire() in Command::execute() (task 3.8)#44
agissept wants to merge 1 commit into
migration/3.7-events-fire-dispatchfrom
migration/3.8-console-fire-handle

Conversation

@agissept

Copy link
Copy Markdown
Member

Stacked on #43 (task 3.7). Fork side of task 2.6 (Console fire()handle()).

What

  • Command::execute() now resolves method_exists($this,'handle') ? 'handle' : 'fire' and calls $this->{$method}(). handle() becomes the canonical L13 entry point; fire() is the L4.2 fallback that dies at the Console swap. Mirrors stock Command's own handle-or-__invoke resolution.
  • App commands can converge to handle() one at a time (both work during migration); the app sweep + guard land separately.

Why this shape (not temp-abstract)

Fork-internal commands (~38) keep fire() on purpose: they run via the fallback and get replaced by stock illuminate/* commands at their package swaps, so renaming them now is wasted. A temp-abstract handle() would force renaming all 38 (and break the app in one shot). Enforcement is runtime (not type-expressible), so it's grep-guarded app-side, consistent with Events/Cache.

Ratchet

event_fire baseline 4→3: execute()'s $this->fire() became $this->{$method}(), leaving only the 3 Queue Job::fire() (their own task).

Tests

Fork suite 1644 green (+1: testExecuteResolvesHandleThenFallsBackToFire — handle preferred, fire fallback).

Follow-up (separate)

App repo dicoding: sweep command fire()handle() (~48 classes) + grep guard + boot-smoke.

🤖 Generated with Claude Code

…task 3.8)

L13 Command runs handle() (or __invoke); fire() is removed. Make the fork's
execute() prefer handle() and fall back to fire() during migration -- mirrors
stock Command's runtime resolution and lets app commands converge to handle()
one at a time. fire() dies at the Console swap.

Fork-internal commands keep fire(): they run via the fallback and are replaced
by stock illuminate/* commands at their package swaps, so renaming them now is
wasted. Enforcement is app-side (grep guard on command classes) -- the
resolution is runtime, not type-expressible.

Ratchet event_fire baseline 4->3: Command::execute()'s `$this->fire()` is now
`$this->{$method}()`, leaving only the 3 Queue Job::fire() (their own task).

Fork suite 1644 green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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