Skip to content

Commit 3c51d4b

Browse files
committed
fix phpstan l8 warnings for possibly unset keys of UsesSubscriptions::$subscriptions
1 parent 857e233 commit 3c51d4b

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

phpstan.dist.neon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ includes:
33
- phpstan-baseline.neon
44

55
parameters:
6-
level: 7
6+
level: 8
77
paths:
88
- src
99
- tests

src/Auth/UsesSubscriptions.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ trait UsesSubscriptions
1414
{
1515
/**
1616
* User Subscription
17-
* @var mixed[]|null
17+
* @var array<string, mixed>|null
1818
*/
1919
protected $subscription = null;
2020

@@ -49,7 +49,7 @@ public function subscription(): ?array
4949
*/
5050
public function hasSubscription(): bool
5151
{
52-
return $this->subscription() && $this->subscription['status'] !== \Leaf\Billing\Subscription::STATUS_CANCELLED;
52+
return $this->subscription() && ($this->subscription['status'] ?? null) !== \Leaf\Billing\Subscription::STATUS_CANCELLED;
5353
}
5454

5555
/**
@@ -58,7 +58,7 @@ public function hasSubscription(): bool
5858
*/
5959
public function hasActiveSubscription(): bool
6060
{
61-
return $this->subscription() && ($this->subscription['status'] === \Leaf\Billing\Subscription::STATUS_ACTIVE || $this->subscription['status'] === \Leaf\Billing\Subscription::STATUS_TRIAL);
61+
return $this->subscription() && (($this->subscription['status'] ?? null) === \Leaf\Billing\Subscription::STATUS_ACTIVE || ($this->subscription['status'] ?? null) === \Leaf\Billing\Subscription::STATUS_TRIAL);
6262
}
6363

6464
/**

0 commit comments

Comments
 (0)