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

@ -10,15 +10,17 @@
/**
* @property int $id
* @property string provider
* @property array data
* @property string label
* @property bool connected
* @property string $provider
* @property array<string, mixed> $data
* @property string $label
* @property bool $connected
* @property int $project_id
*/
class NotificationChannel extends AbstractModel
{
/** @use HasFactory<\Database\Factories\NotificationChannelFactory> */
use HasFactory;
use Notifiable;
protected $fillable = [
@ -41,7 +43,10 @@ public function provider(): \App\NotificationChannels\NotificationChannel
{
$class = config('core.notification_channels_providers_class')[$this->provider];
return new $class($this);
/** @var \App\NotificationChannels\NotificationChannel $provider */
$provider = new $class($this);
return $provider;
}
public static function notifyAll(NotificationInterface $notification): void
@ -52,16 +57,24 @@ public static function notifyAll(NotificationInterface $notification): void
}
}
/**
* @return BelongsTo<Project, covariant $this>
*/
public function project(): BelongsTo
{
return $this->belongsTo(Project::class);
}
/**
* @return Builder<NotificationChannel>
*/
public static function getByProjectId(int $projectId): Builder
{
return self::query()
->where(function (Builder $query) use ($projectId) {
$query->where('project_id', $projectId)->orWhereNull('project_id');
});
/** @var Builder<NotificationChannel> $query */
$query = NotificationChannel::query();
return $query->where(function (Builder $query) use ($projectId): void {
$query->where('project_id', $projectId)->orWhereNull('project_id');
});
}
}