1 | <?php |
||
19 | abstract class SubscribableObject extends ApiObject |
||
20 | { |
||
21 | /** |
||
22 | * @var PulseUser[] |
||
23 | */ |
||
24 | protected $subscribers; |
||
25 | |||
26 | /** |
||
27 | * The objects's unique identifier. |
||
28 | * |
||
29 | * @return int |
||
30 | */ |
||
31 | 52 | public function getId () |
|
35 | |||
36 | /** |
||
37 | * Get the users who are subscribed to this object |
||
38 | * |
||
39 | * ``` |
||
40 | * array['page'] int - Page offset to fetch |
||
41 | * ['per_page'] int - Number of results to return per page |
||
42 | * ['offset'] int - Pad a number of results |
||
43 | * ``` |
||
44 | * |
||
45 | * @api |
||
46 | * |
||
47 | * @param array $params GET parameters passed to the URL (see above) |
||
48 | * @param bool $forceFetch When set to true, this will force an API call to retrieve the subscribers. Otherwise, |
||
49 | * this'll return the cached subscribers. |
||
50 | * |
||
51 | * @since 0.1.0 |
||
52 | * |
||
53 | * @return PulseUser[] |
||
54 | */ |
||
55 | 5 | public function getSubscribers ($params = [], $forceFetch = false) |
|
67 | |||
68 | /** |
||
69 | * Subscriber a user to a object |
||
70 | * |
||
71 | * @api |
||
72 | * |
||
73 | * @param int|PulseUser $userId The user that will be subscribed to the board |
||
74 | * @param bool|null $asAdmin Set to true if the user will be an admin of the board |
||
75 | * |
||
76 | * @since 0.3.0 A PulseUser object of the newly added subscriber is returned |
||
77 | * @since 0.1.0 |
||
78 | * |
||
79 | * @return PulseUser |
||
80 | */ |
||
81 | 1 | public function addSubscriber ($userId, $asAdmin = null) |
|
103 | |||
104 | /** |
||
105 | * Unsubscribe a user from this object |
||
106 | * |
||
107 | * @api |
||
108 | * |
||
109 | * @param int|PulseUser $userId The user that will be unsubscribed from the board |
||
110 | * |
||
111 | * @since 0.3.0 A PulseUser object of the removed subscriber is returned |
||
112 | * @since 0.1.0 |
||
113 | * |
||
114 | * @return PulseUser |
||
115 | */ |
||
116 | 1 | public function removeSubscriber ($userId) |
|
138 | } |
There are different options of fixing this problem.
If you want to be on the safe side, you can add an additional type-check:
If you are sure that the expression is traversable, you might want to add a doc comment cast to improve IDE auto-completion and static analysis:
Mark the issue as a false-positive: Just hover the remove button, in the top-right corner of this issue for more options.