for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace FondBot\Conversation;
use FondBot\Events\MessageReceived;
class IntentManager
{
/** @var Intent[] */
private $intents = [];
/** @var Intent */
private $fallbackIntent;
/**
* Register intents.
*
* @param array $intents
* @param string $fallbackIntent
*/
public function register(array $intents, string $fallbackIntent): void
$this->intents = $intents;
$this->fallbackIntent = $fallbackIntent;
$fallbackIntent
string
object<FondBot\Conversation\Intent>
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..
}
* Find intent.
* @param MessageReceived $message
* @return Intent|null
public function find(MessageReceived $message): ?Intent
foreach ($this->intents as $intent) {
foreach ($intent->activators() as $activator) {
if ($activator->matches($message) && $intent->passesAuthorization($message)) {
return resolve($intent);
$intent
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:
function acceptsInteger($int) { } $x = '123'; // string "123" // Instead of acceptsInteger($x); // we recommend to use acceptsInteger((integer) $x);
// Otherwise, return fallback intent
return resolve($this->fallbackIntent);
$this->fallbackIntent
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..