1 | <?php |
||
14 | trait HasSubscriptions |
||
15 | { |
||
16 | /** |
||
17 | * Define a polymorphic one-to-many relationship. |
||
18 | * |
||
19 | * @param string $related |
||
20 | * @param string $name |
||
21 | * @param string $type |
||
|
|||
22 | * @param string $id |
||
23 | * @param string $localKey |
||
24 | * |
||
25 | * @return \Illuminate\Database\Eloquent\Relations\MorphMany |
||
26 | */ |
||
27 | abstract public function morphMany($related, $name, $type = null, $id = null, $localKey = null); |
||
28 | |||
29 | /** |
||
30 | * The subscriber may have many subscriptions. |
||
31 | * |
||
32 | * @return \Illuminate\Database\Eloquent\Relations\MorphMany |
||
33 | */ |
||
34 | public function subscriptions(): MorphMany |
||
38 | |||
39 | /** |
||
40 | * A model may have many active subscriptions. |
||
41 | * |
||
42 | * @return \Illuminate\Database\Eloquent\Collection |
||
43 | */ |
||
44 | public function activeSubscriptions(): Collection |
||
48 | |||
49 | /** |
||
50 | * Get a subscription by slug. |
||
51 | * |
||
52 | * @param string $subscriptionSlug |
||
53 | * |
||
54 | * @return \Rinvex\Subscriptions\Models\PlanSubscription|null |
||
55 | */ |
||
56 | public function subscription(string $subscriptionSlug): ?PlanSubscription |
||
60 | |||
61 | /** |
||
62 | * Get subscribed plans. |
||
63 | * |
||
64 | * @return \Rinvex\Subscriptions\Models\PlanSubscription|null |
||
65 | */ |
||
66 | public function subscribedPlans(): ?PlanSubscription |
||
72 | |||
73 | /** |
||
74 | * Check if the subscriber subscribed to the given plan. |
||
75 | * |
||
76 | * @param int $planId |
||
77 | * |
||
78 | * @return bool |
||
79 | */ |
||
80 | public function subscribedTo($planId): bool |
||
86 | |||
87 | /** |
||
88 | * Subscribe subscriber to a new plan. |
||
89 | * |
||
90 | * @param string $subscription |
||
91 | * @param \Rinvex\Subscriptions\Models\Plan $plan |
||
92 | * @param \Carbon\Carbon|null $startDate |
||
93 | * |
||
94 | * @return \Rinvex\Subscriptions\Models\PlanSubscription |
||
95 | */ |
||
96 | public function newSubscription($subscription, Plan $plan, Carbon $startDate = null): PlanSubscription |
||
109 | } |
||
110 |
This check looks for
@param
annotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.