Skip to content

Recipients are broken since 1.19.1 #125

@pascaldevink

Description

@pascaldevink

I believe 1.19.1, which featured #103 should not be released as a minor change, but rather in a new major version release, as it's not backwards compatible:

  1. Since the types changed, all code using recipients as arrays broke.
    Previously, this worked fine:
$messageBirdMessage->recipients = [$number];

But that now breaks.
2. The Recipient class defines the $recipient property as integer (https://github.com/messagebird/php-rest-api/blob/master/src/MessageBird/Objects/Recipient.php#L16), while that formerly accepted a string, which can still be seen in the examples (https://github.com/messagebird/php-rest-api/blob/master/examples/message-create.php#L9). The original documentation also shows that string values are allowed (https://developers.messagebird.com/quickstarts/sms/send-sms-curl/), so why this changed is unclear. This doesn't break code as much, as it's not strictly enforced by the compiler, but does break PHPStan checking my code.
3. Examples have not been updated, so documentation is now very confusing for new users.

All-in-all, I think the best course of action now would be to:

  1. Revert the changes in 1.19.1, releasing 1.19.2 as a fix
  2. Fix the documentation, examples and types
  3. Release 2.0 with this change again

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions