Lint
This commit is contained in:
parent
a434388bcb
commit
d38989f302
|
@ -13,13 +13,16 @@ class ResyncAction
|
||||||
{
|
{
|
||||||
use AsAction;
|
use AsAction;
|
||||||
|
|
||||||
public function handle()
|
public function handle(): void
|
||||||
{
|
{
|
||||||
foreach (Maildispatcher::get() as $dispatcher) {
|
foreach (Maildispatcher::get() as $dispatcher) {
|
||||||
$dispatcher->gateway->type->sync($dispatcher->name, $dispatcher->gateway->domain, $this->getResults($dispatcher));
|
$dispatcher->gateway->type->sync($dispatcher->name, $dispatcher->gateway->domain, $this->getResults($dispatcher));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection<int, MailEntry>
|
||||||
|
*/
|
||||||
public function getResults(Maildispatcher $dispatcher): Collection
|
public function getResults(Maildispatcher $dispatcher): Collection
|
||||||
{
|
{
|
||||||
return Member::search(data_get($dispatcher->filter, 'search', ''))->query(
|
return Member::search(data_get($dispatcher->filter, 'search', ''))->query(
|
||||||
|
|
|
@ -33,6 +33,9 @@ class StoreAction
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<string, string>
|
||||||
|
*/
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
|
|
@ -33,6 +33,9 @@ class UpdateAction
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<string, string>
|
||||||
|
*/
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
|
|
@ -5,7 +5,6 @@ namespace App\Maildispatcher\Models;
|
||||||
use Illuminate\Database\Eloquent\Concerns\HasUuids;
|
use Illuminate\Database\Eloquent\Concerns\HasUuids;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
||||||
|
|
||||||
class Localmaildispatcher extends Model
|
class Localmaildispatcher extends Model
|
||||||
{
|
{
|
||||||
|
@ -15,9 +14,4 @@ class Localmaildispatcher extends Model
|
||||||
public $guarded = [];
|
public $guarded = [];
|
||||||
|
|
||||||
public $timestamps = false;
|
public $timestamps = false;
|
||||||
|
|
||||||
public function dispatcher(): BelongsTo
|
|
||||||
{
|
|
||||||
return $this->belongsTo(Maildispatcher::class);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,9 @@ class Maildispatcher extends Model
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return BelongsTo<Mailgateway, self>
|
||||||
|
*/
|
||||||
public function gateway(): BelongsTo
|
public function gateway(): BelongsTo
|
||||||
{
|
{
|
||||||
return $this->belongsTo(Mailgateway::class);
|
return $this->belongsTo(Mailgateway::class);
|
||||||
|
|
|
@ -3,12 +3,16 @@
|
||||||
namespace App\Maildispatcher\Resources;
|
namespace App\Maildispatcher\Resources;
|
||||||
|
|
||||||
use App\Lib\HasMeta;
|
use App\Lib\HasMeta;
|
||||||
|
use App\Maildispatcher\Models\Maildispatcher;
|
||||||
use App\Mailgateway\Models\Mailgateway;
|
use App\Mailgateway\Models\Mailgateway;
|
||||||
use App\Mailgateway\Resources\MailgatewayResource;
|
use App\Mailgateway\Resources\MailgatewayResource;
|
||||||
use App\Member\FilterScope;
|
use App\Member\FilterScope;
|
||||||
use App\Member\Member;
|
use App\Member\Member;
|
||||||
use Illuminate\Http\Resources\Json\JsonResource;
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @mixin Maildispatcher
|
||||||
|
*/
|
||||||
class MaildispatcherResource extends JsonResource
|
class MaildispatcherResource extends JsonResource
|
||||||
{
|
{
|
||||||
use HasMeta;
|
use HasMeta;
|
||||||
|
@ -18,7 +22,7 @@ class MaildispatcherResource extends JsonResource
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Http\Request $request
|
* @param \Illuminate\Http\Request $request
|
||||||
*
|
*
|
||||||
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
|
* @return array<string, mixed>
|
||||||
*/
|
*/
|
||||||
public function toArray($request)
|
public function toArray($request)
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,6 +9,9 @@ use Lorisleiva\Actions\ActionRequest;
|
||||||
|
|
||||||
trait ValidatesRequests
|
trait ValidatesRequests
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @param array<string, mixed> $input
|
||||||
|
*/
|
||||||
public function checkIfWorks(array $input): void
|
public function checkIfWorks(array $input): void
|
||||||
{
|
{
|
||||||
if (!app(data_get($input, 'type.cls'))->setParams($input['type']['params'])->works()) {
|
if (!app(data_get($input, 'type.cls'))->setParams($input['type']['params'])->works()) {
|
||||||
|
|
|
@ -2,8 +2,12 @@
|
||||||
|
|
||||||
namespace App\Mailgateway\Casts;
|
namespace App\Mailgateway\Casts;
|
||||||
|
|
||||||
|
use App\Mailgateway\Types\Type;
|
||||||
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
|
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @implements CastsAttributes<Type, Type>
|
||||||
|
*/
|
||||||
class TypeCast implements CastsAttributes
|
class TypeCast implements CastsAttributes
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -11,6 +15,7 @@ class TypeCast implements CastsAttributes
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Database\Eloquent\Model $model
|
* @param \Illuminate\Database\Eloquent\Model $model
|
||||||
* @param mixed $value
|
* @param mixed $value
|
||||||
|
* @param array<string, mixed> $attributes
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
|
@ -26,6 +31,7 @@ class TypeCast implements CastsAttributes
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Database\Eloquent\Model $model
|
* @param \Illuminate\Database\Eloquent\Model $model
|
||||||
* @param mixed $value
|
* @param mixed $value
|
||||||
|
* @param array<string, mixed> $attributes
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -18,7 +18,7 @@ class MailgatewayResource extends JsonResource
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Http\Request $request
|
* @param \Illuminate\Http\Request $request
|
||||||
*
|
*
|
||||||
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
|
* @return array<string, mixed>
|
||||||
*/
|
*/
|
||||||
public function toArray($request)
|
public function toArray($request)
|
||||||
{
|
{
|
||||||
|
@ -35,6 +35,9 @@ class MailgatewayResource extends JsonResource
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
public static function meta(): array
|
public static function meta(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
|
|
@ -32,6 +32,9 @@ abstract class Type
|
||||||
*/
|
*/
|
||||||
abstract public function setParams(array $params): static;
|
abstract public function setParams(array $params): static;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<string, string>
|
||||||
|
*/
|
||||||
public static function defaults(): array
|
public static function defaults(): array
|
||||||
{
|
{
|
||||||
return collect(static::fields())->mapWithKeys(fn ($field) => [
|
return collect(static::fields())->mapWithKeys(fn ($field) => [
|
||||||
|
@ -39,6 +42,9 @@ abstract class Type
|
||||||
])->toArray();
|
])->toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<int, MailgatewayParsedCustomField>
|
||||||
|
*/
|
||||||
public static function presentFields(string $validator): array
|
public static function presentFields(string $validator): array
|
||||||
{
|
{
|
||||||
return array_map(fn ($field) => [
|
return array_map(fn ($field) => [
|
||||||
|
@ -47,6 +53,9 @@ abstract class Type
|
||||||
], static::fields());
|
], static::fields());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<string, mixed>
|
||||||
|
*/
|
||||||
public static function rules(string $validator): array
|
public static function rules(string $validator): array
|
||||||
{
|
{
|
||||||
return collect(static::fields())->mapWithKeys(fn ($field) => [
|
return collect(static::fields())->mapWithKeys(fn ($field) => [
|
||||||
|
@ -54,6 +63,9 @@ abstract class Type
|
||||||
])->toArray();
|
])->toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<string, array<string, mixed>>
|
||||||
|
*/
|
||||||
public function toResource(): array
|
public function toResource(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
|
|
@ -85,7 +85,7 @@ class MailmanService
|
||||||
{
|
{
|
||||||
$response = $this->http()->delete("members/{$member->memberId}");
|
$response = $this->http()->delete("members/{$member->memberId}");
|
||||||
|
|
||||||
throw_unless($response->status(204), MailmanServiceException::class, 'Removing member failed');
|
throw_unless(204 === $response->status(), MailmanServiceException::class, 'Removing member failed');
|
||||||
}
|
}
|
||||||
|
|
||||||
private function http(): PendingRequest
|
private function http(): PendingRequest
|
||||||
|
|
41
phpstan.neon
41
phpstan.neon
|
@ -19,6 +19,7 @@ parameters:
|
||||||
ContributionRequestArray: 'array{dateFrom: string, dateUntil: string, zipLocation: string, country: int, eventName: string, members: array<int, int>}'
|
ContributionRequestArray: 'array{dateFrom: string, dateUntil: string, zipLocation: string, country: int, eventName: string, members: array<int, int>}'
|
||||||
ContributionApiRequestArray: 'array{dateFrom: string, dateUntil: string, zipLocation: string, country: int, eventName: string, member_data: array<int, ContributionMemberData>}'
|
ContributionApiRequestArray: 'array{dateFrom: string, dateUntil: string, zipLocation: string, country: int, eventName: string, member_data: array<int, ContributionMemberData>}'
|
||||||
MailgatewayCustomField: 'array{name: string, label: string, type: string, storeValidator: string, updateValidator: string, default: string}'
|
MailgatewayCustomField: 'array{name: string, label: string, type: string, storeValidator: string, updateValidator: string, default: string}'
|
||||||
|
MailgatewayParsedCustomField: 'array{name: string, label: string, type: string, storeValidator: string, updateValidator: string, default: string, is_required: bool}'
|
||||||
|
|
||||||
ignoreErrors:
|
ignoreErrors:
|
||||||
-
|
-
|
||||||
|
@ -634,3 +635,43 @@ parameters:
|
||||||
message: "#^Return type of call to method Illuminate\\\\Support\\\\Collection\\<int,class\\-string\\<App\\\\Setting\\\\LocalSettings\\>\\>\\:\\:map\\(\\) contains unresolvable type\\.$#"
|
message: "#^Return type of call to method Illuminate\\\\Support\\\\Collection\\<int,class\\-string\\<App\\\\Setting\\\\LocalSettings\\>\\>\\:\\:map\\(\\) contains unresolvable type\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
path: app/Setting/SettingFactory.php
|
path: app/Setting/SettingFactory.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: "#^Access to an undefined property Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:\\$email\\.$#"
|
||||||
|
count: 2
|
||||||
|
path: app/Maildispatcher/Actions/ResyncAction.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: "#^Access to an undefined property Illuminate\\\\Database\\\\Eloquent\\\\Model\\:\\:\\$email_parents\\.$#"
|
||||||
|
count: 2
|
||||||
|
path: app/Maildispatcher/Actions/ResyncAction.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: "#^Unable to resolve the template type TKey in call to function collect$#"
|
||||||
|
count: 2
|
||||||
|
path: app/Mailgateway/Actions/StoreAction.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: "#^Unable to resolve the template type TValue in call to function collect$#"
|
||||||
|
count: 2
|
||||||
|
path: app/Mailgateway/Actions/StoreAction.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: "#^Unable to resolve the template type TKey in call to function collect$#"
|
||||||
|
count: 2
|
||||||
|
path: app/Mailgateway/Actions/UpdateAction.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: "#^Unable to resolve the template type TValue in call to function collect$#"
|
||||||
|
count: 2
|
||||||
|
path: app/Mailgateway/Actions/UpdateAction.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: "#^Return type of call to method Illuminate\\\\Support\\\\Collection\\<\\(int\\|string\\),mixed\\>\\:\\:map\\(\\) contains unresolvable type\\.$#"
|
||||||
|
count: 1
|
||||||
|
path: app/Mailgateway/Resources/MailgatewayResource.php
|
||||||
|
|
||||||
|
-
|
||||||
|
message: "#^Generic type Illuminate\\\\Pagination\\\\LengthAwarePaginator\\<int, App\\\\Member\\\\Member\\> in PHPDoc tag @return specifies 2 template types, but class Illuminate\\\\Pagination\\\\LengthAwarePaginator supports only 1\\: TValue$#"
|
||||||
|
count: 1
|
||||||
|
path: app/Member/Actions/SearchAction.php
|
||||||
|
|
Loading…
Reference in New Issue