Skip to content

TwiML/Voice/Gather::setInput() has wrong doc type for $input #778

Open
@stevebauman

Description

The documented $input parameter for the Gather::setInput() method says it should contain an array of strings:

/**
* Add Input attribute.
*
* @param string[] $input Input type Twilio should accept
*/
public function setInput($input): self {
return $this->setAttribute('input', $input);
}

However, this is not the case, as it should accept a single string only, according to the documentation:

https://www.twilio.com/docs/voice/twiml/gather#input

Code Example:

<?php
require_once './vendor/autoload.php';
use Twilio\TwiML\VoiceResponse;

$response = new VoiceResponse();
$gather = $response->gather(['input' => 'speech', 'action' => '/completed']);
$gather->say('Welcome to Twilio, please tell us why you\'re calling');

echo $response;

Expected XML Output:

<?xml version="1.0" encoding="UTF-8"?>
<!-- page located at http://example.com/simple_gather.xml -->
<Response>
    <Gather input="speech" action="/completed">
           <Say>Welcome to Twilio, please tell us why you're calling</Say>
        </Gather>
</Response>

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions