Skip to content

Commit

Permalink
PHP8.4 (#528)
Browse files Browse the repository at this point in the history
* Added 8.4 to fire in matrix versions

* PHP8.4 nullcheck fixes

* phpstan checks
  • Loading branch information
SecondeJK authored Dec 4, 2024
1 parent 945eec9 commit 97c41bd
Show file tree
Hide file tree
Showing 15 changed files with 29 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions src/Account/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 7 additions & 1 deletion src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Client/Exception/Validation.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 3 additions & 2 deletions src/Conversation/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
4 changes: 2 additions & 2 deletions src/Meetings/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];

Expand Down Expand Up @@ -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');
Expand Down
4 changes: 2 additions & 2 deletions src/Numbers/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -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([
Expand Down Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions src/Subaccount/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/Users/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/Verify/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion src/Verify/RequestPSD2.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/Verify2/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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');
Expand Down
2 changes: 1 addition & 1 deletion src/Voice/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion test/ProactiveConnect/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 97c41bd

Please sign in to comment.