Skip to content

Introduce WebFormModule and keep AuraInputModule as alias#29

Merged
koriym merged 2 commits into
1.xfrom
rename-to-webform-module
May 18, 2026
Merged

Introduce WebFormModule and keep AuraInputModule as alias#29
koriym merged 2 commits into
1.xfrom
rename-to-webform-module

Conversation

@koriym
Copy link
Copy Markdown
Member

@koriym koriym commented May 18, 2026

Summary

Add Ray\WebFormModule\WebFormModule whose name lines up with the package (ray/web-form-module) and namespace (Ray\WebFormModule), so the public module class no longer leaks the underlying Aura.Input implementation detail.

Ray\WebFormModule\AuraInputModule is preserved as a thin subclass of WebFormModule, so existing applications that install new AuraInputModule() continue to work unchanged.

Changes

  • Add src/WebFormModule.php (real module class)
  • Reduce src/AuraInputModule.php to class AuraInputModule extends WebFormModule {} with a deprecation note
  • Add tests/WebFormModuleTest.php to cover the new class and confirm AuraInputModule is a subclass of WebFormModule
  • Keep tests/AuraInputInterceptorTest.php using new AuraInputModule() to lock in BC
  • Update README.md, README.JA.md, the CSRF demo and the fake test module to install WebFormModule
  • Add 1.0.1 entry to CHANGELOG.md

Why now

The 1.0.0 release just went out and the historical rename to AuraInputModule (commit 85ba5a7, 2015) left the public class name out of sync with the package and namespace. Doing the rename as 1.0.1 keeps the 1.0.0 tag immutable while shipping the cleanup with full backwards compatibility.

Test plan

  • composer test — 32 tests, 36 assertions, all green
  • composer cs / composer cs-fix — clean
  • composer phpstan — no errors

Summary by CodeRabbit

  • New Features

    • Introduced WebFormModule as the primary module for form handling.
  • Deprecation

    • AuraInputModule marked deprecated and retained as a backwards-compatible alias.
  • Documentation

    • Updated changelog, README (en/ja) and demo examples to show installing and extending the new module.
  • Tests

    • Added tests covering the new module, the legacy alias, and validation failure behavior.

Review Change Stack

Add Ray\WebFormModule\WebFormModule whose name lines up with the
package (ray/web-form-module) and namespace (Ray\WebFormModule), so
the public module class no longer leaks the underlying Aura.Input
implementation detail.

Ray\WebFormModule\AuraInputModule is preserved as a thin subclass of
WebFormModule so existing applications that install
'new AuraInputModule()' continue to work unchanged. The interceptor
test keeps using AuraInputModule to lock in that compatibility.

Update README, README.JA, the CSRF demo, and the fake module used in
tests to install the new WebFormModule. Add CHANGELOG entry for 1.0.1.
@koriym
Copy link
Copy Markdown
Member Author

koriym commented May 18, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 18, 2026

📝 Walkthrough

Walkthrough

Introduce WebFormModule as the primary DI module; make AuraInputModule a thin, backwards-compatible subclass. Add DI wiring in WebFormModule, new tests, update examples and READMEs to use WebFormModule, add a 1.0.1 changelog entry, and update Psalm config.

Changes

Module refactoring and API modernization

Layer / File(s) Summary
Core module implementation and backwards-compatible alias
src/WebFormModule.php, src/AuraInputModule.php
WebFormModule added with DI configure() wiring (session install, input/filter/anti-CSRF bindings with AntiCsrfInterface singleton, failure handlers, helper/filter factories, annotation interceptors for InputValidation and FormValidation). AuraInputModule now extends WebFormModule as a thin backwards-compatible alias.
Test coverage for module structure and backwards compatibility
tests/WebFormModuleTest.php, tests/Fake/FakeModule.php
New PHPUnit tests validate DI wiring, assert AuraInputModule is an instance/subclass of WebFormModule, and confirm validation failures throw ValidationException. Test fixture updated to install WebFormModule.
Code example and demo updates
docs/demo/1.csrf/MyModule.php
Demo module updated to install WebFormModule instead of AuraInputModule.
Documentation and changelog
README.md, README.JA.md, CHANGELOG.md
English and Japanese READMEs updated to instruct using WebFormModule and note that AuraInputModule remains as a deprecated compatibility subclass. CHANGELOG adds 1.0.1 entry and compare link.
Static analysis config
psalm.xml
Add Psalm suppressions and comment for false-positives involving Ray\Aop\Pointcut::__construct and Ray\Di\Bind::__construct.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 From old AuraInput springs a gentler rule,
WebFormModule leads while aliases keep cool.
Docs, tests, and demos softly realign,
Backwards paths intact, new wiring by design.
A hop ahead—compat and progress twine.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely summarizes the main objectives of the pull request: introducing a new WebFormModule class while maintaining AuraInputModule as a backwards-compatible alias.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch rename-to-webform-module

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 18, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

When AuraInputModule extends WebFormModule extends AbstractModule,
Psalm fails to resolve Ray\Di\Bind and Ray\Aop\Pointcut signatures
inside the inherited bindInterceptor() body. The vendor code itself is
correct and tests pass; this only affects static analysis of the
two-level inheritance chain introduced for backwards compatibility.
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
psalm.xml (1)

36-45: ⚡ Quick win

Narrow suppression scope to affected file(s) only.

On Line 36 and Line 41, these suppressions are global for those constructors and can mask real regressions later. Scope them to the specific file(s) that trigger the false positive.

Suggested config tightening
         <InvalidArgument>
             <errorLevel type="suppress">
                 <referencedFunction name="Ray\Aop\Pointcut::__construct" />
+                <file name="src/WebFormModule.php" />
             </errorLevel>
         </InvalidArgument>
         <TooManyArguments>
             <errorLevel type="suppress">
                 <referencedFunction name="Ray\Di\Bind::__construct" />
+                <file name="src/WebFormModule.php" />
             </errorLevel>
         </TooManyArguments>
🤖 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 `@psalm.xml` around lines 36 - 45, The current suppressions target the
constructors Ray\Aop\Pointcut::__construct and Ray\Di\Bind::__construct
globally; narrow them to only the file(s) that produce the false positives by
moving each suppression under a file-specific scope (e.g., add a <file
name="..."> element or wrap the <errorLevel> under the offending source file
entry) so the referencedFunction suppressions apply only to those specific
source files rather than globally.
🤖 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 `@psalm.xml`:
- Around line 36-45: The current suppressions target the constructors
Ray\Aop\Pointcut::__construct and Ray\Di\Bind::__construct globally; narrow them
to only the file(s) that produce the false positives by moving each suppression
under a file-specific scope (e.g., add a <file name="..."> element or wrap the
<errorLevel> under the offending source file entry) so the referencedFunction
suppressions apply only to those specific source files rather than globally.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d9195f87-1071-4215-8801-084bd836c74a

📥 Commits

Reviewing files that changed from the base of the PR and between 3c2446e and c813d8d.

📒 Files selected for processing (1)
  • psalm.xml

@koriym koriym merged commit a1fba3d into 1.x May 18, 2026
23 checks passed
@koriym koriym deleted the rename-to-webform-module branch May 18, 2026 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant