Fix deprecated property writes with symfony/http-foundation 8.1#417
Conversation
symfony/http-foundation 8.1 turned the Request/Response bag properties into hooked properties whose setters trigger deprecation warnings. Request::createFromBase() now fills the existing request bag via replace() and points the JSON cache at the same bag, preserving the aliasing behavior of the previous direct assignment. Http\Response passes the headers through the parent constructor, which accepts them since 8.1.
|
Warning Review limit reached
Next review available in: 26 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (30)
📝 WalkthroughWalkthroughThis PR changes ChangesHTTP Request/Response construction fixes
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryThis PR fixes deprecation warnings introduced by symfony/http-foundation 8.1's hooked-property mechanism, which turns direct writes to
Confidence Score: 5/5The two core changes are narrow, well-understood, and covered by new tests — safe to merge. Both the Request and Response fixes are straightforward adaptations to Symfony 8.1's hooked-property contract. The replace()+setJson() aliasing in createFromBase() faithfully reproduces the old direct-assignment behavior, and the parent-constructor delegation in Response preserves protocol version, status, and header initialization as confirmed by the regression tests. No files require special attention. Important Files Changed
Reviews (3): Last reviewed commit: "Raise Symfony component floor to 8.1" | Re-trigger Greptile |
…ation-81-deprecations
Passing null invoked the overridden setContent() with an intermediate null before the real content is set; the empty string matches the constructor defaults.
…ttp-foundation-81-deprecations
Replace the bespoke JSON createFromBase regression test from the PR with the relevant Laravel request tests in Laravel order. These tests cover filling the request input bag from JSON content, preserving the InputBag payload type exposed by Symfony, avoiding the Symfony 8.1 request-property deprecation path, and allowing JSON requests to merge derived data back into the request payload.
Add response constructor coverage for the Symfony 8.1-compatible initialization path. The test locks in the public response contract while the constructor delegates header, status, and protocol initialization to Symfony: headers are retained, the status code remains correct, the default protocol version is preserved, JSONable content is encoded, and the original content remains the user-provided value rather than the constructor placeholder.
Update root and package composer manifests so Symfony component dependencies consistently require the 8.1 line. The HTTP fixes in this PR rely on Symfony 8.1 behavior around hooked Request and Response bag properties. Since Hypervel 0.4 has not been released yet, align the component packages, dogfood package, and archived package manifests on a Symfony 8.1 minimum instead of carrying compatibility assumptions for 8.0.
|
@anabeto93 Thanks! |
With symfony/http-foundation 8.1 installed, every JSON request and every response construction triggers a deprecation:
8.1 turned the bag properties into hooked properties, so the direct writes in
Request::createFromBase()andHttp\Response::__construct()now warn on every call.createFromBase()fills the existing request bag viareplace()and points the JSON cache at the same bag, preserving the aliasing behavior of the previous direct assignment (covered by a new test)Responsepasses the headers through the parent constructor, which accepts them since 8.1Test run:
Summary by CodeRabbit