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

get phpstan errors down from 252 to 189

This commit is contained in:
Samuel Štancl 2022-08-30 05:44:23 +02:00
parent fb8b9c1614
commit 8af354c20e
40 changed files with 119 additions and 115 deletions

View file

@ -19,8 +19,7 @@ class TenantConfig implements Feature
/** @var Repository */
protected $config;
/** @var array */
public $originalConfig = [];
public array $originalConfig = [];
public static $storageToConfigMap = [
// 'paypal_api_key' => 'services.paypal.api_key',
@ -51,14 +50,14 @@ class TenantConfig implements Feature
if (! is_null($override)) {
if (is_array($configKey)) {
foreach ($configKey as $key) {
$this->originalConfig[$key] = $this->originalConfig[$key] ?? $this->config[$key];
$this->originalConfig[$key] = $this->originalConfig[$key] ?? $this->config->get($key);
$this->config[$key] = $override;
$this->config->set($key, $override);
}
} else {
$this->originalConfig[$configKey] = $this->originalConfig[$configKey] ?? $this->config[$configKey];
$this->originalConfig[$configKey] = $this->originalConfig[$configKey] ?? $this->config->get($configKey);
$this->config[$configKey] = $override;
$this->config->set($configKey, $override);
}
}
}
@ -67,7 +66,7 @@ class TenantConfig implements Feature
public function unsetTenantConfig(): void
{
foreach ($this->originalConfig as $key => $value) {
$this->config[$key] = $value;
$this->config->set($key, $value);
}
}
}

View file

@ -31,6 +31,7 @@ class UserImpersonation implements Feature
/** Impersonate a user and get an HTTP redirect response. */
public static function makeResponse(string|ImpersonationToken $token, int $ttl = null): RedirectResponse
{
/** @var ImpersonationToken $token */
$token = $token instanceof ImpersonationToken ? $token : ImpersonationToken::findOrFail($token);
$ttl ??= static::$ttl;