From 3dcc2b5929852a31119e3fa93a1417a937b01485 Mon Sep 17 00:00:00 2001 From: Jim Seconde Date: Tue, 3 Dec 2024 15:38:38 +0000 Subject: [PATCH 1/3] Added 8.4 to fire in matrix versions --- .github/workflows/build.yml | 2 +- .github/workflows/release.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9f54adff..a2b028f8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,7 +21,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php: ['8.1', '8.2', '8.3'] + php: ['8.1', '8.2', '8.3', '8.4'] name: PHP ${{ matrix.php }} Test diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7346a855..1ba0daea 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,7 +23,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php: [ '8.1', '8.2', '8.3' ] + php: [ '8.1', '8.2', '8.3', '8.4' ] name: PHP ${{ matrix.php }} Test From 7f13bff3b3964b26bdeb7c1d639f2f5d31ef25e9 Mon Sep 17 00:00:00 2001 From: Jim Seconde Date: Tue, 3 Dec 2024 16:27:05 +0000 Subject: [PATCH 2/3] PHP8.4 nullcheck fixes --- src/Account/Config.php | 6 +++--- src/Client.php | 8 +++++++- src/Conversation/Client.php | 5 +++-- src/Numbers/Client.php | 4 ++-- src/Subaccount/Client.php | 4 ++-- src/Users/Client.php | 2 +- src/Verify/Client.php | 2 +- src/Verify/RequestPSD2.php | 2 +- src/Verify2/Client.php | 4 ++-- src/Voice/Client.php | 2 +- test/ProactiveConnect/ClientTest.php | 2 +- 11 files changed, 24 insertions(+), 17 deletions(-) diff --git a/src/Account/Config.php b/src/Account/Config.php index 63ed0b2c..51f5bd0c 100644 --- a/src/Account/Config.php +++ b/src/Account/Config.php @@ -19,9 +19,9 @@ class Config implements public function __construct( ?string $sms_callback_url = null, ?string $dr_callback_url = null, - int|string $max_outbound_request = null, - int|string $max_inbound_request = null, - int|string $max_calls_per_second = null + int|string|null $max_outbound_request = null, + int|string|null $max_inbound_request = null, + int|string|null $max_calls_per_second = null ) { if (!is_null($sms_callback_url)) { $this->data['sms_callback_url'] = $sms_callback_url; diff --git a/src/Client.php b/src/Client.php index aa866fb4..9a62ec28 100644 --- a/src/Client.php +++ b/src/Client.php @@ -231,7 +231,13 @@ public function __construct( // Disable throwing E_USER_DEPRECATED notices by default, the user can turn it on during development if (array_key_exists('show_deprecations', $this->options) && ($this->options['show_deprecations'] == true)) { set_error_handler( - static fn (int $errno, string $errstr, string $errfile = null, int $errline = null, array $errorcontext = null) => true, + static fn ( + int $errno, + string $errstr, + ?string $errfile = null, + ?int $errline = null, + ?array $errorcontext = null + ) => true, E_USER_DEPRECATED ); } diff --git a/src/Conversation/Client.php b/src/Conversation/Client.php index 1d9e53ca..07b012dc 100644 --- a/src/Conversation/Client.php +++ b/src/Conversation/Client.php @@ -30,8 +30,9 @@ public function getAPIResource(): APIResource return $this->api; } - public function listConversations(ListConversationFilter $conversationFilter = null): IterableAPICollection - { + public function listConversations( + ?ListConversationFilter $conversationFilter = null + ): IterableAPICollection { if (!$conversationFilter) { $conversationFilter = new ListConversationFilter(); } diff --git a/src/Numbers/Client.php b/src/Numbers/Client.php index 874648d0..d9d42a90 100644 --- a/src/Numbers/Client.php +++ b/src/Numbers/Client.php @@ -106,7 +106,7 @@ public function get(string $number): Number * @throws ClientException\Request * @throws ClientException\Server */ - public function searchAvailable(string $country, FilterInterface $options = null): array + public function searchAvailable(string $country, ?FilterInterface $options = null): array { if (is_null($options)) { $options = new AvailableNumbers([ @@ -134,7 +134,7 @@ public function searchAvailable(string $country, FilterInterface $options = null * @throws ClientException\Request * @throws ClientException\Server */ - public function searchOwned($number = null, FilterInterface $options = null): array + public function searchOwned($number = null, ?FilterInterface $options = null): array { if ($number !== null) { if ($options !== null) { diff --git a/src/Subaccount/Client.php b/src/Subaccount/Client.php index 03950a6c..965e5d2e 100644 --- a/src/Subaccount/Client.php +++ b/src/Subaccount/Client.php @@ -86,7 +86,7 @@ public function updateSubaccount(string $apiKey, string $subaccountApiKey, Accou return $this->api->partiallyUpdate($apiKey . '/subaccounts/' . $subaccountApiKey, $account->toArray()); } - public function getCreditTransfers(string $apiKey, FilterInterface $filter = null): mixed + public function getCreditTransfers(string $apiKey, ?FilterInterface $filter = null): mixed { if (!$filter) { $filter = new EmptyFilter(); @@ -101,7 +101,7 @@ public function getCreditTransfers(string $apiKey, FilterInterface $filter = nul return array_map(fn ($item) => $hydrator->hydrate($item), $transfers); } - public function getBalanceTransfers(string $apiKey, FilterInterface $filter = null): mixed + public function getBalanceTransfers(string $apiKey, ?FilterInterface $filter = null): mixed { if (!$filter) { $filter = new EmptyFilter(); diff --git a/src/Users/Client.php b/src/Users/Client.php index 46a16b9a..96e8c81f 100644 --- a/src/Users/Client.php +++ b/src/Users/Client.php @@ -29,7 +29,7 @@ public function getApiResource(): APIResource return $this->api; } - public function listUsers(FilterInterface $filter = null): IterableAPICollection + public function listUsers(?FilterInterface $filter = null): IterableAPICollection { if (is_null($filter)) { $filter = new EmptyFilter(); diff --git a/src/Verify/Client.php b/src/Verify/Client.php index 6e3082c2..ef21d4ec 100644 --- a/src/Verify/Client.php +++ b/src/Verify/Client.php @@ -178,7 +178,7 @@ public function trigger($verification): Verification * @throws ClientException\Request * @throws ClientException\Server */ - public function check(Verification|array|string $verification, string $code, string $ip = null): Verification + public function check(Verification|array|string $verification, string $code, ?string $ip = null): Verification { if (is_array($verification)) { trigger_error( diff --git a/src/Verify/RequestPSD2.php b/src/Verify/RequestPSD2.php index d395560b..33aaf930 100644 --- a/src/Verify/RequestPSD2.php +++ b/src/Verify/RequestPSD2.php @@ -39,7 +39,7 @@ public function __construct( protected string $number, protected string $payee, protected string $amount, - int $workflowId = null + ?int $workflowId = null ) { if ($workflowId) { $this->setWorkflowId($workflowId); diff --git a/src/Verify2/Client.php b/src/Verify2/Client.php index 7826b273..a1c50805 100644 --- a/src/Verify2/Client.php +++ b/src/Verify2/Client.php @@ -82,7 +82,7 @@ public static function isSilentAuthRequest(BaseVerifyRequest $request): bool return false; } - public function listCustomTemplates(TemplateFilter $filter = null): IterableAPICollection + public function listCustomTemplates(?TemplateFilter $filter = null): IterableAPICollection { $collection = $this->api->search($filter, '/templates'); $collection->setNaiveCount(true); @@ -158,7 +158,7 @@ public function deleteCustomTemplateFragment(string $templateId, string $fragmen return true; } - public function listTemplateFragments(string $templateId, TemplateFilter $filter = null): IterableAPICollection + public function listTemplateFragments(string $templateId, ?TemplateFilter $filter = null): IterableAPICollection { $api = clone $this->getAPIResource(); $api->setCollectionName('template_fragments'); diff --git a/src/Voice/Client.php b/src/Voice/Client.php index c50bf1e4..c16272ce 100644 --- a/src/Voice/Client.php +++ b/src/Voice/Client.php @@ -182,7 +182,7 @@ public function playTTS(string $callId, Talk $action): array return $this->api->update($callId . '/talk', $payload); } - public function search(FilterInterface $filter = null): IterableAPICollection + public function search(?FilterInterface $filter = null): IterableAPICollection { $response = $this->api->search($filter); $response->setApiResource(clone $this->api); diff --git a/test/ProactiveConnect/ClientTest.php b/test/ProactiveConnect/ClientTest.php index 8811b4ba..c62c129c 100644 --- a/test/ProactiveConnect/ClientTest.php +++ b/test/ProactiveConnect/ClientTest.php @@ -570,7 +570,7 @@ public function testWillDownloadItemCsv(): void fwrite($handle, (string) $response->getContents()); fseek($handle, 0); - while (($row = fgetcsv($handle)) !== false) { + while (($row = fgetcsv($handle, 0, ',', '"', '\\')) !== false) { if (!$header) { $header = $row; } else { From 46bfd5c358ca87002cbd7db3d6f27d9da347cb29 Mon Sep 17 00:00:00 2001 From: Jim Seconde Date: Wed, 4 Dec 2024 13:37:43 +0000 Subject: [PATCH 3/3] phpstan checks --- src/Client/Exception/Validation.php | 2 +- src/Meetings/Client.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Client/Exception/Validation.php b/src/Client/Exception/Validation.php index 27d4bb25..dc0d0648 100644 --- a/src/Client/Exception/Validation.php +++ b/src/Client/Exception/Validation.php @@ -11,7 +11,7 @@ class Validation extends Request public function __construct( string $message = '', int $code = 0, - Throwable $previous = null, + ?Throwable $previous = null, private readonly array $errors = [] ) { parent::__construct($message, $code, $previous); diff --git a/src/Meetings/Client.php b/src/Meetings/Client.php index edbe729f..de4e20dd 100644 --- a/src/Meetings/Client.php +++ b/src/Meetings/Client.php @@ -90,7 +90,7 @@ public function updateRoom(string $id, array $payload): Room return $room; } - public function getAllListedRooms(string $start_id = null, string $end_id = null, int $size = 20): array + public function getAllListedRooms(?string $start_id = null, ?string $end_id = null, int $size = 20): array { $filterParams = []; @@ -233,7 +233,7 @@ public function updateTheme(string $id, array $payload): ?ApplicationTheme return $applicationTheme; } - public function getRoomsByThemeId(string $themeId, string $startId = null, string $endId = null, int $size = 20): array + public function getRoomsByThemeId(string $themeId, ?string $startId = null, ?string $endId = null, int $size = 20): array { $this->api->setIsHAL(true); $this->api->setCollectionName('rooms');