Conditions | 5 |
Paths | 4 |
Total Lines | 16 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 30 |
Changes | 0 |
1 | <?php |
||
52 | public function matchIntent(MessageReceived $messageReceived): ?Intent |
||
53 | { |
||
54 | foreach ($this->intents as $intent) { |
||
55 | /** @var Intent $intent */ |
||
56 | $intent = resolve($intent); |
||
|
|||
57 | |||
58 | foreach ($intent->activators() as $activator) { |
||
59 | if ($activator->matches($messageReceived) && $intent->passesAuthorization($messageReceived)) { |
||
60 | return $intent; |
||
61 | } |
||
62 | } |
||
63 | } |
||
64 | |||
65 | // Otherwise, return fallback intent |
||
66 | return resolve($this->fallbackIntent); |
||
67 | } |
||
68 | } |
||
69 |
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: