Summary
Remove stop() from normal web response flow and make WebAppAdapter fully return-driven.
Goals
WebAppAdapter::start(): ?int remains unchanged
WebAppAdapter::start() always returns 0
- normal web flow sends a returned
Response
- web helper paths stop relying on
StopExecutionException
In scope
src/App/Adapters/WebAppAdapter.php
src/App/Traits/WebAppTrait.php
src/Http/Helpers/http.php
src/ResourceCache/ViewCache.php
- web-specific short-circuit helpers such as 404 / redirect flow
Target start() shape
public function start(): ?int
{
if (request()->isMethod('OPTIONS')) {
$response = response()->setStatusCode(StatusCode::NO_CONTENT);
} else {
$this->loadModules();
$matchedRoute = $this->resolveRoute();
$this->loadLanguage();
$this->logDebugInfo();
$response = $this->setupViewCache()
->getCachedResponse(request()->getUri() ?? '');
if ($response === null) {
$response = (new MiddlewareManager($matchedRoute))
->applyMiddlewares(request(), response());
$response = (new RouteDispatcher())
->dispatch($matchedRoute, request(), $response);
}
}
$this->sendResponse($response);
return 0;
}
Required helper shape
private function sendResponse(Response $response): void
{
$this->handleCors($response);
$response->send();
}
Cached view contract
Current style is mutation plus boolean:
public function serveCachedView(string $uri, Response $response): bool
Target style should be:
public function getCachedResponse(string $uri): ?Response
Short-circuit paths to replace
OPTIONS
page_not_found()
- redirect helper flow
- cache-hit flow
Acceptance criteria
- normal web flow has no
try/catch StopExecutionException
WebAppAdapter::start() returns 0
- normal web paths do not rely on
stop()
- cached-view lookup returns
?Response directly
Validation
WebAppAdapter tests
- web helper tests
- full web path regression checks
Summary
Remove
stop()from normal web response flow and makeWebAppAdapterfully return-driven.Goals
WebAppAdapter::start(): ?intremains unchangedWebAppAdapter::start()always returns0ResponseStopExecutionExceptionIn scope
src/App/Adapters/WebAppAdapter.phpsrc/App/Traits/WebAppTrait.phpsrc/Http/Helpers/http.phpsrc/ResourceCache/ViewCache.phpTarget
start()shapeRequired helper shape
Cached view contract
Current style is mutation plus boolean:
Target style should be:
Short-circuit paths to replace
OPTIONSpage_not_found()Acceptance criteria
try/catch StopExecutionExceptionWebAppAdapter::start()returns0stop()?ResponsedirectlyValidation
WebAppAdaptertests