1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-05 07:54:03 +00:00

fix 1267: early return in runForMultiple if an empty array is passed

This commit is contained in:
Samuel Štancl 2025-01-08 10:11:04 +01:00
parent f955b38e2b
commit c30fb5d092

View file

@ -204,8 +204,10 @@ class Tenancy
// Wrap string in array // Wrap string in array
$tenants = is_string($tenants) ? [$tenants] : $tenants; $tenants = is_string($tenants) ? [$tenants] : $tenants;
// Use all tenants if $tenants is falsy // If $tenants is falsy by this point (e.g. an empty array) there's no work to be done
$tenants = $tenants ?: $this->model()->cursor(); // todo@phpstan phpstan thinks this isn't needed, but tests fail without it if (! $tenants) {
return;
}
$originalTenant = $this->tenant; $originalTenant = $this->tenant;