Refine 1.0 form manual for Ray.WebFormModule 1.0.0#358
Conversation
Reflect the BC break in Ray.WebFormModule 1.0.0 where CSRF protection is now opt-in via a separate #[CsrfProtection] attribute, instead of the removed antiCsrf=true option on #[FormValidation]. Also fix the legacy AuraInputModule references in the English manual to match the current WebFormModule name.
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
Refresh both the Japanese and English form manuals to align with the 1.0.0 source of truth and README: - Revert the previous WebFormModule rename: the real class is still AuraInputModule (no rename happened in 1.0.0). - Document the actual #[FormValidation] parameters (form, onFailure) instead of the obsolete onValidationFailed name, and keep the default ValidationFailed suffix behaviour. - Use the modern method-injection style for the form (#[Inject] setForm(#[Named] FormInterface) with typed properties), matching the README and tests. - Tighten init()/onPost() signatures with explicit return types and parameter types to match PHP 8 typed APIs. - Note that the entire form can be rendered with echo when the form implements ToStringInterface. - Replace the standalone CSRF section with the opt-in #[CsrfProtection] explanation from the README. - Add a 'Migration from 0.x' table summarising the BC breaks (Doctrine annotations to attributes, antiCsrf=true to #[CsrfProtection], Reader argument removal, FormInterface signature updates) and link to the migrate-to-1.0 Claude Code skill.
|
Refined the entire form manual against the 1.0.0 source (README is the truth):
@coderabbitai review |
|
✅ Actions performedReview triggered.
|
Walkthrough英語版・日本語版のフォーム関連ドキュメントをWebFormModuleとPHP 8 Attributesベースの実装に統一し、#[FormValidation]・#[CsrfProtection]・#[InputValidation]・#[VndError]属性の使用例を追加し、CSRFがopt-in仕様であることを明示し、FormVndErrorModuleとの組み合わせ、0.x からの移行ガイドを整理しました。 ChangesForm module documentation updates
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
The detailed migration table belongs in the library's README and CHANGELOG, not in the framework manual. Replace the table with a short note that links to both, keeping the manual focused on how to use Ray.WebFormModule 1.0.0.
Self-review found that the controller examples returned ResourceObject without extending it (and without importing it), so they would not run as-is. Rewrite the controller examples as Page resources, which is the native style for a BEAR.Sunday manual: - class MyPage extends ResourceObject with the matching import - constructor promotion to inject the named form - method signatures return static and end with return $this - drop init(): void so the form class matches the parent Aura\Input\Fieldset::init() signature used in the library and tests
Ray.WebFormModule 1.0.1 ships Ray\WebFormModule\WebFormModule whose name lines up with the package and namespace. Update the form manual samples to install the new class. The legacy AuraInputModule remains as a thin subclass for backwards compatibility, so no behaviour changes for existing apps.
|
@koriym Updated to use the new Please merge this PR only after Ray.WebFormModule 1.0.1 has been released, so the |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
manuals/1.0/ja/form.md (1)
73-86: ⚡ Quick win日本語版も
#[Inject] + setForm()形式に統一してください。Line 73-86 はコンストラクタ注入のままで、PR目的の「
#[Inject] setForm(#[Named] FormInterface)へ統一」とズレています。英語版と同時に揃えると、日英で同一の移行手順として使えます。差分例
use BEAR\Resource\ResourceObject; +use Ray\Di\Di\Inject; use Ray\Di\Di\Named; use Ray\WebFormModule\Annotation\FormValidation; use Ray\WebFormModule\FormInterface; class MyPage extends ResourceObject { - public function __construct( - #[Named('contact_form')] private FormInterface $contactForm, - ) { - } + private FormInterface $contactForm; + + #[Inject] + public function setForm(#[Named('contact_form')] FormInterface $contactForm): void + { + $this->contactForm = $contactForm; + }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@manuals/1.0/ja/form.md` around lines 73 - 86, この日本語ドキュメントのサンプルをコンストラクタ注入から英語版と揃えた setter 注入へ変更してください:MyPage クラスのコンストラクタでの FormInterface $contactForm 注入を削除し、代わりに #[Inject] を付けた public または protected setForm(#[Named('contact_form')] FormInterface $form) メソッドを追加して内部プロパティを設定するようにし、FormValidation の参照(#[FormValidation(form: 'contactForm')]) が新しいフォーム識別子と一致することを確認してください(メソッド名/プロパティ名は setForm と contact_form を参照)。
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@manuals/1.0/ja/form.md`:
- Around line 73-86: この日本語ドキュメントのサンプルをコンストラクタ注入から英語版と揃えた setter
注入へ変更してください:MyPage クラスのコンストラクタでの FormInterface $contactForm 注入を削除し、代わりに
#[Inject] を付けた public または protected setForm(#[Named('contact_form')]
FormInterface $form) メソッドを追加して内部プロパティを設定するようにし、FormValidation
の参照(#[FormValidation(form: 'contactForm')])
が新しいフォーム識別子と一致することを確認してください(メソッド名/プロパティ名は setForm と contact_form を参照)。
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 0f1b3ec0-289f-4e95-9d5b-aecd5f2cfa3d
📒 Files selected for processing (2)
manuals/1.0/en/form.mdmanuals/1.0/ja/form.md
Summary
Refresh both the Japanese and English form manuals to match the Ray.WebFormModule 1.0.0 source of truth (CHANGELOG + README):
AuraInputModule(no rename happened in 1.0.0). The previous commit on this branch had renamed it to a non-existentWebFormModule.#[FormValidation]exposesformandonFailure(notonValidationFailed). Keep the defaultValidationFailed-suffix behaviour.#[Inject] setForm(#[Named] FormInterface)with typed properties (matching README and tests).ToStringInterfacenote:echo \$formrenders the whole form when the form implementsToStringInterface.#[CsrfProtection]explanation (the removedantiCsrf=trueoption is no longer available).antiCsrf=truesplit into#[CsrfProtection],Readerargument removal,FormInterfacesignature updates) and link to themigrate-to-1.0Claude Code skill in the upstream repo.Test plan
manuals/1.0/ja/form.htmlandmanuals/1.0/en/form.htmlSummary by CodeRabbit