1 | <?php |
||
15 | class ConversationManager implements Manager |
||
16 | { |
||
17 | private $intents = []; |
||
18 | private $fallbackIntent; |
||
19 | |||
20 | private $application; |
||
21 | private $cache; |
||
22 | |||
23 | private $transitioned = false; |
||
24 | |||
25 | 72 | public function __construct(Application $application, Repository $cache) |
|
30 | |||
31 | /** |
||
32 | * Register intent. |
||
33 | * |
||
34 | * @param string $class |
||
35 | */ |
||
36 | public function registerIntent(string $class): void |
||
40 | |||
41 | /** |
||
42 | * Register fallback intent. |
||
43 | * |
||
44 | * @param string $class |
||
45 | */ |
||
46 | 72 | public function registerFallbackIntent(string $class): void |
|
50 | |||
51 | /** |
||
52 | * Get all registered intents. |
||
53 | * |
||
54 | * @return array |
||
55 | */ |
||
56 | public function getIntents(): array |
||
60 | |||
61 | /** |
||
62 | * Match intent by received message. |
||
63 | * |
||
64 | * @param MessageReceived $messageReceived |
||
65 | * |
||
66 | * @return Intent|null |
||
67 | */ |
||
68 | public function matchIntent(MessageReceived $messageReceived): ?Intent |
||
84 | |||
85 | /** |
||
86 | * Resolve conversation context. |
||
87 | * |
||
88 | * @param Channel $channel |
||
89 | * @param Chat $chat |
||
90 | * @param User $user |
||
91 | * |
||
92 | * @return Context|null |
||
93 | */ |
||
94 | public function resolveContext(Channel $channel, Chat $chat, User $user): Context |
||
118 | |||
119 | /** |
||
120 | * Save context. |
||
121 | * |
||
122 | * @param Context $context |
||
123 | */ |
||
124 | public function saveContext(Context $context): void |
||
131 | |||
132 | /** |
||
133 | * Flush context. |
||
134 | * |
||
135 | * @param Context $context |
||
136 | */ |
||
137 | public function flushContext(Context $context): void |
||
143 | |||
144 | /** |
||
145 | * Get current context. |
||
146 | * |
||
147 | * @return Context|null |
||
148 | */ |
||
149 | 72 | public function getContext(): ?Context |
|
157 | |||
158 | /** |
||
159 | * Mark conversation as transitioned. |
||
160 | */ |
||
161 | public function markAsTransitioned(): void |
||
165 | |||
166 | /** |
||
167 | * Determine if conversation has been transitioned. |
||
168 | * |
||
169 | * @return bool |
||
170 | */ |
||
171 | public function transitioned(): bool |
||
175 | |||
176 | 72 | public function __destruct() |
|
194 | |||
195 | private function getCacheKeyForContext(Channel $channel, Chat $chat, User $user): string |
||
199 | } |
||
200 |
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: