1 | <?php |
||
22 | abstract class AbstractMethod { |
||
23 | |||
24 | use Property; |
||
25 | |||
26 | const NAME = null; |
||
27 | |||
28 | const RETURN_ENTITY = null; |
||
29 | |||
30 | protected $parent = null; |
||
31 | |||
32 | protected $hasAttachedData = false; |
||
33 | |||
34 | protected $reply_markup; |
||
35 | |||
36 | /** |
||
37 | * List of properties supported by method in format: property name => required or not |
||
38 | * |
||
39 | * @var array |
||
40 | */ |
||
41 | protected $supportedProperties = []; |
||
42 | |||
43 | protected $supportedMarkups = [ |
||
44 | ReplyKeyboardMarkup::class, |
||
45 | ReplyKeyboardHide::class, |
||
46 | ForceReply::class |
||
47 | ]; |
||
48 | |||
49 | /** |
||
50 | * Constructs extended method's class and sets properties from array if passed. |
||
51 | * |
||
52 | * @param array $args |
||
53 | */ |
||
54 | public function __construct($args = []) |
||
62 | |||
63 | /** |
||
64 | * Returns method's name. |
||
65 | * |
||
66 | * @return string |
||
67 | */ |
||
68 | public function getName() |
||
72 | |||
73 | /** |
||
74 | * Returns entity's name that should be return in method execution result. |
||
75 | * |
||
76 | * @return string |
||
77 | */ |
||
78 | public function getReturnEntity() |
||
82 | |||
83 | /** |
||
84 | * Triggers execution of the method |
||
85 | * |
||
86 | * @param bool $silentMode Execute method silently without processing the result |
||
87 | * |
||
88 | * @return \Teebot\Response |
||
89 | */ |
||
90 | public function trigger($silentMode = true) |
||
96 | |||
97 | /** |
||
98 | * Returns flag which idicates that method has attached data (audio, voice, video, photo etc.) |
||
99 | * |
||
100 | * @return bool |
||
101 | */ |
||
102 | public function hasAttachedData() |
||
106 | |||
107 | /** |
||
108 | * Checks that passed markup is currently supported |
||
109 | * |
||
110 | * @param AbstractEntity $markup Markup class instance |
||
111 | * |
||
112 | * @return bool |
||
113 | */ |
||
114 | protected function isValidMarkup(AbstractEntity $markup) |
||
124 | |||
125 | /** |
||
126 | * Sets reply markup class |
||
127 | * |
||
128 | * @param AbstractEntity $markup Markup class instance |
||
129 | * |
||
130 | * @return $this |
||
131 | */ |
||
132 | public function setReplyMarkup(AbstractEntity $markup) |
||
150 | |||
151 | /** |
||
152 | * Returns parent entity which triggered method's execution. |
||
153 | * |
||
154 | * @return AbstractEntity |
||
155 | */ |
||
156 | public function getParent() |
||
160 | |||
161 | /** |
||
162 | * Sets parent entity which triggered method's execution. |
||
163 | * |
||
164 | * @param AbstractEntity $parent |
||
165 | * |
||
166 | * @return $this |
||
167 | */ |
||
168 | public function setParent(AbstractEntity $parent) |
||
174 | } |
||
175 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: