Issues (21)

src/Notification/HasTracker.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace NotificationTracker\Notification;
4
5
use NotificationTracker\NotificationTracker;
6
7
trait HasTracker
8
{
9
    protected ?Tracker $_tracker = null;
10
11 5
    public function tracker(): Tracker
12
    {
13 5
        if ($this->_tracker) {
14 3
            return $this->_tracker;
15
        }
16
17 5
        return $this->_tracker = new Tracker($this);
0 ignored issues
show
$this of type NotificationTracker\Notification\HasTracker is incompatible with the type Illuminate\Notifications\Notification expected by parameter $notification of NotificationTracker\Noti...\Tracker::__construct(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

17
        return $this->_tracker = new Tracker(/** @scrutinizer ignore-type */ $this);
Loading history...
18
    }
19
20 5
    public function getClassAlias(): string
21
    {
22 5
        return NotificationTracker::getMapAlias(static::class);
23
    }
24
25 3
    public function trackerMeta(string|\Closure $key = null, mixed $value = null): static
26
    {
27 3
        $this->tracker()->trackerMeta($key, $value);
28
29 3
        return $this;
30
    }
31
32 3
    public function notificationMeta(string|\Closure $key = null, mixed $value = null): static
33
    {
34 3
        $this->tracker()->notificationMeta($key, $value);
35
36 3
        return $this;
37
    }
38
}
39