refactor(php): apply constructor property promotion (PHP 8.0+)#13124
refactor(php): apply constructor property promotion (PHP 8.0+)#13124ChristophWurst wants to merge 2 commits into
Conversation
28f4596 to
ac29fed
Compare
|
@coderabbitai review |
✅ Action performedReview finished.
|
Mechanically applied ClassPropertyAssignToConstructorPromotionRector across lib/ and tests/. Hand-corrected cases where Rector renamed the $userId DI parameter to match the internal property name, which would have broken Nextcloud's container injection. Assisted-by: ClaudeCode:claude-sonnet-4-6 Signed-off-by: Christoph Wurst <1374172+ChristophWurst@users.noreply.github.com>
ac29fed to
6894468
Compare
|
@coderabbitai review with care |
🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Get PR info and changed files
gh pr view 13124 --repo nextcloud/mail --json title,body,files | jq '{title, files: [.files[].path]}'Length of output: 4506 🏁 Script executed: #!/bin/bash
# Get the full diff of the PR
gh pr diff 13124 --repo nextcloud/mail 2>/dev/null | head -3000Length of output: 121386 🏁 Script executed: #!/bin/bash
# Get the full diff - second chunk
gh pr diff 13124 --repo nextcloud/mail 2>/dev/null | tail -n +3001 | head -3000Length of output: 94145 🏁 Script executed: #!/bin/bash
# Get the full diff - third chunk
gh pr diff 13124 --repo nextcloud/mail 2>/dev/null | tail -n +6001 | head -3000Length of output: 56132 🏁 Script executed: #!/bin/bash
# Get the full diff - fourth chunk
gh pr diff 13124 --repo nextcloud/mail 2>/dev/null | tail -n +9001 | head -3000Length of output: 369 🏁 Script executed: #!/bin/bash
# Get the full diff - fifth chunk
gh pr diff 13124 --repo nextcloud/mail 2>/dev/null | tail -n +12001 | head -3000Length of output: 369 🏁 Script executed: #!/bin/bash
# Check how many total lines the diff has
gh pr diff 13124 --repo nextcloud/mail 2>/dev/null | wc -lLength of output: 162
Review of
|
| Concern | Status |
|---|---|
$userId DI parameter name preserved in all controllers |
✅ |
public properties in IMAPMessage remain public after promotion |
✅ |
Untyped $userId → string $userId tightenings in DraftsController, OutboxController |
✅ safe |
$userFolder untyped → ?Folder in MessagesController |
✅ safe |
| Parent-constructor-first pattern in background jobs (mixed promotion) | ✅ intentional |
Parameter renames for class-typed DI parameters ($ci→$contactsIntegration etc.) |
✅ DI injects by type |
Minor observations (non-blocking)
- Partial promotion in
PreviewEnhancementProcessingJob,QuotaJob,SyncJob,MailboxSync,CleanupServiceetc. — some properties remain old-style while others are promoted. This is correct whereparent::__construct()must run first, but the inconsistency within a single constructor is mildly jarring. AccountsControllerstill has two non-promoted properties ($l10n,$config,$hostValidator) mixed with promoted ones. All correct, just style-inconsistent.
The only mechanical fix needed is the leftover assignment in InternalAddressController.
✅ Action performed
Review finished.
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.
- Remove redundant $this->internalAddressService assignment left in InternalAddressController after promotion - Restore $mailbox parameter name in BeforeMessageDeletedEvent to avoid breaking named-argument callers (public event API) Assisted-by: ClaudeCode:claude-sonnet-4-6 Signed-off-by: Christoph Wurst <1374172+ChristophWurst@users.noreply.github.com>
|
@coderabbitai review another time |
|
✅ Action performedReview finished.
|
Mechanically applied ClassPropertyAssignToConstructorPromotionRector across lib/ and tests/. Hand-corrected cases where Rector renamed the $userId DI parameter to match the internal property name, which would have broken Nextcloud's container injection.
Assisted-by: ClaudeCode:claude-sonnet-4-6
Ref #13077
🤖 AI (if applicable)