Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Refactor WebAppAdapter::start() and ConsoleAppAdapter::start() into structured runtime pipelines

オープン
#537 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
35/100
issue の種類
リファクタリング
明瞭さ
おおむね明確
活発さ
静か
技術スタック
php
領域
backend

調査の方向性

src/App/Adapters/WebAppAdapter.php と src/App/Adapters/ConsoleAppAdapter.php から始め、関連する trait と src/App/BootPipeline.php を追ってください。現在の start() フローを RouteDispatcher.php および MiddlewareManager.php と比較し、ランタイムの状態と責務を整理してください。両方の adapter が専用のランタイムパイプラインとコンテキストオブジェクトを使用し、記載されている web と console の動作を維持できれば完了です。必要に応じてテストを更新してください。

索引モデルが issue の本文から書いたものです。

説明

runtime

Summary

Refactor WebAppAdapter::start() and ConsoleAppAdapter::start() so runtime execution is no longer handled as flat sequences of loosely connected method calls.

Introduce structured runtime pipelines for web and console flows, similar in spirit to boot stages, so execution becomes explicit, extensible, and ready for future lifecycle hooks.

Why

The constructor already has a clear staged boot flow through BootPipeline, but runtime execution is still handled ad hoc.

In WebAppAdapter::start(), current responsibilities are mixed together in one method:

  • preflight handling
  • route resolution
  • not found handling
  • language loading
  • debug info logging
  • view cache setup
  • cached response lookup
  • route dispatch
  • middleware execution
  • response sending
  • request cleanup

In ConsoleAppAdapter::start(), runtime execution is also flat:

  • core command registration
  • app command registration
  • command validation
  • command execution

This makes both runtime flows harder to reason about and leaves no clean structural boundaries for future lifecycle hooks.

Goal

Create proper runtime execution structures for both web and console adapters before introducing broader lifecycle hooks.

Runtime flow should become stage-based rather than remaining collections of ad hoc method calls.

Proposed Direction

Introduce dedicated runtime pipelines instead of reusing BootPipeline directly.

Suggested runtime structures:

  • RequestPipeline
  • RequestContext
  • ConsolePipeline
  • ConsoleContext

These should carry evolving runtime state rather than relying on loose locals and inline control flow.

Suggested Web Runtime Stages

A reasonable first breakdown of the current web flow is:

  • HandlePreflightStage
  • ResolveRouteStage
  • HandleRouteNotFoundStage
  • PrepareRequestStage
  • DispatchRequestStage
  • SendResponseStage
  • CleanupRequestStage

Notes:

  • PrepareRequestStage should cover:
    • language loading
    • debug info logging
    • view cache setup
  • DispatchRequestStage should cover:
    • cached response lookup
    • route dispatch
    • middleware execution

Suggested Console Runtime Stages

A reasonable first breakdown of the current console flow is:

  • RegisterCoreCommandsStage
  • RegisterAppCommandsStage
  • ValidateCommandStage
  • RunCommandStage

If needed, command registration can later be collapsed into a single preparation stage, but the first refactor should prioritize clarity.

Scope

This ticket is about refactoring runtime structure for both adapters.

It should not yet define the full lifecycle hook contract. That should come after runtime flow has proper structural boundaries.

Acceptance Criteria

  • WebAppAdapter::start() is refactored into a structured runtime pipeline
  • ConsoleAppAdapter::start() is refactored into a structured runtime pipeline
  • runtime state is carried through dedicated runtime context objects rather than loose local variables
  • web runtime responsibilities such as language loading and view cache handling are preserved in the new structure
  • console runtime responsibilities such as command registration, validation, and execution are preserved in the new structure
  • the new runtime structures are suitable for later lifecycle hook integration
  • tests are updated as needed

Notes

Relevant code:

  • src/App/Adapters/WebAppAdapter.php
  • src/App/Adapters/ConsoleAppAdapter.php
  • src/App/Traits/WebAppTrait.php
  • src/App/Traits/ConsoleAppTrait.php
  • src/Router/RouteDispatcher.php
  • src/Middleware/MiddlewareManager.php
  • src/App/BootPipeline.php

This ticket should be completed before introducing broader runtime lifecycle hooks.

主要言語
PHP
スター
36
フォーク
22
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

quantum-php/framework のほかの issue

quantum-php/framework の issue をすべて見る

似ている issue

PHP の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。