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

fix phpstan errors (seems like it started ignoring @property annotations on interfaces and abstract classes)

This commit is contained in:
Samuel Štancl 2023-01-04 02:23:48 +01:00
parent 0f892f1585
commit 03ac1ef127
3 changed files with 9 additions and 3 deletions

View file

@ -28,7 +28,7 @@ parameters:
paths:
- src/Features/TelescopeTags.php
-
message: '#Parameter \#1 \$key of method Illuminate\\Contracts\\Cache\\Repository::put\(\) expects string#'
message: '#Parameter \#1 \$key of method Illuminate\\Cache\\Repository::put\(\) expects#'
paths:
- src/helpers.php
-
@ -48,6 +48,8 @@ parameters:
paths:
- src/Database/DatabaseConfig.php
- '#Method Stancl\\Tenancy\\Tenancy::cachedResolvers\(\) should return array#'
- '#Access to an undefined property Stancl\\Tenancy\\Middleware\\IdentificationMiddleware\:\:\$tenancy#'
- '#Access to an undefined property Stancl\\Tenancy\\Middleware\\IdentificationMiddleware\:\:\$resolver#'
checkMissingIterableValueType: false
treatPhpDocTypesAsCertain: false

View file

@ -11,7 +11,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
*
* @see \Stancl\Tenancy\Database\Models\Domain
*
* @method __call(string $method, array $parameters) IDE support. This will be a model.
* @method __call(string $method, array $parameters) IDE support. This will be a model. // todo check if we can remove these now
* @method static __callStatic(string $method, array $parameters) IDE support. This will be a model.
* @mixin \Illuminate\Database\Eloquent\Model
*/

View file

@ -5,6 +5,7 @@ declare(strict_types=1);
namespace Stancl\Tenancy\Resolvers;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Stancl\Tenancy\Contracts\Domain;
use Stancl\Tenancy\Contracts\Tenant;
use Stancl\Tenancy\Exceptions\TenantCouldNotBeIdentifiedOnDomainException;
@ -39,14 +40,17 @@ class DomainTenantResolver extends Contracts\CachedTenantResolver
protected function setCurrentDomain(Tenant $tenant, string $domain): void
{
/** @var Tenant&Model $tenant */
static::$currentDomain = $tenant->domains->where('domain', $domain)->first();
}
public function getArgsForTenant(Tenant $tenant): array
{
/** @var Tenant&Model $tenant */
$tenant->unsetRelation('domains');
return $tenant->domains->map(function (Domain $domain) {
return $tenant->domains->map(function (Domain&Model $domain) {
return [$domain->domain];
})->toArray();
}