Skip to content

Commit 4158951

Browse files
authored
Linting Scrub (#516)
* Code sniffer auto fixes * Friends of PHP code lint fixer * Whoops, fix composer.json
1 parent 9c2cd96 commit 4158951

File tree

69 files changed

+501
-189
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+501
-189
lines changed

src/Account/Price.php

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Vonage\Entity\JsonResponseTrait;
1111
use Vonage\Entity\JsonSerializableTrait;
1212
use Vonage\Entity\NoRequestResponseTrait;
13+
1314
use function array_key_exists;
1415
use function ltrim;
1516
use function preg_replace;

src/Client.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ public function __construct(
210210

211211
// Additional utility classes
212212
APIResource::class => APIResource::class,
213-
Client::class => fn() => $this
213+
Client::class => fn () => $this
214214
];
215215

216216
if (class_exists('Vonage\Video\ClientFactory')) {
@@ -231,7 +231,7 @@ public function __construct(
231231
// Disable throwing E_USER_DEPRECATED notices by default, the user can turn it on during development
232232
if (array_key_exists('show_deprecations', $this->options) && ($this->options['show_deprecations'] == true)) {
233233
set_error_handler(
234-
static fn(int $errno, string $errstr, string $errfile = null, int $errline = null, array $errorcontext = null) => true,
234+
static fn (int $errno, string $errstr, string $errfile = null, int $errline = null, array $errorcontext = null) => true,
235235
E_USER_DEPRECATED
236236
);
237237
}

src/Client/APIClient.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
declare(strict_types=1);
34

45
namespace Vonage\Client;

src/Client/APIExceptionHandler.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
declare(strict_types=1);
34

45
namespace Vonage\Client;

src/Client/APIResource.php

+7-2
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,13 @@ public function delete(string $id, array $headers = []): ?array
182182
* @throws ClientExceptionInterface
183183
* @throws Exception\Exception
184184
*/
185-
public function get($id, array $query = [], array $headers = [], bool $jsonResponse = true, bool $uriOverride = false)
186-
{
185+
public function get(
186+
$id,
187+
array $query = [],
188+
array $headers = [],
189+
bool $jsonResponse = true,
190+
bool $uriOverride = false
191+
) {
187192
$uri = $this->getBaseUrl() . $this->baseUri . '/' . $id;
188193

189194
// This is a necessary hack if you want to fetch a totally different URL but use Vonage Auth

src/Client/Credentials/Handler/BasicHandler.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ public function __invoke(RequestInterface $request, CredentialsInterface $creden
1717

1818
return $request->withHeader('Authorization', 'Basic ' . $cx);
1919
}
20-
}
20+
}

src/Client/Credentials/Handler/BasicQueryHandler.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ public function __invoke(RequestInterface $request, CredentialsInterface $creden
1616

1717
return $request->withUri($request->getUri()->withQuery(http_build_query($query)));
1818
}
19-
}
19+
}

src/Client/Credentials/Handler/GnpKeypairHandler.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ public function __invoke(RequestInterface $request, CredentialsInterface $creden
1717

1818
return $request->withHeader('Authorization', 'Bearer ' . $token->toString());
1919
}
20-
}
20+
}

src/Client/Credentials/Handler/HandlerInterface.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ interface HandlerInterface
1010
/**
1111
* Add authentication to a request
1212
*/
13-
function __invoke(RequestInterface $request, CredentialsInterface $credentials): RequestInterface;
13+
public function __invoke(RequestInterface $request, CredentialsInterface $credentials): RequestInterface;
1414
}

src/Client/Credentials/Handler/KeypairHandler.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ public function __invoke(RequestInterface $request, CredentialsInterface $creden
1616

1717
return $request->withHeader('Authorization', 'Bearer ' . $token->toString());
1818
}
19-
}
19+
}

src/Client/Credentials/Handler/TokenBodyFormHandler.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ public function __invoke(RequestInterface $request, CredentialsInterface $creden
2222

2323
return $request;
2424
}
25-
}
25+
}

src/Client/Credentials/Handler/TokenQueryHandler.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ public function __invoke(RequestInterface $request, CredentialsInterface $creden
1919

2020
return $request;
2121
}
22-
}
22+
}

src/Client/Exception/Validation.php

+6-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,12 @@
88

