twilio / twilio-php

A PHP library for communicating with the Twilio REST API and generating TwiML.
MIT License
1.57k stars 562 forks source link

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

Open stevebauman opened 1 year ago

stevebauman commented 1 year ago

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

https://github.com/twilio/twilio-php/blob/6d1f88c5b23cbf2d6d4492ec5e1f401acd576380/src/Twilio/TwiML/Voice/Gather.php#L56-L63

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>
AsabuHere commented 1 year ago

Hello @stevebauman ,

Thanks for the heads up!

This issue has been added to our internal backlog to be prioritised. Pull requests and +1s on the issue summary will help it move up the backlog.