Skip to content

Commit 8eef801

Browse files
authored
Merge pull request #59 from clue-labs/phpstan
Minor code style adjustments to make phpstan happy
2 parents 71dc8b3 + 099856d commit 8eef801

3 files changed

Lines changed: 10 additions & 3 deletions

File tree

src/ActionSender.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public function sendText($channel, $message)
133133
*/
134134
public function hangup($channel, $cause)
135135
{
136-
return $this->request('Hangup', array('Channel' => $channel, 'Cause' => $cause));
136+
return $this->request('Hangup', array('Channel' => $channel, 'Cause' => (string) $cause));
137137
}
138138

139139
/**
@@ -201,7 +201,7 @@ private function boolParam($value)
201201

202202
/**
203203
* @param string $name
204-
* @param array $args
204+
* @param array<string,string|string[]|null> $args
205205
* @return \React\Promise\PromiseInterface<Response,\Exception>
206206
*/
207207
private function request($name, array $args = array())

src/Client.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Clue\React\Ami\Protocol\Event;
88
use Clue\React\Ami\Protocol\Message;
99
use Clue\React\Ami\Protocol\Parser;
10+
use Clue\React\Ami\Protocol\Response;
1011
use Clue\React\Ami\Protocol\UnexpectedMessageException;
1112
use Evenement\EventEmitter;
1213
use React\Promise\Deferred;
@@ -102,6 +103,8 @@ public function handleMessage(Message $message)
102103
$this->emit('event', array($message));
103104
return;
104105
}
106+
107+
assert($message instanceof Response);
105108
$id = $message->getActionId();
106109
if (!isset($this->pending[$id])) {
107110
$this->emit('error', array(new UnexpectedMessageException($message), $this));
@@ -187,7 +190,7 @@ public function isBusy()
187190
* ```
188191
*
189192
* @param string $name
190-
* @param array $args
193+
* @param array<string,string|string[]|null> $args
191194
* @return Action
192195
*/
193196
public function createAction($name, array $args = array())

src/Protocol/Parser.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ class Parser
1616
private $buffer = '';
1717
private $gotInitial = false;
1818

19+
/**
20+
* @param string $chunk
21+
* @return array<Event|Response>
22+
*/
1923
public function push($chunk)
2024
{
2125
$this->buffer .= $chunk;

0 commit comments

Comments
 (0)