Skip to content

Commit

Permalink
Merge pull request #17 from coderflexx/phpstan
Browse files Browse the repository at this point in the history
Larastan Fix Errors
  • Loading branch information
ousid authored Aug 22, 2022
2 parents 3f1ab55 + fabb1e3 commit 038d421
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ parameters:
checkOctaneCompatibility: true
checkModelProperties: true
checkMissingIterableValueType: false

2 changes: 1 addition & 1 deletion src/Concerns/CanVisit.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ interface CanVisit
/**
* keep track of your pages
*
* @return PendingVisit
* @return \Coderflex\Laravisit\PendingVisit
*/
public function visit();

Expand Down
7 changes: 7 additions & 0 deletions src/Models/Visit.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 3 additions & 2 deletions src/PendingVisit.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

/**
Expand Down Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions src/Presenters/VisitPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

/**
Expand All @@ -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)
Expand Down

0 comments on commit 038d421

Please sign in to comment.