for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Skobkin\Bundle\PointToolsBundle\Service\Telegram;
use GuzzleHttp\Exception\ClientException;
use unreal4u\TelegramAPI\Telegram\Methods\SendMessage;
use unreal4u\TelegramAPI\TgLog;
/**
* Service which sends simple messages to Telegram users
*/
class SimpleSender
{
* @var TgLog
private $client;
* @param TgLog $client
public function __construct(TgLog $client)
$this->client = $client;
}
* Send simple message
*
* @param int $chatId
* @param string $text
* @return bool
public function sendMessage(int $chatId, string $text): bool
$sendMessage = new SendMessage();
$sendMessage->chat_id = $chatId;
$chat_id
string
$chatId
integer
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.
$answer = 42; $correct = false; $correct = (bool) $answer;
$sendMessage->text = $text;
try {
$this->client->performApiRequest($sendMessage);
return true;
} catch (ClientException $e) {
return false;
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.