Skip to content

Refactor app execution flow to remove stop()-driven control flow #469

Closed
5 of 5 issues completed
Closed

Description

@armanist

Summary

Refactor application execution flow so normal web and console control paths do not rely on stop() and StopExecutionException.

The end state should be:

  • explicit return-driven flow in web
  • explicit return-driven / exit-code-driven flow in console
  • fluent Response API for HTTP pipelines
  • consistent handling of controllers, middleware, and hooks

Why this is an umbrella

This work crosses multiple layers:

  • HTTP response API
  • router dispatch
  • middleware pipeline
  • WebAppAdapter
  • ConsoleAppAdapter
  • shared app helpers and exception flow

This should not land as one large ticket because:

  • web and console have different semantics
  • shared control-flow changes need ordered rollout
  • behavior changes need isolated validation

Child tickets

  1. Fluent Response API and strict dispatcher return contract
  2. Web middleware/controller/hook return-flow refactor
  3. WebAppAdapter and web helper cleanup
  4. ConsoleAppAdapter termination refactor
  5. Shared cleanup for stop() and StopExecutionException

End-state requirements

  • WebAppAdapter::start(): ?int remains unchanged and always returns 0
  • ConsoleAppAdapter::start(): ?int remains unchanged and preserves meaningful exit codes
  • actions return Response
  • middleware returns Response
  • hooks follow the same explicit-return principle
  • normal web flow does not depend on stop()
  • normal console flow does not depend on stop()

Validation

Each child ticket should land with focused validation, then the umbrella closes only after full validation:

  • composer test
  • composer phpstan
  • composer cs:check

Activity

  1. added this to the 3.0.0 milestone on Apr 28, 2026
  2. armanist commented on Apr 29, 2026

    @armanist
    CollaboratorAuthor

    Closing umbrella as completed.\n\nCompleted child tickets:\n- #470 Fluent Response API + dispatcher return contract\n- #471 Web middleware/controller/hook explicit Response flow\n- #472 WebAppAdapter + web helper stop() removal\n- #473 ConsoleAppAdapter explicit exit-code return flow\n- #474 Shared stop()/StopExecutionException cleanup\n\nEnd-state achieved:\n- Normal web and console flows are return-driven (not stop()-driven).\n- stop()/StopExecutionException removed from ordinary execution paths.\n- Contracts preserved (WebAppAdapter::start(): ?int, ConsoleAppAdapter::start(): ?int).\n\nValidation run across the series:\n- vendor/bin/phpunit\n- composer phpstan\n- composer cs:check\n\nClosing #469.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions