refactor(support): complete toIntIds() rollout in tenant-area code
Final pass over tenant repositories and TenantScopeService, collapsing the remaining two-line intval+filter and one-line intval+unique patterns onto the shared `toIntIds()` helper. The inline pattern is now gone from the codebase. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -90,7 +90,7 @@ class TenantScopeService
|
||||
|
||||
public function filterTenantIdsForUser(array $tenantIds, int $userId): array
|
||||
{
|
||||
$tenantIds = array_values(array_unique(array_map('intval', $tenantIds)));
|
||||
$tenantIds = toIntIds($tenantIds);
|
||||
$userTenantIds = $this->getUserTenantIds($userId);
|
||||
if (!$userTenantIds) {
|
||||
return [];
|
||||
@@ -104,9 +104,9 @@ class TenantScopeService
|
||||
array $existingTenantIds,
|
||||
array $allowedTenantIds
|
||||
): array {
|
||||
$requestedTenantIds = array_values(array_unique(array_map('intval', $requestedTenantIds)));
|
||||
$existingTenantIds = array_values(array_unique(array_map('intval', $existingTenantIds)));
|
||||
$allowedTenantIds = array_values(array_unique(array_map('intval', $allowedTenantIds)));
|
||||
$requestedTenantIds = toIntIds($requestedTenantIds);
|
||||
$existingTenantIds = toIntIds($existingTenantIds);
|
||||
$allowedTenantIds = toIntIds($allowedTenantIds);
|
||||
|
||||
if (!$allowedTenantIds) {
|
||||
return $existingTenantIds;
|
||||
@@ -165,7 +165,7 @@ class TenantScopeService
|
||||
|
||||
private function filterActiveTenantIds(array $tenantIds): array
|
||||
{
|
||||
$tenantIds = array_values(array_unique(array_map('intval', $tenantIds)));
|
||||
$tenantIds = toIntIds($tenantIds);
|
||||
if (!$tenantIds) {
|
||||
return [];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user