Issue #3586271: Clean up CCC inconsistencies and DX issues before rc1 (part 3)
Description
This MR includes the following changes, each in separate commits
- 3c -
finaladded to 9 framework-instantiated leaf classes with no extension use case. - 3f - 15 classes converted from traditional constructor + property + assignment to PHP 8.1 constructor promotion.
- 2f - Normalized camelCase local variables and method parameters to snake_case in the 6 primary-target files (
AiContextSelector,AiContextRequestFactory,AiContextScopeResolver,AiContextRequest,AiContextRequestParamsData,AiContextResult). Promoted constructor properties were left camelCase per Drupal convention. Public method parameters that are called with named arguments elsewhere in the codebase (e.g.AiContextRequestFactory::getResult(maxTokens: ...)) were also left untouched to avoid an API break. - 3d (Last 2 commits) - Added
AiContextRendererInterfaceandAiContextScopeResolverInterface, following the existingAiContextSelectorInterfacepattern (interface + alias registration inai_context.services.yml). Internal consumers updated to type-hint against the interfaces.AiContextRequestFactoryremains a candidate for a follow-up commit if reviewers want it included.
Testing instructions
Acceptance criteria
- 9 leaf classes marked
final; no extension-point classes sealed - Remaining ~15 traditional constructors converted to promotion;
parent::__construct()order preserved in forms - camelCase locals normalized in Service/Model targets (or sub-tasks filed if split)
- At least one new service interface added following
AiContextSelectorInterfacepattern (or sub-tasks filed for remaining) -
phpcs --standard=Drupal,DrupalPractice src/ tests/clean -
phpstan analyzeclean on touched files - Existing test suite passes (Unit, Kernel, Functional)
AI Compliance
Note
Check the one that best describes your usage, or leave all unchecked if AI was not significantly used.
- AI Assisted Code
Mainly written by a human; AI used for autocomplete or partial generation under full human supervision. - AI Generated Code
Mainly generated by AI, reviewed and approved by a human before this MR was created. - Vibe Coded
Generated by AI and only functionally reviewed before this MR was created.
Closes #3586271
Edited by Juan Correa