This repository was archived by the owner on Aug 23, 2026. It is now read-only.
Repository navigation
refactor(quality): Rector wave 5 — model scopes public to protected (AID-540) - #192
Merged
Merged
Conversation
…AID-540)
Enable MakeModelAttributesAndScopesProtectedRector and apply it with
cleared cache: 27 scopes across 6 models (PatternDetection,
UserHostingPermission, AbuseIncident, Account, BfmWhitelistEntry,
Domain) flip public->protected. The Attributes half of the rule found
nothing — the diff is scopes only.
This was split from AID-531 as a public-surface change and reviewed as
such rather than trusted to a green suite:
- zero direct ->scopeX()/::scopeX() calls repo-wide (app, tests, routes,
config, database), definitions excluded
- zero dynamic string references to scope method names
- the Eloquent proxy is proven safe by vendor reading, not assumption:
Model::callNamedScope() invokes $this->{'scope'.ucfirst($scope)}(...)
from the base class of the hierarchy, so protected visibility never
blocks it — Filament included, since it consumes scopes through the
builder proxy. The suite then confirmed it empirically (scopes are
exercised via proxy throughout).
- this app is final, not a library: no external consumers can exist
Wave checklist:
- resized with --clear-cache; correct FQCN is
RectorLaravel\Rector\ClassMethod\... (Class_ does not exist and fails
with "Expected an existing class name")
- diff shape-verified pure: 54 changed lines = 27 -public + 27
+protected, zero others
- rule bites, attributably: a new model with a public scope -> exit 2
naming app/ProbeScopeModel.php
- idempotence: second pass is a byte-level no-op
- gates: check-full green, 1442 passed / 16 skipped, coverage 89.8%,
refactor:dry (cleared cache) exit 0
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Split from AID-531 as a public-surface change and reviewed as such — not trusted to a green suite.
27 scopes across 6 models flip
public→protected(PatternDetection, UserHostingPermission, AbuseIncident, Account, BfmWhitelistEntry, Domain). The "Attributes" half of the rule found nothing; the diff is scopes only.Why protected is safe here — three verified axes
->scopeX(/::scopeX(grep across app/, tests/, routes/, config/, database/ (definitions excluded): 0 hits.'scopeActive'-style strings anywhere.Model::callNamedScope()invokes$this->{'scope'.ucfirst($scope)}(...)from the base class of the hierarchy, soprotectednever blocks it. Filament consumes scopes through the builder proxy, which goes through this path. The suite (1442 tests, scopes exercised via proxy throughout) then confirmed it empirically.This app is final, not a library — no external consumers can exist.
Shape-verified pure
Gates
rc=2namingapp/ProbeScopeModel.php✓composer check-full→ exit 0, 1442 passed / 16 skipped, coverage 89.8% ✓Note for future waves: the rule's FQCN is
RectorLaravel\Rector\ClassMethod\...— theClass_namespace guessed first does not exist and Rector fails with "Expected an existing class name".