1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-13 19:24:03 +00:00

get down to 21 phpstan errors

This commit is contained in:
Samuel Štancl 2022-09-29 23:39:35 +02:00
parent a94227a19c
commit f98a901aeb
16 changed files with 85 additions and 26 deletions

View file

@ -18,7 +18,7 @@ class TenantConfig implements Feature
{
public array $originalConfig = [];
/** @var array<string, string> */
/** @var array<string, string|array> */
public static array $storageToConfigMap = [
// 'paypal_api_key' => 'services.paypal.api_key',
];
@ -30,7 +30,10 @@ class TenantConfig implements Feature
public function bootstrap(Tenancy $tenancy): void
{
Event::listen(TenancyBootstrapped::class, function (TenancyBootstrapped $event) {
$this->setTenantConfig($event->tenancy->tenant);
/** @var Tenant $tenant */
$tenant = $event->tenancy->tenant;
$this->setTenantConfig($tenant);
});
Event::listen(RevertedToCentralContext::class, function () {
@ -40,8 +43,8 @@ class TenantConfig implements Feature
public function setTenantConfig(Tenant $tenant): void
{
/** @var Tenant|Model $tenant */
foreach (static::$storageToConfigMap as $storageKey => $configKey) {
/** @var Tenant&Model $tenant */
$override = Arr::get($tenant, $storageKey);
if (! is_null($override)) {