Add phpstan level 7(#544)

This commit is contained in:
Saeed Vaziry
2025-03-12 13:31:10 +01:00
committed by GitHub
parent c22bb1fa80
commit 493cbb0849
437 changed files with 4505 additions and 2193 deletions

View File

@ -11,8 +11,9 @@
class AddChannel
{
/**
* @param array<string, mixed> $input
*
* @throws ValidationException
* @throws Exception
*/
public function add(User $user, array $input): void
{
@ -42,13 +43,19 @@ public function add(User $user, array $input): void
} catch (Exception $e) {
$channel->delete();
throw $e;
throw ValidationException::withMessages([
'provider' => $e->getMessage(),
]);
}
$channel->connected = true;
$channel->save();
}
/**
* @param array<string, mixed> $input
* @return array<string, mixed>
*/
public static function rules(array $input): array
{
$rules = [
@ -59,9 +66,13 @@ public static function rules(array $input): array
'label' => 'required',
];
return array_merge($rules, static::providerRules($input));
return array_merge($rules, self::providerRules($input));
}
/**
* @param array<string, mixed> $input
* @return array<string, array<string>>
*/
private static function providerRules(array $input): array
{
if (! isset($input['provider'])) {

View File

@ -7,6 +7,9 @@
class EditChannel
{
/**
* @param array<string, mixed> $input
*/
public function edit(NotificationChannel $notificationChannel, User $user, array $input): void
{
$notificationChannel->fill([
@ -16,6 +19,10 @@ public function edit(NotificationChannel $notificationChannel, User $user, array
$notificationChannel->save();
}
/**
* @param array<string, mixed> $input
* @return array<string, string>
*/
public static function rules(array $input): array
{
return [