99
class Validation extends Request
1010
{
11-
public function __construct(string $message = '', int $code = 0, Throwable $previous = null, private readonly array $errors = [])
12-
{
11+
public function __construct(
12+
string $message = '',
13+
int $code = 0,
14+
Throwable $previous = null,
15+
private readonly array $errors = []
16+
) {
1317
parent::__construct($message, $code, $previous);
1418
}
1519

src/Client/Factory/MapFactory.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ public function __construct(
3434
* Vonage Client
3535
*/
3636
protected Client $client
37-
)
38-
{
37+
) {
3938
}
4039

4140
/**

src/Client/InvalidResponseException.php

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
declare(strict_types=1);
34

45
namespace Vonage\Client;

src/Client/Request/RequestInterface.php

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
interface RequestInterface
88
{
9-
109
public function getParams(): array;
1110

1211
public function getURI(): string;

src/Client/Signature.php

+6-4
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,12 @@ class Signature implements \Stringable
3434
* @throws ClientException
3535
*/
3636
public function __construct(/**
37-
* Params to Sign
38-
*/
39-
protected array $params, $secret, $signatureMethod)
40-
{
37+
* Params to Sign
38+
*/
39+
protected array $params,
40+
$secret,
41+
$signatureMethod
42+
) {
4143
$this->signed = $params;
4244

4345
if (!isset($this->signed['timestamp'])) {

src/Conversation/Client.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public function listMembersByConversationId(
103103
?ListMembersFilter $filter = null
104104
): IterableAPICollection {
105105
$api = clone $this->getAPIResource();
106-
$api->setBaseUrl('https://api.nexmo.com/v1/users');
106+
$api->setBaseUrl('https://api.nexmo.com/v1/users/');
107107
$api->setCollectionName('members');
108108
$response = $api->search($filter, $conversationId . '/members');
109109
$response->setHasPagination(true);

src/Entity/Filter/EmptyFilter.php

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
class EmptyFilter implements FilterInterface
88
{
9-
109
public function getQuery(): array
1110
{
1211
return [];

src/Insights/Basic.php

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace Vonage\Insights;
66

77
use Vonage\Entity\Hydrator\ArrayHydrateInterface;
8+
89
class Basic implements ArrayHydrateInterface
910
{
1011
protected array $data = [];

src/Meetings/ExceptionErrorHandler.php

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
use Psr\Http\Message\RequestInterface;
88
use Psr\Http\Message\ResponseInterface;
9-
109
use Vonage\Client\Exception\Conflict;
1110
use Vonage\Client\Exception\Credentials;
1211
use Vonage\Client\Exception\NotFound;

src/Meetings/Room.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function fromArray(array $data): static
2121

2222
public function toArray(): array
2323
{
24-
return array_filter($this->data, static fn($value) => $value !== '');
24+
return array_filter($this->data, static fn ($value) => $value !== '');
2525
}
2626

2727
public function __get($value)

src/Messages/Channel/MMS/MMSImage.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ public function toArray(): array
3333

3434
return $returnArray;
3535
}
36-
}
36+
}

src/Messages/Channel/Messenger/InvalidCategoryException.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44

55
class InvalidCategoryException extends \Exception
66
{
7-
}
7+
}

src/Messages/Channel/Messenger/MessengerVideo.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ public function toArray(): array
3636

3737
return $returnArray;
3838
}
39-
}
39+
}

src/Messages/Channel/RCS/RcsInvalidTtlException.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44

55
class RcsInvalidTtlException extends \Exception
66
{
7-
}
7+
}

src/Messages/Channel/Viber/ViberImage.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ public function toArray(): array
3636
$returnArray['image'] = $this->image->toArray();
3737

3838
if ($this->requiresViberServiceObject()) {
39-
$this->getCategory() ? $returnArray['viber_service']['category'] = $this->getCategory(): null;
40-
$this->getTtl() ? $returnArray['viber_service']['ttl'] = $this->getTtl(): null;
41-
$this->getType() ? $returnArray['viber_service']['type'] = $this->getType(): null;
42-
$this->getAction() ? $returnArray['viber_service']['action'] = $this->getAction()->toArray(): null;
39+
$this->getCategory() ? $returnArray['viber_service']['category'] = $this->getCategory() : null;
40+
$this->getTtl() ? $returnArray['viber_service']['ttl'] = $this->getTtl() : null;
41+
$this->getType() ? $returnArray['viber_service']['type'] = $this->getType() : null;
42+
$this->getAction() ? $returnArray['viber_service']['action'] = $this->getAction()->toArray() : null;
4343
}
4444

4545
return array_filter($returnArray);

src/Messages/Channel/Viber/ViberText.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ public function toArray(): array
3838
$returnArray['text'] = $this->getText();
3939

4040
if ($this->requiresViberServiceObject()) {
41-
$this->getCategory() ? $returnArray['viber_service']['category'] = $this->getCategory(): null;
42-
$this->getTtl() ? $returnArray['viber_service']['ttl'] = $this->getTtl(): null;
43-
$this->getType() ? $returnArray['viber_service']['type'] = $this->getType(): null;
44-
$this->getAction() ? $returnArray['viber_service']['action'] = $this->getAction()->toArray(): null;
41+
$this->getCategory() ? $returnArray['viber_service']['category'] = $this->getCategory() : null;
42+
$this->getTtl() ? $returnArray['viber_service']['ttl'] = $this->getTtl() : null;
43+
$this->getType() ? $returnArray['viber_service']['type'] = $this->getType() : null;
44+
$this->getAction() ? $returnArray['viber_service']['action'] = $this->getAction()->toArray() : null;
4545
}
4646

4747
return array_filter($returnArray);

