1 | <?php |
||
20 | class Bot |
||
21 | { |
||
22 | /** @var Bot */ |
||
23 | protected static $instance; |
||
24 | |||
25 | private $container; |
||
26 | private $channel; |
||
27 | private $driver; |
||
28 | |||
29 | /** @var Context|null */ |
||
30 | private $context; |
||
31 | |||
32 | 8 | protected function __construct( |
|
41 | |||
42 | /** |
||
43 | * Create new bot instance. |
||
44 | * |
||
45 | * @param Container $container |
||
46 | * @param Channel $channel |
||
47 | * @param Driver $driver |
||
48 | * @param array $request |
||
49 | * @param array $headers |
||
50 | */ |
||
51 | 8 | public static function createInstance( |
|
62 | |||
63 | /** |
||
64 | * Get current instance. |
||
65 | * |
||
66 | * @return Bot |
||
67 | */ |
||
68 | 8 | public static function getInstance(): Bot |
|
72 | |||
73 | /** |
||
74 | * Set instance of the bot. |
||
75 | * |
||
76 | * @param Bot $instance |
||
77 | */ |
||
78 | 56 | public static function setInstance(Bot $instance): void |
|
82 | |||
83 | /** |
||
84 | * Get context instance. |
||
85 | * |
||
86 | * @return Context|null |
||
87 | */ |
||
88 | 2 | public function getContext(): ?Context |
|
92 | |||
93 | /** |
||
94 | * Set context instance. |
||
95 | * |
||
96 | * @param Context $context |
||
97 | */ |
||
98 | 2 | public function setContext(Context $context): void |
|
102 | |||
103 | /** |
||
104 | * Clear context. |
||
105 | */ |
||
106 | 1 | public function clearContext(): void |
|
113 | |||
114 | /** |
||
115 | * Resolve from container. |
||
116 | * |
||
117 | * @param string $class |
||
118 | * |
||
119 | * @return mixed |
||
120 | */ |
||
121 | 3 | public function get(string $class) |
|
125 | |||
126 | /** |
||
127 | * Process webhook request. |
||
128 | * |
||
129 | * @return mixed |
||
130 | */ |
||
131 | 4 | public function process() |
|
164 | |||
165 | /** |
||
166 | * Start conversation. |
||
167 | * |
||
168 | * @param Conversable $conversable |
||
169 | */ |
||
170 | 2 | public function converse(Conversable $conversable): void |
|
182 | |||
183 | /** |
||
184 | * Send message. |
||
185 | * |
||
186 | * @param OutgoingMessage $message |
||
187 | */ |
||
188 | 1 | public function sendMessage(OutgoingMessage $message): void |
|
192 | |||
193 | /** |
||
194 | * Get context manager. |
||
195 | * |
||
196 | * @return ContextManager |
||
197 | */ |
||
198 | 3 | private function contextManager(): ContextManager |
|
202 | |||
203 | /** |
||
204 | * Get intent manager. |
||
205 | * |
||
206 | * @return IntentManager |
||
207 | */ |
||
208 | 1 | private function intentManager(): IntentManager |
|
212 | } |
||
213 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.
In this case you can add the
@ignore
PhpDoc annotation to the duplicate definition and it will be ignored.