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;
use FondBot\Contracts\Conversation\Manager;
class ConversationManager implements Manager
{
private $intents = [];
private $fallbackIntent;
/**
* Register intent.
*
* @param string $class
*/
public function registerIntent(string $class): void
$this->intents[] = $class;
}
* Register fallback intent.
public function registerFallbackIntent(string $class): void
$this->fallbackIntent = $class;
* Get all registered intents.
* @return array
public function getIntents(): array
return $this->intents;
* Match intent by received message.
* @param MessageReceived $messageReceived
* @return Intent|null
public function matchIntent(MessageReceived $messageReceived): ?Intent
foreach ($this->intents as $intent) {
/** @var Intent $intent */
$intent = resolve($intent);
$intent
object<FondBot\Conversation\Intent>
string
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);
foreach ($intent->activators() as $activator) {
if ($activator->matches($messageReceived) && $intent->passesAuthorization($messageReceived)) {
return $intent;
// Otherwise, return fallback intent
return resolve($this->fallbackIntent);
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: