1 | <?php |
||
13 | trait HasSubscriptions |
||
14 | { |
||
15 | /** |
||
16 | * Define a polymorphic one-to-many relationship. |
||
17 | * |
||
18 | * @param string $related |
||
19 | * @param string $name |
||
20 | * @param string $type |
||
|
|||
21 | * @param string $id |
||
22 | * @param string $localKey |
||
23 | * |
||
24 | * @return \Illuminate\Database\Eloquent\Relations\MorphMany |
||
25 | */ |
||
26 | abstract public function morphMany($related, $name, $type = null, $id = null, $localKey = null); |
||
27 | |||
28 | /** |
||
29 | * The user may have many subscriptions. |
||
30 | * |
||
31 | * @return \Illuminate\Database\Eloquent\Relations\MorphMany |
||
32 | */ |
||
33 | public function subscriptions(): MorphMany |
||
37 | |||
38 | /** |
||
39 | * The user may have many subscriptions. |
||
40 | * |
||
41 | * @return \Illuminate\Database\Eloquent\Relations\MorphMany |
||
42 | */ |
||
43 | public function rinvex_subscriptions(): MorphMany |
||
47 | |||
48 | /** |
||
49 | * A model may have many active subscriptions. |
||
50 | * |
||
51 | * @return \Illuminate\Database\Eloquent\Collection |
||
52 | */ |
||
53 | public function activeSubscriptions(): Collection |
||
57 | |||
58 | /** |
||
59 | * Get a subscription by slug. |
||
60 | * |
||
61 | * @param string $subscriptionSlug |
||
62 | * |
||
63 | * @return \Rinvex\Subscriptions\Models\PlanSubscription|null |
||
64 | */ |
||
65 | public function subscription(string $subscriptionSlug): ?PlanSubscription |
||
69 | |||
70 | /** |
||
71 | * Get a subscription by slug. |
||
72 | * |
||
73 | * @param string $subscriptionSlug |
||
74 | * |
||
75 | * @return \Rinvex\Subscriptions\Models\PlanSubscription|null |
||
76 | */ |
||
77 | public function rinvex_subscription(string $subscriptionSlug): ?PlanSubscription |
||
81 | |||
82 | /** |
||
83 | * Get subscribed plans. |
||
84 | * |
||
85 | * @return \Rinvex\Subscriptions\Models\PlanSubscription|null |
||
86 | */ |
||
87 | public function subscribedPlans(): ?PlanSubscription |
||
93 | |||
94 | /** |
||
95 | * Check if the user subscribed to the given plan. |
||
96 | * |
||
97 | * @param int $planId |
||
98 | * |
||
99 | * @return bool |
||
100 | */ |
||
101 | public function subscribedTo($planId): bool |
||
107 | |||
108 | /** |
||
109 | * Subscribe user to a new plan. |
||
110 | * |
||
111 | * @param string $subscription |
||
112 | * @param \Rinvex\Subscriptions\Models\Plan $plan |
||
113 | * |
||
114 | * @return \Rinvex\Subscriptions\Models\PlanSubscription |
||
115 | */ |
||
116 | public function newSubscription($subscription, Plan $plan): PlanSubscription |
||
120 | |||
121 | /** |
||
122 | * Subscribe user to a new plan. |
||
123 | * |
||
124 | * @param string $subscription |
||
125 | * @param \Rinvex\Subscriptions\Models\Plan $plan |
||
126 | * |
||
127 | * @return \Rinvex\Subscriptions\Models\PlanSubscription |
||
128 | */ |
||
129 | public function rinvex_newSubscription($subscription, Plan $plan): PlanSubscription |
||
142 | } |
||
143 |
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.