Introduce WebFormModule and keep AuraInputModule as alias#29
Conversation
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.
|
@coderabbitai review |
📝 WalkthroughWalkthroughIntroduce 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. ChangesModule refactoring and API modernization
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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 |
✅ Actions performedReview triggered.
|
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.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
psalm.xml (1)
36-45: ⚡ Quick winNarrow 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.
Summary
Add
Ray\WebFormModule\WebFormModulewhose 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\AuraInputModuleis preserved as a thin subclass ofWebFormModule, so existing applications that installnew AuraInputModule()continue to work unchanged.Changes
src/WebFormModule.php(real module class)src/AuraInputModule.phptoclass AuraInputModule extends WebFormModule {}with a deprecation notetests/WebFormModuleTest.phpto cover the new class and confirmAuraInputModuleis a subclass ofWebFormModuletests/AuraInputInterceptorTest.phpusingnew AuraInputModule()to lock in BCREADME.md,README.JA.md, the CSRF demo and the fake test module to installWebFormModule1.0.1entry toCHANGELOG.mdWhy now
The 1.0.0 release just went out and the historical rename to
AuraInputModule(commit85ba5a7, 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 greencomposer cs/composer cs-fix— cleancomposer phpstan— no errorsSummary by CodeRabbit
New Features
Deprecation
Documentation
Tests