src/Messages/Channel/WhatsApp/MessageObjects/StickerObject.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
class StickerObject implements ArrayHydrateInterface
88
{
99
public const STICKER_URL = 'url';
10-
public const STICKER_ID = 'id';
10+
public const STICKER_ID = 'id';
1111

1212
private array $allowedTypes = [
1313
self::STICKER_URL,

src/Messages/ClientFactory.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ public function __invoke(ContainerInterface $container): Client
2222

2323
return new Client($api);
2424
}
25-
}
25+
}

src/NumberVerification/ClientFactory.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ public function __invoke(ContainerInterface $container): Client
2929

3030
return new Client($api);
3131
}
32-
}
32+
}

src/Numbers/Client.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ public function purchase($number, ?string $country = null): void
204204
'msisdn' => $number->getMsisdn(),
205205
'country' => $number->getCountry()
206206
];
207-
// Evil else that will be removed in the next major version.
207+
// Evil else that will be removed in the next major version.
208208
} else {
209209
$body = [
210210
'msisdn' => $number,

src/ProactiveConnect/ClientFactory.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ public function __invoke(ContainerInterface $container): Client
1818

1919
return new Client($api);
2020
}
21-
}
21+
}

src/ProactiveConnect/Objects/ManualList.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,6 @@ public function toArray(): array
8686
'attributes' => $this->getAttributes() ?: null
8787
];
8888

89-
return array_filter($returnArray, fn($value) => $value !== null);
89+
return array_filter($returnArray, fn ($value) => $value !== null);
9090
}
9191
}

src/ProactiveConnect/Objects/SalesforceList.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,6 @@ public function toArray(): array
112112
'attributes' => $this->getAttributes() ?: null
113113
];
114114

115-
return array_filter($returnArray, fn($value) => $value !== null);
115+
return array_filter($returnArray, fn ($value) => $value !== null);
116116
}
117117
}

src/SimSwap/ClientFactory.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ public function __invoke(ContainerInterface $container): Client
2828

2929
return new Client($api);
3030
}
31-
}
31+
}

src/Subaccount/Client.php

+11-5
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function getSubaccounts(string $apiKey): array
5454
$hydrator->setPrototype(new Account());
5555
$subaccounts = $collection->getPageData()['_embedded'][$api->getCollectionName()];
5656

57-
return array_map(fn($item) => $hydrator->hydrate($item), $subaccounts);
57+
return array_map(fn ($item) => $hydrator->hydrate($item), $subaccounts);
5858
}
5959

6060
public function createSubaccount(string $apiKey, Account $account): ?array
@@ -64,14 +64,20 @@ public function createSubaccount(string $apiKey, Account $account): ?array
6464

6565
public function makeBalanceTransfer(TransferBalanceRequest $transferRequest): BalanceTransfer
6666
{
67-
$response = $this->api->create($transferRequest->toArray(), '/' . $transferRequest->getApiKey() . '/balance-transfers');
67+
$response = $this->api->create(
68+
$transferRequest->toArray(),
69+
'/' . $transferRequest->getApiKey() . '/balance-transfers'
70+
);
6871

6972
return (new BalanceTransfer())->fromArray($response);
7073
}
7174

7275
public function makeCreditTransfer(TransferCreditRequest $transferRequest): CreditTransfer
7376
{
74-
$response = $this->api->create($transferRequest->toArray(), '/' . $transferRequest->getApiKey() . '/credit-transfers');
77+
$response = $this->api->create(
78+
$transferRequest->toArray(),
79+
'/' . $transferRequest->getApiKey() . '/credit-transfers'
80+
);
7581
return (new CreditTransfer())->fromArray($response);
7682
}
7783

@@ -92,7 +98,7 @@ public function getCreditTransfers(string $apiKey, FilterInterface $filter = nul
9298
$hydrator->setPrototype(new CreditTransfer());
9399
$transfers = $response['_embedded']['credit_transfers'];
94100

95-
return array_map(fn($item) => $hydrator->hydrate($item), $transfers);
101+
return array_map(fn ($item) => $hydrator->hydrate($item), $transfers);
96102
}
97103

98104
public function getBalanceTransfers(string $apiKey, FilterInterface $filter = null): mixed
@@ -107,7 +113,7 @@ public function getBalanceTransfers(string $apiKey, FilterInterface $filter = nu
107113
$hydrator->setPrototype(new BalanceTransfer());
108114
$transfers = $response['_embedded']['balance_transfers'];
109115

110-
return array_map(fn($item) => $hydrator->hydrate($item), $transfers);
116+
return array_map(fn ($item) => $hydrator->hydrate($item), $transfers);
111117
}
112118

113119
public function makeNumberTransfer(NumberTransferRequest $request): ?array

src/Subaccount/ClientFactory.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ public function __invoke(ContainerInterface $container): Client
1616

1717
return new Client($api);
1818
}
19-
}
19+
}

src/Subaccount/Filter/SubaccountFilter.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,4 @@ public function setSubaccount(?string $subaccount): void
9494
{
9595
$this->subaccount = $subaccount;
9696
}
97-
}
97+
}

src/Verify2/ClientFactory.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ public function __invoke(ContainerInterface $container): Client
1919

2020
return new Client($api);
2121
}
22-
}
22+
}

0 commit comments

Comments
 (0)