Conversation
ViewFactory::newInstance() built each TemplateRegistry with two of its
three constructor arguments, dropping $namespaces entirely, and never
called setTemplateFileExtension(). Both settings were therefore
unreachable through the factory even though TemplateRegistry has
supported namespaces since 2.4.0.
The four settings that describe a registry -- map, paths, namespaces,
extension -- are grouped into a readonly ViewSpec rather than passed as
flat arguments, which interleaved the view registry's settings with the
layout registry's and would have made a nine-parameter method.
$view_factory->newInstance(
$helpers,
new ViewSpec(map: $view_map, paths: $view_paths),
new ViewSpec(map: $layout_map, paths: $layout_paths),
);
$helpers stays the first parameter, so newInstance() and
newInstance($helpers) are unaffected; only the five-argument positional
form breaks, with a TypeError naming the parameter. That keeps the
one-line Aura.Html wiring working, as documented in docs/helpers.md.
ViewSpec is readonly with no setters, so the package's rule that setters
return void stays universal. Its newRegistry() method builds the
corresponding TemplateRegistry, for assembling a View without the
factory.
|
Warning Review limit reached
Next review available in: 48 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
WalkthroughViewSpec is added as a readonly registry configuration object. ViewFactory now accepts separate view and layout specifications, including namespaces and extensions, with tests and documentation covering the new API and upgrade path. ChangesViewFactory registry configuration
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant ViewFactory
participant ViewSpec
participant TemplateRegistry
participant View
ViewFactory->>ViewSpec: create view and layout registries
ViewSpec->>TemplateRegistry: apply map, paths, namespaces, extension
TemplateRegistry-->>ViewFactory: return configured registry
ViewFactory->>View: attach registries
View-->>ViewFactory: render view and layout
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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.
Inline comments:
In `@CHANGELOG.md`:
- Around line 63-71: Qualify ViewSpec in both migration snippets so copied code
resolves the intended class: update CHANGELOG.md lines 63-71 and
docs/upgrading.md lines 70-75 to use the fully qualified Aura\View\ViewSpec
constructor, or add the corresponding import in each snippet.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: c2804e91-9e8c-4a36-9d76-4ecef58bcf4e
📒 Files selected for processing (7)
CHANGELOG.mddocs/templates.mddocs/upgrading.mdsrc/ViewFactory.phpsrc/ViewSpec.phptests/ViewFactoryTest.phptests/fixtures/bar_template.phtml
ViewFactory::newInstance() built each TemplateRegistry with two of its three constructor arguments, dropping $namespaces entirely, and never called setTemplateFileExtension(). Both settings were therefore unreachable through the factory even though TemplateRegistry has supported namespaces since 2.4.0.
The four settings that describe a registry -- map, paths, namespaces, extension -- are grouped into a readonly ViewSpec rather than passed as flat arguments, which interleaved the view registry's settings with the layout registry's and would have made a nine-parameter method.
$helpers stays the first parameter, so newInstance() and newInstance($helpers) are unaffected; only the five-argument positional form breaks, with a TypeError naming the parameter. That keeps the one-line Aura.Html wiring working, as documented in docs/helpers.md.
ViewSpec is readonly with no setters, so the package's rule that setters return void stays universal. Its newRegistry() method builds the corresponding TemplateRegistry, for assembling a View without the factory.
Summary by CodeRabbit
New Features
ViewSpecfor configuring template maps, paths, namespaces, and file extensions.Breaking Changes
Documentation