for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace ParityBit\DeploymentNotifier\Clients;
use Curl\Curl;
class SlackClient
{
protected $curl;
protected $webhookUrl;
protected $channels = [];
protected $iconUrl = null;
protected $username = null;
public function __construct(Curl $curl, $webhookUrl, $channels = [], $username = 'Deployment Notifier', $iconUrl = null)
$this->curl = $curl;
$this->webhookUrl = $webhookUrl;
$this->channels = $channels;
$this->username = $username;
$this->iconUrl = $iconUrl;
}
public function sendMessage($message)
foreach ($this->channels as $channel) {
$payload = $this->getPayload($message, $channel);
$this->curl->post(
$this->webhookUrl,
'payload=' . json_encode($payload)
string
array
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);
);
public function getPayload($message, $channel)
$payload = [];
if (!is_null($this->iconUrl)) {
$payload['icon_url'] = $this->iconUrl;
$payload['text'] = $message;
$payload['channel'] = $channel;
$payload['username'] = $this->username;
return $payload;
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: