Skip to content

Commit 038d421

Browse files
authored
Merge pull request #17 from coderflexx/phpstan
Larastan Fix Errors
2 parents 3f1ab55 + fabb1e3 commit 038d421

File tree

5 files changed

+14
-6
lines changed

5 files changed

+14
-6
lines changed

phpstan.neon.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ parameters:
1111
checkOctaneCompatibility: true
1212
checkModelProperties: true
1313
checkMissingIterableValueType: false
14-
14+

src/Concerns/CanVisit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ interface CanVisit
77
/**
88
* keep track of your pages
99
*
10-
* @return PendingVisit
10+
* @return \Coderflex\Laravisit\PendingVisit
1111
*/
1212
public function visit();
1313

src/Models/Visit.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@
77
use Coderflex\Laravisit\Presenters\VisitPresenter;
88
use Illuminate\Database\Eloquent\Model;
99

10+
/**
11+
* Coderflex\Laravisit\Models\Visit
12+
* @property int $id
13+
* @property array $data
14+
* @property \Illuminate\Support\Carbon|null $created_at
15+
* @property \Illuminate\Support\Carbon|null $updated_at
16+
*/
1017
class Visit extends Model implements CanPresent
1118
{
1219
use UsesPresenters;

src/PendingVisit.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function __construct(protected Model $model)
3131
$this->isCrawler = $crawlerDetect->isCrawler();
3232

3333
// set daily intervals by default
34-
$this->dailyIntervals();
34+
$this->dailyIntervals(); // @phpstan-ignore-line
3535
}
3636

3737
/**
@@ -127,9 +127,10 @@ public function __destruct()
127127
// we don't need to log the visit
128128
// because it's not a real visitor
129129
if ($this->isCrawler) {
130-
return null;
130+
return;
131131
}
132132

133+
// @phpstan-ignore-next-line
133134
$visit = $this->model
134135
->visits()
135136
->latest()

src/Presenters/VisitPresenter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class VisitPresenter extends Presenter
1414
*/
1515
public function ip(): string
1616
{
17-
return $this->model->data['ip'];
17+
return $this->model->data['ip']; // @phpstan-ignore-line
1818
}
1919

2020
/**
@@ -24,7 +24,7 @@ public function ip(): string
2424
*/
2525
public function user(): Model
2626
{
27-
$userId = $this->model->data['user_id'];
27+
$userId = $this->model->data['user_id']; // @phpstan-ignore-line
2828
$userNamespace = config('laravisit.user_namespace');
2929

3030
$user = is_null($userNamespace) || empty($userNamespace)

0 commit comments

Comments
 (0)