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 | * A model may have many active subscriptions. |
||
40 | * |
||
41 | * @return \Illuminate\Database\Eloquent\Collection |
||
42 | */ |
||
43 | public function activeSubscriptions(): Collection |
||
47 | |||
48 | /** |
||
49 | * Get a subscription by slug. |
||
50 | * |
||
51 | * @param string $subscriptionSlug |
||
52 | * |
||
53 | * @return \Rinvex\Subscriptions\Models\PlanSubscription|null |
||
54 | */ |
||
55 | public function subscription(string $subscriptionSlug): ?PlanSubscription |
||
59 | |||
60 | /** |
||
61 | * Get subscribed plans. |
||
62 | * |
||
63 | * @return \Rinvex\Subscriptions\Models\PlanSubscription|null |
||
64 | */ |
||
65 | public function subscribedPlans(): ?PlanSubscription |
||
71 | |||
72 | /** |
||
73 | * Check if the user subscribed to the given plan. |
||
74 | * |
||
75 | * @param int $planId |
||
76 | * |
||
77 | * @return bool |
||
78 | */ |
||
79 | public function subscribedTo($planId): bool |
||
85 | |||
86 | /** |
||
87 | * Subscribe user to a new plan. |
||
88 | * |
||
89 | * @param string $subscription |
||
90 | * @param \Rinvex\Subscriptions\Models\Plan $plan |
||
91 | * |
||
92 | * @return \Rinvex\Subscriptions\Models\PlanSubscription |
||
93 | */ |
||
94 | public function newSubscription($subscription, Plan $plan): PlanSubscription |
||
107 | } |
||
108 |
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.