Conversation
…names Use positional matching of #[RequestParam] attributes to method parameters instead of relying on PHP variable names. The Nth attribute's name is used to look up the value for the Nth method parameter. Also fix associative array serialization in handleMethodResponse() to preserve string keys by passing them as JSON objects instead of arrays. Closes #106
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #108 +/- ##
============================================
+ Coverage 92.32% 92.34% +0.01%
- Complexity 1292 1302 +10
============================================
Files 39 39
Lines 3128 3147 +19
============================================
+ Hits 2888 2906 +18
- Misses 240 241 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…esponseBody] Introduce ResponseEntity that wraps body, status code, and content type, allowing methods to return different HTTP status codes based on runtime logic. Includes static factory methods: ok(), created(), noContent(), badRequest(), unauthorized(), forbidden(), notFound(), error(). When handleMethodResponse() detects a ResponseEntity return value, it uses its status and content type instead of the annotation defaults. Closes #107
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




Summary
Fix positional matching of
#[RequestParam]attributes to method parameters and fix associative array serialization in JSON responses.Motivation
Method parameter injection fails when request parameter names are hyphenated (e.g.,
app-id) because the framework looked up values using the PHP variable name instead of the registered parameter name. Fixes #106.Changes
WebService::getMethodParameters()to use positional matching: the Nth#[RequestParam]attribute name is used to resolve the Nth method parameterhandleMethodResponse()to serialize associative arrays as JSON objects (preserving keys) usingarray_is_list()checkHyphenatedParamServicetest service andHyphenatedParamInjectionTestwith 4 test casesHow to Test / Verify
Unit tests:
phpunit --filter HyphenatedParamInjectionTest— all 4 tests pass. Full suite (435 tests) passes with no regressions.Breaking Changes and Migration Steps
None. Existing services with matching variable names continue to work via the fallback path.
Checklist
Related issues
Closes #106