refactor(types): tighten $REQUEST_JSON + ApiResponse return shapes (#405)#413
Merged
Conversation
…405) 評価レポート (#401 § 2 Code Quality) 指摘の 2 件: 1. \$REQUEST_JSON が non-parameterized array → array<string,mixed> 2. ApiResponse::success() と failure() の戻り型が PHPDoc 上は 両方 array<string,*> で statically 区別不能 ### Changes #### class/xion/ControllerBase.php - protected \$REQUEST_JSON の PHPDoc を array<string,mixed> に parameterize (native type は array のまま、JsonResponder::inputJsonToArray の戻り PHPDoc と整合) - 説明コメントも追加 (REST 状態変化 method のみ populate される旨) #### class/xion/ApiResponse.php - success() の PHPDoc に array_merge 振る舞いと "caller keys win" の 説明を追記。@return は array<string,mixed> 維持 (caller-merged keys の存在で正確な shape は表現不能)。 - failure() の @return を array-shape 形式に変更: array{status: 'failure', errorCode: string, errorMessage: string} → 静的解析が failure 戻り値を success と shape で区別可能に。 ### Verification - composer test 99/99 - composer test:http 24/24 (1 expected skip) - composer analyze (Phan) exit 0 (baseline 不変) - composer format:check exit 0 Closes #405. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
評価レポート #401 § 2 Code Quality の 2 件を解消。
$REQUEST_JSON
`ControllerBase::$REQUEST_JSON` の PHPDoc を `array<string,mixed>` に parameterize (native type は `array` のまま)。`JsonResponder::inputJsonToArray` の戻り PHPDoc と整合。
ApiResponse return shape
Test plan
Closes #405.