mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-02 22:46:16 +00:00
Add phpstan level 7(#544)
This commit is contained in:
@ -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');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user