Refactor WebAppAdapter::start() and ConsoleAppAdapter::start() into structured runtime pipelines
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Bắt đầu với src/App/Adapters/WebAppAdapter.php và src/App/Adapters/ConsoleAppAdapter.php, sau đó lần theo các trait liên quan và src/App/BootPipeline.php. So sánh các luồng start() hiện tại với RouteDispatcher.php và MiddlewareManager.php để lập bản đồ trạng thái runtime và các trách nhiệm. Công việc được hoàn tất khi cả hai adapter sử dụng các pipeline runtime và đối tượng context chuyên dụng, đồng thời giữ nguyên hành vi web và console được liệt kê; cập nhật các test khi cần.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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:
RequestPipelineRequestContextConsolePipelineConsoleContext
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:
HandlePreflightStageResolveRouteStageHandleRouteNotFoundStagePrepareRequestStageDispatchRequestStageSendResponseStageCleanupRequestStage
Notes:
PrepareRequestStageshould cover:- language loading
- debug info logging
- view cache setup
DispatchRequestStageshould cover:- cached response lookup
- route dispatch
- middleware execution
Suggested Console Runtime Stages
A reasonable first breakdown of the current console flow is:
RegisterCoreCommandsStageRegisterAppCommandsStageValidateCommandStageRunCommandStage
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 pipelineConsoleAppAdapter::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.phpsrc/App/Adapters/ConsoleAppAdapter.phpsrc/App/Traits/WebAppTrait.phpsrc/App/Traits/ConsoleAppTrait.phpsrc/Router/RouteDispatcher.phpsrc/Middleware/MiddlewareManager.phpsrc/App/BootPipeline.php
This ticket should be completed before introducing broader runtime lifecycle hooks.
- Ngôn ngữ chính
- PHP
- Star
- 36
- Fork
- 22
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của quantum-php/framework
-
routing testing
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
quantum-php/framework#547 ·
-
view
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 75/100
quantum-php/framework#542 ·
-
enhancement http
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
quantum-php/framework#565 · 1 bình luận ·
-
components view
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 42/100
quantum-php/framework#551 ·
-
Add explicit @version special route token support for API major versioning within a single module Đang mởrouting
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 45/100
quantum-php/framework#550 ·
Tất cả issue của quantum-php/framework
Issue tương tự
-
sync-en
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 85/100
-
sync-en
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 85/100
-
Перевод устарел
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 78/100
-
[6.x]: "Cannot use object of type stdClass as array" loading Users index (regression of #19182) Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100