API Migration Details
這裡放已經深入調查過的 API 規則。若只是盤點某個 endpoint 是否存在,放在上一層 module index;只有確認過 legacy code、新實作、DB side effect、測試或流量時,才放在這裡。
入口
| 模組 | 文件 |
|---|---|
quote_bids | quote_bids/README.md |
quote_categories | quote_categories/README.md |
quote_feedback_comments | quote_feedback_comments/README.md |
quote_feedback_tags | quote_feedback_tags/README.md |
quote_feedbacks | quote_feedbacks/README.md |
quote_requests | quote_requests/README.md |
quote_service_categories | quote_service_categories/README.md |
quote_services | quote_services/README.md |
users | users/README.md |
寫法規則
- 每支 API 一份文件;大型 umbrella API 再拆子資料夾。
- 文件開頭先放「快速結論」,讓讀者 30 秒內知道狀態。
- 每支已深入調查或已搬移的 API 都要有「新舊程式對照」與「逐段對照」。
- review 程式與文件時,同步使用上一層 migration_review_checklist.md。
- 「新舊程式對照」要列出 legacy PHP 5.6 與 new PHP 8.2 的 controller / endpoint / model / util / helper / test 檔案與行號範圍。
- 「逐段對照」要照 legacy 執行順序對到 new code,至少覆蓋 guard、input mapping、DB write、payment、queue、activity、notification、response mapping;沒有的項目寫
不適用或待確認。 - 詳細 legacy 流程、DB table、queue/log、測試資料放後面。
- 正式機流量結果只寫結果與查詢範圍,不混入業務規則。
PHP 版本差異檢查
每次搬移 legacy PHP 5.6 API 到 new PHP 8.2 時,detail doc 必須明確檢查 runtime 差異,不可只做行號對照。
必查項目:
isset($data['key'])與array_key_exists('key', $data)不等價;legacyisset會把null視為沒帶參數。empty()、!$value、字串'0'、數字0、空字串與null的分支要照 legacy 實際語意測。- legacy 讀不存在的 array key、缺關聯 row 或缺 contain 資料,在 PHP 5.6 常只是 notice / warning;new PHP 8.2 不能讓這類資料缺口變成 999、TypeError 或 warning-driven failure。若 legacy 會繼續走,new 要用 nullable fallback 或明確 guard 對齊。
- legacy model / controller 若依賴 CakePHP request data、contain、save / query 的寬鬆行為,new 要確認 DataObject / DB helper 對空字串、
NULL、false modified flag 的寫入是否相同。 - response mapping 要分清楚 action 自己回的 response 與 router / framework fallback response;不要把 new framework fallback 誤判成 legacy parity。
detail doc 的「新舊程式對照」或「搬移注意」至少要寫出上述檢查結果;若不適用,標 不適用。測試需覆蓋最容易因版本差異改變結果的 case,例如 missing key、null、空字串、缺關聯 row。