diff --git a/phpstan.neon.dist b/phpstan.neon.dist index a91953b..7947424 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -11,4 +11,4 @@ parameters: checkOctaneCompatibility: true checkModelProperties: true checkMissingIterableValueType: false - + \ No newline at end of file diff --git a/src/Concerns/CanVisit.php b/src/Concerns/CanVisit.php index 36215d1..e0486e5 100644 --- a/src/Concerns/CanVisit.php +++ b/src/Concerns/CanVisit.php @@ -7,7 +7,7 @@ interface CanVisit /** * keep track of your pages * - * @return PendingVisit + * @return \Coderflex\Laravisit\PendingVisit */ public function visit(); diff --git a/src/Models/Visit.php b/src/Models/Visit.php index 547a739..1a7bc44 100644 --- a/src/Models/Visit.php +++ b/src/Models/Visit.php @@ -7,6 +7,13 @@ use Coderflex\Laravisit\Presenters\VisitPresenter; use Illuminate\Database\Eloquent\Model; +/** + * Coderflex\Laravisit\Models\Visit + * @property int $id + * @property array $data + * @property \Illuminate\Support\Carbon|null $created_at + * @property \Illuminate\Support\Carbon|null $updated_at + */ class Visit extends Model implements CanPresent { use UsesPresenters; diff --git a/src/PendingVisit.php b/src/PendingVisit.php index b248a34..af3c2f0 100644 --- a/src/PendingVisit.php +++ b/src/PendingVisit.php @@ -31,7 +31,7 @@ public function __construct(protected Model $model) $this->isCrawler = $crawlerDetect->isCrawler(); // set daily intervals by default - $this->dailyIntervals(); + $this->dailyIntervals(); // @phpstan-ignore-line } /** @@ -127,9 +127,10 @@ public function __destruct() // we don't need to log the visit // because it's not a real visitor if ($this->isCrawler) { - return null; + return; } + // @phpstan-ignore-next-line $visit = $this->model ->visits() ->latest() diff --git a/src/Presenters/VisitPresenter.php b/src/Presenters/VisitPresenter.php index 05cf8ec..d4b30f2 100644 --- a/src/Presenters/VisitPresenter.php +++ b/src/Presenters/VisitPresenter.php @@ -14,7 +14,7 @@ class VisitPresenter extends Presenter */ public function ip(): string { - return $this->model->data['ip']; + return $this->model->data['ip']; // @phpstan-ignore-line } /** @@ -24,7 +24,7 @@ public function ip(): string */ public function user(): Model { - $userId = $this->model->data['user_id']; + $userId = $this->model->data['user_id']; // @phpstan-ignore-line $userNamespace = config('laravisit.user_namespace'); $user = is_null($userNamespace) || empty($userNamespace)