Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/ActionSender.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public function sendText($channel, $message)
*/
public function hangup($channel, $cause)
{
return $this->request('Hangup', array('Channel' => $channel, 'Cause' => $cause));
return $this->request('Hangup', array('Channel' => $channel, 'Cause' => (string) $cause));
}

/**
Expand Down Expand Up @@ -201,7 +201,7 @@ private function boolParam($value)

/**
* @param string $name
* @param array $args
* @param array<string,string|string[]|null> $args
* @return \React\Promise\PromiseInterface<Response,\Exception>
*/
private function request($name, array $args = array())
Expand Down
5 changes: 4 additions & 1 deletion src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Clue\React\Ami\Protocol\Event;
use Clue\React\Ami\Protocol\Message;
use Clue\React\Ami\Protocol\Parser;
use Clue\React\Ami\Protocol\Response;
use Clue\React\Ami\Protocol\UnexpectedMessageException;
use Evenement\EventEmitter;
use React\Promise\Deferred;
Expand Down Expand Up @@ -102,6 +103,8 @@ public function handleMessage(Message $message)
$this->emit('event', array($message));
return;
}

assert($message instanceof Response);
$id = $message->getActionId();
if (!isset($this->pending[$id])) {
$this->emit('error', array(new UnexpectedMessageException($message), $this));
Expand Down Expand Up @@ -187,7 +190,7 @@ public function isBusy()
* ```
*
* @param string $name
* @param array $args
* @param array<string,string|string[]|null> $args
* @return Action
*/
public function createAction($name, array $args = array())
Expand Down
4 changes: 4 additions & 0 deletions src/Protocol/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ class Parser
private $buffer = '';
private $gotInitial = false;

/**
* @param string $chunk
* @return array<Event|Response>
*/
public function push($chunk)
{
$this->buffer .= $chunk;
Expand Down