Commit 8701b93
Simplify DI container API by removing Dependency class usage (#228)
* chore: upgrade utopia-php/servers to 0.3.* and utopia-php/di to 0.3.*
- Replace all Dependency class usage with new Container::set(string, callable) API
- Add executeHook() method to Http class to replace removed Container::inject()
- Update Route to call parent::__construct() for Hook's new constructor
- Update all test files and examples to use new DI API
- Resolves breaking changes from DI dropping Dependency/Injection classes
https://claude.ai/code/session_0196tmVsX1KjJKmuHncp7HiV
* fix: set request factory on cloned context in testCanRunRequest
The test was setting the request factory on $this->context instead of the
cloned $context, so run() never received the HEAD request. Fixed the
target container and updated the assertion to match actual HEAD behavior.
https://claude.ai/code/session_0196tmVsX1KjJKmuHncp7HiV
* refactor: rename $context to $container in Http.php for consistency
Consolidates the DI variable naming to $container throughout, avoiding
confusion with the legacy array-based context pattern.
https://claude.ai/code/session_0196tmVsX1KjJKmuHncp7HiV
* refactor: use child containers instead of clone for request scoping
Replace `clone $this->container` with `new Container($this->container)`
to use the parent-child delegation pattern introduced in utopia-php/di
0.3, consistent with how Base::prepare() already creates scoped containers.
https://claude.ai/code/session_0196tmVsX1KjJKmuHncp7HiV
* test: add container isolation tests to verify no state bleed between requests
- testContainerIsolationBetweenRequests: verifies child containers resolve
their own request/response independently and parent is not polluted
- testContainerIsolationForErrors: verifies error state from one request
does not leak into subsequent requests
https://claude.ai/code/session_0196tmVsX1KjJKmuHncp7HiV
* fix: remove unused \$name key variable in foreach loop
Drops the unused key variable from the getInjections() foreach at
Http.php:175 to silence static analysis warnings.
https://claude.ai/code/session_0196tmVsX1KjJKmuHncp7HiV
* fix: remove unreachable duplicate OPTIONS handling block
The elseif branch for REQUEST_METHOD_OPTIONS at line 661 was dead code —
OPTIONS requests are already handled and returned earlier (lines 628-657).
Removing the duplicate simplifies the control flow.
https://claude.ai/code/session_0196tmVsX1KjJKmuHncp7HiV
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent b704e80 commit 8701b93
File tree
11 files changed
+311
-379
lines changed- example/src
- src/Http
- tests
- e2e
11 files changed
+311
-379
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | 6 | | |
8 | 7 | | |
9 | 8 | | |
| |||
18 | 17 | | |
19 | 18 | | |
20 | 19 | | |
21 | | - | |
22 | | - | |
23 | | - | |
| 20 | + | |
24 | 21 | | |
25 | 22 | | |
26 | 23 | | |
| |||
0 commit comments