Skip to content

Commit 9580818

Browse files
Updated code and fixed tests to support php 8.4 (#59)
* Updated code and fixed tests to support php 8.4 * Updated version for release
1 parent b0787fa commit 9580818

28 files changed

+260
-309
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
runs-on: ubuntu-latest
1111
strategy:
1212
matrix:
13-
version: ['7.0', '7.4', '8.0', '8.3']
13+
version: ['7.1', '7.4', '8.0', '8.4']
1414
max-parallel: 2
1515

1616
steps:
@@ -41,7 +41,7 @@ jobs:
4141
runs-on: ubuntu-latest
4242
strategy:
4343
matrix:
44-
version: ['7.0', '7.4', '8.0', '8.3']
44+
version: ['7.1', '7.4', '8.0', '8.4']
4545
max-parallel: 1
4646

4747
steps:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ A software development kit to provide ways to interact with CM.com's Text servic
99

1010
### Requirements
1111

12-
- php 7.* or 8.0 or 8.1 or 8.2 or 8.3
12+
- php 7.1 through 8.4 (inclusive)
1313

1414

1515
## Usage

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "cmdotcom/text-sdk-php",
33
"description": "PHP SDK to send messages with CM.com",
44
"type": "library",
5-
"version": "2.3.1",
5+
"version": "3.0.0",
66
"keywords": ["sms","cm.com","rcs","whatsapp","viber","line","wechat","imessage","twitter","instagram"],
77
"homepage": "https://www.cm.com/products/text/",
88
"license": "MIT",
@@ -16,10 +16,10 @@
1616
"require": {
1717
"ext-curl": "*",
1818
"ext-json": "*",
19-
"php": "^7.0||^8.0"
19+
"php": "^7.1||^8.0"
2020
},
2121
"require-dev": {
22-
"phpunit/phpunit": "~6.0||~9.0"
22+
"phpunit/phpunit": "~7.0||~9.0"
2323
},
2424
"autoload": {
2525
"psr-0": {

src/CMText/ITextClient.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ public function __construct(
2222
* @param string $message - Message body to send
2323
* @param string $from - Sender name
2424
* @param array $to - Recipient phonenumbers
25-
* @param string $reference optional
25+
* @param string|null $reference optional
2626
*
2727
* @return TextClientResult
2828
*/
2929
public function SendMessage(
3030
string $message,
3131
string $from,
3232
array $to,
33-
string $reference = null
33+
?string $reference = null
3434
);
3535

3636
/**

src/CMText/Message.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,16 @@ class Message implements JsonSerializable
106106
*
107107
* @param string|MessageBody $body
108108
* @param string|null $from
109-
* @param array $to
109+
* @param array|null $to
110110
* @param string|null $reference
111111
* @throws \CMText\Exceptions\RecipientLimitException
112112
*/
113-
public function __construct($body = '', string $from = null, array $to = [], string $reference = null)
113+
public function __construct(
114+
$body = '',
115+
?string $from = null,
116+
?array $to = [],
117+
?string $reference = null
118+
)
114119
{
115120
$this->__set('body', $body);
116121
$this->__set('from', $from);

src/CMText/RichContent/Messages/WhatsApp/WhatsAppInteractiveContent.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ class WhatsAppInteractiveContent implements \JsonSerializable
2525
*/
2626
public function __construct(
2727
string $type,
28-
WhatsAppInteractiveHeader $header = null,
29-
WhatsAppInteractiveBody $body = null,
30-
IWhatsAppInteractiveAction $action = null,
31-
WhatsAppInteractiveFooter $footer = null
28+
?WhatsAppInteractiveHeader $header = null,
29+
?WhatsAppInteractiveBody $body = null,
30+
?IWhatsAppInteractiveAction $action = null,
31+
?WhatsAppInteractiveFooter $footer = null
3232
)
3333
{
3434
if( !in_array(

src/CMText/RichContent/Messages/WhatsApp/WhatsAppInteractiveHeader.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ class WhatsAppInteractiveHeader
1414

1515
/**
1616
* @param string $type
17-
* @param string $text
17+
* @param string|null $text
1818
* @param MediaContent|null $media
1919
* @throws \Exception
2020
*/
2121
public function __construct(
2222
string $type,
23-
string $text = null,
24-
MediaContent $media = null)
23+
?string $text = null,
24+
?MediaContent $media = null)
2525
{
2626
if( !in_array($type, (new \ReflectionClass(WhatsAppInteractiveHeaderTypes::class))->getConstants()) ){
2727
throw new \Exception("Unsupported WhatsApp-InteractiveHeader-type $type");

src/CMText/RichContent/Messages/WhatsApp/WhatsAppInteractiveSectionRow.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class WhatsAppInteractiveSectionRow
1919
public function __construct(
2020
string $title,
2121
string $id,
22-
string $description = null
22+
?string $description = null
2323
)
2424
{
2525
$this->title = $title;

src/CMText/RichContent/Suggestions/ReplySuggestion.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class ReplySuggestion extends SuggestionBase
2222

2323
public function __construct(
2424
string $Label,
25-
string $Text = null
25+
?string $Text = null
2626
)
2727
{
2828
$this->label = $Label;

src/CMText/TextClient.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class TextClient implements ITextClient
3232
/**
3333
* SDK Version constant
3434
*/
35-
const VERSION = '2.3.1';
35+
const VERSION = '3.0.0';
3636

3737

3838
/**
@@ -70,7 +70,7 @@ public function SendMessage(
7070
string $message,
7171
string $from,
7272
array $to,
73-
string $reference = null
73+
?string $reference = null
7474
)
7575
{
7676
// send it out instantly

0 commit comments

Comments
 (0)