Vonage / vonage-php-code-snippets

PHP code examples for using Vonage APIs
MIT License
29 stars 55 forks source link

`numbers/search-available.php` throws an error on the "pattern" option #52

Open dragonmantank opened 3 years ago

dragonmantank commented 3 years ago

When running numbers/search-available.php, it throws the following error:

PHP Fatal error:  Uncaught TypeError: Argument 1 passed to Vonage\Numbers\Filter\AvailableNumbers::setPattern() must be of the type string, int given

The setPattern() method was changed to take a string but the snippet was never updated.

tryonlinux commented 3 years ago

I would like to take a stab at this if you don't mind? Am I understanding correctly that the code snippet search-available.php needs updated to string like so?

/* @var IterableAPICollection $response / $filter = new AvailableNumbers([ "pattern" => (string) NUMBER_SEARCH_CRITERIA, "search_pattern" => (int) NUMBER_SEARCH_PATTERN, "type" => VONAGE_NUMBER_TYPE, "features" => VONAGE_NUMBER_FEATURES, ]);