Skip to content

Commit f523b52

Browse files
authored
Add return types to documentation of all methods
1 parent 612585c commit f523b52

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ $factory = new Factory($loop, $connector);
9999

100100
#### createClient()
101101

102-
The `createClient($amiUrl)` method can be used to create a new [`Client`](#client).
102+
The `createClient(string $amiUrl): PromiseInterface<Client>` method can be used to create a new [`Client`](#client).
103103
It helps with establishing a plain TCP/IP or secure SSL/TLS connection to the AMI
104104
and issuing an initial `login` action.
105105

@@ -126,7 +126,7 @@ If you want to send outgoing actions, see below for the [`ActionSender`](#action
126126

127127
#### on()
128128

129-
The `on($eventName, $eventHandler)` method can be used to register a new event handler.
129+
The `on(string $eventName, callable $eventHandler): void` method can be used to register a new event handler.
130130
Incoming events and errors will be forwarded to registered event handler callbacks:
131131

132132
```php
@@ -143,11 +143,11 @@ $client->on('error', function (Exception $e) {
143143

144144
#### close()
145145

146-
The `close()` method can be used to force-close the AMI connection and reject all pending actions.
146+
The `close(): void` method can be used to force-close the AMI connection and reject all pending actions.
147147

148148
#### end()
149149

150-
The `end()` method can be used to soft-close the AMI connection once all pending actions are completed.
150+
The `end(): void` method can be used to soft-close the AMI connection once all pending actions are completed.
151151

152152
#### Advanced
153153

@@ -159,12 +159,12 @@ as follows. Consider filing a PR though :)
159159

160160
##### createAction()
161161

162-
The `createAction($name, $fields)` method can be used to construct a custom AMI action.
162+
The `createAction(string $name, array $fields): Action` method can be used to construct a custom AMI action.
163163
A unique value will be added to "ActionID" field automatically (needed to match incoming responses).
164164

165165
##### request()
166166

167-
The `request(Action $action)` method can be used to queue the given messages to be sent via AMI
167+
The `request(Action $action): PromiseInterface<Response>` method can be used to queue the given messages to be sent via AMI
168168
and wait for a [`Response`](#response) object that matches the value of its "ActionID" field.
169169

170170
### ActionSender
@@ -231,21 +231,21 @@ Field names are matched case-insensitive. The interpretation of values is applic
231231

232232
#### getFieldValue()
233233

234-
The `getFieldValue($key)` method can be used to get the first value for the given field key.
234+
The `getFieldValue(string $key): ?string` method can be used to get the first value for the given field key.
235235
If no value was found, `null` is returned.
236236

237237
#### getFieldValues()
238238

239-
The `getFieldValues($key)` method can be used to get a list of all values for the given field key.
239+
The `getFieldValues(string $key): string[]` method can be used to get a list of all values for the given field key.
240240
If no value was found, an empty `array()` is returned.
241241

242242
#### getFields()
243243

244-
The `getFields()` method can be used to get an array of all fields.
244+
The `getFields(): array` method can be used to get an array of all fields.
245245

246246
#### getActionId()
247247

248-
The `getActionId()` method can be used to get the unique action ID of this message.
248+
The `getActionId(): string` method can be used to get the unique action ID of this message.
249249
This is a shortcut to get the value of the "ActionID" field.
250250

251251
#### Response
@@ -255,7 +255,7 @@ It shares all properties of the [`Message`](#message) parent class.
255255

256256
##### getCommandOutput()
257257

258-
The `getCommandOutput()` method can be used to get the resulting output of
258+
The `getCommandOutput(): ?string` method can be used to get the resulting output of
259259
a "command" [`Action`](#action).
260260
This value is only available if this is actually a response to a "command" action,
261261
otherwise it defaults to `null`.
@@ -278,7 +278,7 @@ It shares all properties of the [`Message`](#message) parent class.
278278

279279
##### getName()
280280

281-
The `getName()` method can be used to get the name of the event.
281+
The `getName(): ?string` method can be used to get the name of the event.
282282
This is a shortcut to get the value of the "Event" field.
283283

284284
## Install

0 commit comments

Comments
 (0)