From d59384126ba5756ea71ce4d1d7d4ab89c50d19f6 Mon Sep 17 00:00:00 2001 From: Shuvro Roy Date: Sat, 25 Mar 2023 20:45:04 +0600 Subject: [PATCH] chore: integrate & pass phpstan to max level --- .../{static-analysis.yml => format.yml} | 8 +-- .github/workflows/{php.yml => static.yml} | 11 ++-- .github/workflows/test.yml | 43 +++++++++++++++ README.md | 7 ++- composer.json | 8 ++- phpstan.neon.dist | 9 +++ src/Common/Constants.php | 2 +- src/Common/HttpLayer.php | 55 +++++++++++++++++-- src/Endpoints/AbstractEndpoint.php | 10 ++++ src/Endpoints/Automation.php | 13 +++++ src/Endpoints/Batch.php | 5 ++ src/Endpoints/Campaign.php | 34 ++++++++++++ src/Endpoints/CampaignLanguage.php | 3 + src/Endpoints/Field.php | 18 ++++++ src/Endpoints/Form.php | 19 +++++++ src/Endpoints/Group.php | 30 ++++++++++ src/Endpoints/Segment.php | 16 ++++++ src/Endpoints/Subscriber.php | 21 +++++++ src/Endpoints/Timezone.php | 3 + src/Endpoints/Webhook.php | 21 +++++++ .../MailerLiteValidationException.php | 5 +- src/Helpers/BuildUri.php | 9 +++ src/MailerLite.php | 17 +++++- 23 files changed, 344 insertions(+), 23 deletions(-) rename .github/workflows/{static-analysis.yml => format.yml} (83%) rename .github/workflows/{php.yml => static.yml} (83%) create mode 100644 .github/workflows/test.yml create mode 100644 phpstan.neon.dist diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/format.yml similarity index 83% rename from .github/workflows/static-analysis.yml rename to .github/workflows/format.yml index b8c2a36..8a5d689 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/format.yml @@ -1,4 +1,4 @@ -name: Code style and static analysis +name: Code style on: push: @@ -13,7 +13,7 @@ jobs: strategy: matrix: operating-system: [ubuntu-latest] - php-versions: ['7.4','8.0'] + php-versions: ['8.0'] name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }} steps: @@ -31,9 +31,9 @@ jobs: uses: actions/cache@v2 with: path: vendor - key: ${{ runner.os }}-php-${{ hashFiles('**/composer.json') }} + key: ${{ runner.os }}-php-cs-${{ hashFiles('**/composer.json') }} restore-keys: | - ${{ runner.os }}-php- + ${{ runner.os }}-php-cs-${{ matrix.php-versions }}- - name: Install dependencies if: steps.composer-cache.outputs.cache-hit != 'true' diff --git a/.github/workflows/php.yml b/.github/workflows/static.yml similarity index 83% rename from .github/workflows/php.yml rename to .github/workflows/static.yml index ce00768..393e41f 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/static.yml @@ -1,4 +1,4 @@ -name: Build +name: Static analysis on: push: @@ -13,7 +13,7 @@ jobs: strategy: matrix: operating-system: [ubuntu-latest] - php-versions: ['7.4','8.0'] + php-versions: ['8.2'] name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }} steps: @@ -33,10 +33,11 @@ jobs: path: vendor key: ${{ runner.os }}-php-${{ hashFiles('**/composer.json') }} restore-keys: | - ${{ runner.os }}-php- + ${{ runner.os }}-php-${{ matrix.php-versions }}- + - name: Install dependencies if: steps.composer-cache.outputs.cache-hit != 'true' run: composer install --prefer-dist --no-progress --no-suggest - - name: Run test suite - run: composer run-script test + - name: Run PHPStan + run: vendor/bin/phpstan analyse --ansi diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..a0abaa7 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,43 @@ +name: Run Tests + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + run: + + runs-on: ubuntu-latest + strategy: + matrix: + operating-system: [ubuntu-latest] + php-versions: ['7.4','8.0', '8.1', '8.2'] + name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }} + + steps: + - uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + extensions: mbstring, pdo, pdo_mysql, intl, zip + coverage: none + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v2 + with: + path: vendor + key: ${{ runner.os }}-php-${{ matrix.php-versions }}-${{ hashFiles('**/composer.json') }} + restore-keys: | + ${{ runner.os }}-php-${{ matrix.php-versions }}- + + - name: Install dependencies + if: steps.composer-cache.outputs.cache-hit != 'true' + run: composer install --prefer-dist --no-progress --no-suggest + + - name: Run test suite + run: composer run-script test diff --git a/README.md b/README.md index b1778f8..da63432 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ -[![Latest Version on Packagist](https://img.shields.io/packagist/v/mailerlite/mailerlite-php.svg?style=flat-square)](https://packagist.org/packages/mailerlite/mailerlite-php) -[![Total Downloads](https://img.shields.io/packagist/dt/mailerlite/mailerlite-php.svg?style=flat-square)](https://packagist.org/packages/mailerlite/mailerlite-php) -![GitHub Actions](https://github.com/mailerlite/mailerlite-php/actions/workflows/main.yml/badge.svg) +[![Latest Version on Packagist](https://img.shields.io/packagist/v/mailerlite/mailerlite-php.svg)](https://packagist.org/packages/mailerlite/mailerlite-php) +[![Tests](https://github.com/mailerlite/mailerlite-php/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/mailerlite/mailerlite-php/actions/workflows/test.yml) +[![PHPStan](https://github.com/mailerlite/mailerlite-php/actions/workflows/static.yml/badge.svg)](https://github.com/mailerlite/mailerlite-php/actions/workflows/static.yml) +[![Total Downloads](https://img.shields.io/packagist/dt/mailerlite/mailerlite-php.svg)](https://packagist.org/packages/mailerlite/mailerlite-php) # Table of Contents diff --git a/composer.json b/composer.json index a59b174..23f9335 100644 --- a/composer.json +++ b/composer.json @@ -35,7 +35,8 @@ "guzzlehttp/psr7": "^1.5.2", "http-interop/http-factory-guzzle": "^1.0", "php-http/guzzle7-adapter": "^0.1", - "friendsofphp/php-cs-fixer": "^2.18" + "friendsofphp/php-cs-fixer": "^2.18", + "phpstan/phpstan": "^1.10" }, "autoload": { "psr-4": { @@ -48,6 +49,9 @@ } }, "scripts": { + "analyse": [ + "@php vendor/bin/phpstan analyse --ansi" + ], "test": [ "@php vendor/bin/phpunit tests/" ], @@ -55,4 +59,4 @@ "@php vendor/bin/php-cs-fixer fix --verbose --diff" ] } -} +} \ No newline at end of file diff --git a/phpstan.neon.dist b/phpstan.neon.dist new file mode 100644 index 0000000..18be9dd --- /dev/null +++ b/phpstan.neon.dist @@ -0,0 +1,9 @@ +includes: + +parameters: + level: max + + paths: + - src + + treatPhpDocTypesAsCertain: false diff --git a/src/Common/Constants.php b/src/Common/Constants.php index 2cce6fb..53e1bf7 100644 --- a/src/Common/Constants.php +++ b/src/Common/Constants.php @@ -4,5 +4,5 @@ class Constants { - public const SDK_VERSION = 'v0.0.1'; + public const SDK_VERSION = 'v1.0.0'; } diff --git a/src/Common/HttpLayer.php b/src/Common/HttpLayer.php index 39eac13..4391223 100644 --- a/src/Common/HttpLayer.php +++ b/src/Common/HttpLayer.php @@ -19,12 +19,18 @@ class HttpLayer { - protected ?HttpClient $pluginClient; - protected ?RequestFactoryInterface $requestFactory; - protected ?StreamFactoryInterface $streamFactory; + protected HttpClient $pluginClient; + protected RequestFactoryInterface $requestFactory; + protected StreamFactoryInterface $streamFactory; + /** + * @var array + */ protected array $options; + /** + * @param array $options + */ public function __construct( array $options = [], ?ClientInterface $httpClient = null, @@ -40,26 +46,51 @@ public function __construct( $this->streamFactory = $streamFactory ?: Psr17FactoryDiscovery::findStreamFactory(); } + /** + * @param array $body + * + * @return array + */ public function get(string $uri, array $body = []): array { return $this->callMethod('GET', $uri, $body); } + /** + * @param array $body + * + * @return array + */ public function post(string $uri, array $body = []): array { return $this->callMethod('POST', $uri, $body); } + /** + * @param array $body + * + * @return array + */ public function put(string $uri, array $body): array { return $this->callMethod('PUT', $uri, $body); } + /** + * @param array $body + * + * @return array + */ public function delete(string $uri, array $body = []): array { return $this->callMethod('DELETE', $uri, $body); } + /** + * @param array $body + * + * @return array + */ protected function callMethod(string $method, string $uri, array $body): array { $request = $this->requestFactory->createRequest($method, $uri) @@ -68,6 +99,9 @@ protected function callMethod(string $method, string $uri, array $body): array return $this->buildResponse($this->pluginClient->sendRequest($request)); } + /** + * @return array + */ public function request(string $method, string $uri, string $body = ''): array { $request = $this->requestFactory->createRequest($method, $uri); @@ -79,6 +113,9 @@ public function request(string $method, string $uri, string $body = ''): array return $this->buildResponse($this->pluginClient->sendRequest($request)); } + /** + * @param array|string $body + */ protected function buildBody($body): StreamInterface { $stringBody = is_array($body) ? json_encode($body, JSON_THROW_ON_ERROR) : $body; @@ -86,6 +123,9 @@ protected function buildBody($body): StreamInterface return $this->streamFactory->createStream($stringBody); } + /** + * @return array + */ protected function buildResponse(ResponseInterface $response): array { $contentTypes = $response->getHeader('Content-Type'); @@ -112,15 +152,20 @@ protected function buildResponse(ResponseInterface $response): array ]; } + /** + * @return array + */ protected function buildPlugins(): array { - $authentication = new Bearer($this->options['api_key']); + /** @var string $apiKey */ + $apiKey = $this->options['api_key']; + $authentication = new Bearer($apiKey); $authenticationPlugin = new AuthenticationPlugin($authentication); $contentTypePlugin = new ContentTypePlugin(); $headerDefaultsPlugin = new HeaderDefaultsPlugin([ - 'User-Agent' => 'mailersend-php/'.Constants::SDK_VERSION + 'User-Agent' => 'mailersend-php/' . Constants::SDK_VERSION ]); $httpErrorPlugin = new HttpErrorHelper(); diff --git a/src/Endpoints/AbstractEndpoint.php b/src/Endpoints/AbstractEndpoint.php index 3154b87..f4a374c 100644 --- a/src/Endpoints/AbstractEndpoint.php +++ b/src/Endpoints/AbstractEndpoint.php @@ -8,14 +8,24 @@ abstract class AbstractEndpoint { protected HttpLayer $httpLayer; + + /** + * @var array + */ protected array $options; + /** + * @param array $options + */ public function __construct(HttpLayer $httpLayer, array $options) { $this->httpLayer = $httpLayer; $this->options = $options; } + /** + * @param array $params + */ protected function buildUri(string $path, array $params = []): string { return (new BuildUri($this->options))->execute($path, $params); diff --git a/src/Endpoints/Automation.php b/src/Endpoints/Automation.php index a233a6f..442dd21 100644 --- a/src/Endpoints/Automation.php +++ b/src/Endpoints/Automation.php @@ -6,6 +6,9 @@ class Automation extends AbstractEndpoint { protected string $endpoint = 'automations'; + /** + * @return array + */ public function find(string $automationId): array { return $this->httpLayer->get( @@ -13,6 +16,11 @@ public function find(string $automationId): array ); } + /** + * @param array $params + * + * @return array + */ public function get(array $params): array { return $this->httpLayer->get( @@ -20,6 +28,11 @@ public function get(array $params): array ); } + /** + * @param array $params + * + * @return array + */ public function activity(string $automationId, array $params): array { return $this->httpLayer->get( diff --git a/src/Endpoints/Batch.php b/src/Endpoints/Batch.php index 7f9eef2..8874290 100644 --- a/src/Endpoints/Batch.php +++ b/src/Endpoints/Batch.php @@ -6,6 +6,11 @@ class Batch extends AbstractEndpoint { protected string $endpoint = 'batch'; + /** + * @param array $params + * + * @return array + */ public function send(array $params): array { return $this->httpLayer->post( diff --git a/src/Endpoints/Campaign.php b/src/Endpoints/Campaign.php index a4b2ebe..278c6cc 100644 --- a/src/Endpoints/Campaign.php +++ b/src/Endpoints/Campaign.php @@ -6,6 +6,11 @@ class Campaign extends AbstractEndpoint { protected string $endpoint = 'campaigns'; + /** + * @param array $params + * + * @return array + */ public function create(array $params): array { return $this->httpLayer->post( @@ -14,6 +19,9 @@ public function create(array $params): array ); } + /** + * @return array + */ public function find(string $campaignId): array { return $this->httpLayer->get( @@ -21,6 +29,11 @@ public function find(string $campaignId): array ); } + /** + * @param array $params + * + * @return array + */ public function get(array $params): array { return $this->httpLayer->get( @@ -28,6 +41,11 @@ public function get(array $params): array ); } + /** + * @param array $params + * + * @return array + */ public function update(string $campaignId, array $params): array { return $this->httpLayer->put( @@ -36,6 +54,9 @@ public function update(string $campaignId, array $params): array ); } + /** + * @return array + */ public function delete(string $campaignId): array { return $this->httpLayer->delete( @@ -43,6 +64,11 @@ public function delete(string $campaignId): array ); } + /** + * @param array $params + * + * @return array + */ public function schedule(string $campaignId, array $params): array { return $this->httpLayer->post( @@ -51,6 +77,9 @@ public function schedule(string $campaignId, array $params): array ); } + /** + * @return array + */ public function cancel(string $campaignId): array { return $this->httpLayer->post( @@ -59,6 +88,11 @@ public function cancel(string $campaignId): array ); } + /** + * @param array $params + * + * @return array + */ public function getSubscriberActivity(string $campaignId, array $params): array { return $this->httpLayer->post( diff --git a/src/Endpoints/CampaignLanguage.php b/src/Endpoints/CampaignLanguage.php index 3ce8848..33d50ba 100644 --- a/src/Endpoints/CampaignLanguage.php +++ b/src/Endpoints/CampaignLanguage.php @@ -6,6 +6,9 @@ class CampaignLanguage extends AbstractEndpoint { protected string $endpoint = 'campaigns/languages'; + /** + * @return array + */ public function get(): array { return $this->httpLayer->get( diff --git a/src/Endpoints/Field.php b/src/Endpoints/Field.php index 7e33604..4c01a0e 100644 --- a/src/Endpoints/Field.php +++ b/src/Endpoints/Field.php @@ -6,6 +6,11 @@ class Field extends AbstractEndpoint { protected string $endpoint = 'fields'; + /** + * @param array $params + * + * @return array + */ public function create(array $params): array { return $this->httpLayer->post( @@ -14,6 +19,11 @@ public function create(array $params): array ); } + /** + * @param array $params + * + * @return array + */ public function get(array $params = []): array { return $this->httpLayer->get( @@ -21,6 +31,11 @@ public function get(array $params = []): array ); } + /** + * @param array $params + * + * @return array + */ public function update(string $fieldId, array $params): array { return $this->httpLayer->put( @@ -29,6 +44,9 @@ public function update(string $fieldId, array $params): array ); } + /** + * @return array + */ public function delete(string $fieldId): array { return $this->httpLayer->delete( diff --git a/src/Endpoints/Form.php b/src/Endpoints/Form.php index e131d8c..d7c6e9d 100644 --- a/src/Endpoints/Form.php +++ b/src/Endpoints/Form.php @@ -6,6 +6,11 @@ class Form extends AbstractEndpoint { protected string $endpoint = 'forms'; + /** + * @param array $params + * + * @return array + */ public function get(string $type, array $params = []): array { return $this->httpLayer->get( @@ -13,6 +18,9 @@ public function get(string $type, array $params = []): array ); } + /** + * @return array + */ public function find(string $formId): array { return $this->httpLayer->get( @@ -20,6 +28,11 @@ public function find(string $formId): array ); } + /** + * @param array $params + * + * @return array + */ public function update(string $formId, array $params): array { return $this->httpLayer->put( @@ -28,6 +41,9 @@ public function update(string $formId, array $params): array ); } + /** + * @return array + */ public function delete(string $formId): array { return $this->httpLayer->delete( @@ -35,6 +51,9 @@ public function delete(string $formId): array ); } + /** + * @return array + */ public function getSignups(string $formId): array { return $this->httpLayer->get( diff --git a/src/Endpoints/Group.php b/src/Endpoints/Group.php index 96e0075..85b3f6b 100644 --- a/src/Endpoints/Group.php +++ b/src/Endpoints/Group.php @@ -6,6 +6,11 @@ class Group extends AbstractEndpoint { protected string $endpoint = 'groups'; + /** + * @param array $params + * + * @return array + */ public function create(array $params): array { return $this->httpLayer->post( @@ -14,6 +19,9 @@ public function create(array $params): array ); } + /** + * @return array + */ public function find(string $groupId): array { return $this->httpLayer->get( @@ -21,6 +29,11 @@ public function find(string $groupId): array ); } + /** + * @param array $params + * + * @return array + */ public function get(array $params = []): array { return $this->httpLayer->get( @@ -28,6 +41,11 @@ public function get(array $params = []): array ); } + /** + * @param array $params + * + * @return array + */ public function update(string $groupId, array $params): array { return $this->httpLayer->put( @@ -36,6 +54,9 @@ public function update(string $groupId, array $params): array ); } + /** + * @return array + */ public function delete(string $groupId): array { return $this->httpLayer->delete( @@ -43,6 +64,9 @@ public function delete(string $groupId): array ); } + /** + * @return array + */ public function getSubscribers(string $groupId): array { return $this->httpLayer->get( @@ -50,6 +74,9 @@ public function getSubscribers(string $groupId): array ); } + /** + * @return array + */ public function assignSubscriber(string $groupId, string $subscriberId): array { return $this->httpLayer->post( @@ -57,6 +84,9 @@ public function assignSubscriber(string $groupId, string $subscriberId): array ); } + /** + * @return array + */ public function unAssignSubscriber(string $groupId, string $subscriberId): array { return $this->httpLayer->delete( diff --git a/src/Endpoints/Segment.php b/src/Endpoints/Segment.php index e593c4e..391caa2 100644 --- a/src/Endpoints/Segment.php +++ b/src/Endpoints/Segment.php @@ -6,6 +6,11 @@ class Segment extends AbstractEndpoint { protected string $endpoint = 'segments'; + /** + * @param array $params + * + * @return array + */ public function get(array $params = []): array { return $this->httpLayer->get( @@ -13,6 +18,11 @@ public function get(array $params = []): array ); } + /** + * @param array $params + * + * @return array + */ public function update(string $segmentId, array $params): array { return $this->httpLayer->put( @@ -21,6 +31,9 @@ public function update(string $segmentId, array $params): array ); } + /** + * @return array + */ public function delete(string $segmentId): array { return $this->httpLayer->delete( @@ -28,6 +41,9 @@ public function delete(string $segmentId): array ); } + /** + * @return array + */ public function getSubscribers(string $segmentId): array { return $this->httpLayer->get( diff --git a/src/Endpoints/Subscriber.php b/src/Endpoints/Subscriber.php index 2652372..0e2a6a7 100644 --- a/src/Endpoints/Subscriber.php +++ b/src/Endpoints/Subscriber.php @@ -6,6 +6,11 @@ class Subscriber extends AbstractEndpoint { protected string $endpoint = 'subscribers'; + /** + * @param array $params + * + * @return array + */ public function create(array $params): array { return $this->httpLayer->post( @@ -14,6 +19,9 @@ public function create(array $params): array ); } + /** + * @return array + */ public function find(string $subscriberId): array { return $this->httpLayer->get( @@ -21,6 +29,11 @@ public function find(string $subscriberId): array ); } + /** + * @param array $params + * + * @return array + */ public function get(array $params = []): array { return $this->httpLayer->get( @@ -28,6 +41,11 @@ public function get(array $params = []): array ); } + /** + * @param array $params + * + * @return array + */ public function update(string $subscriberId, array $params): array { return $this->httpLayer->put( @@ -36,6 +54,9 @@ public function update(string $subscriberId, array $params): array ); } + /** + * @return array + */ public function delete(string $subscriberId): array { return $this->httpLayer->delete( diff --git a/src/Endpoints/Timezone.php b/src/Endpoints/Timezone.php index e81dc65..1d3f55c 100644 --- a/src/Endpoints/Timezone.php +++ b/src/Endpoints/Timezone.php @@ -6,6 +6,9 @@ class Timezone extends AbstractEndpoint { protected string $endpoint = 'timezones'; + /** + * @return array + */ public function get(): array { return $this->httpLayer->get( diff --git a/src/Endpoints/Webhook.php b/src/Endpoints/Webhook.php index 5381b45..dc57c26 100644 --- a/src/Endpoints/Webhook.php +++ b/src/Endpoints/Webhook.php @@ -6,6 +6,11 @@ class Webhook extends AbstractEndpoint { protected string $endpoint = 'webhooks'; + /** + * @param array $params + * + * @return array + */ public function create(array $params): array { return $this->httpLayer->post( @@ -14,6 +19,9 @@ public function create(array $params): array ); } + /** + * @return array + */ public function find(string $webhookId): array { return $this->httpLayer->get( @@ -21,6 +29,11 @@ public function find(string $webhookId): array ); } + /** + * @param array $params + * + * @return array + */ public function get(array $params = []): array { return $this->httpLayer->get( @@ -28,6 +41,11 @@ public function get(array $params = []): array ); } + /** + * @param array $params + * + * @return array + */ public function update(string $webhookId, array $params): array { return $this->httpLayer->put( @@ -36,6 +54,9 @@ public function update(string $webhookId, array $params): array ); } + /** + * @return array + */ public function delete(string $webhookId): array { return $this->httpLayer->delete( diff --git a/src/Exceptions/MailerLiteValidationException.php b/src/Exceptions/MailerLiteValidationException.php index c25734b..04c5870 100644 --- a/src/Exceptions/MailerLiteValidationException.php +++ b/src/Exceptions/MailerLiteValidationException.php @@ -15,9 +15,12 @@ public function __construct( ResponseInterface $response ) { $body = $response->getBody()->getContents(); + /** @var array $data */ $data = json_decode($body, true, 512, JSON_THROW_ON_ERROR); + /** @var string $message */ + $message = $data['message']; - parent::__construct($data['message']); + parent::__construct($message); $this->request = $request; $this->response = $response; diff --git a/src/Helpers/BuildUri.php b/src/Helpers/BuildUri.php index 320702f..5f7e09a 100644 --- a/src/Helpers/BuildUri.php +++ b/src/Helpers/BuildUri.php @@ -4,13 +4,22 @@ class BuildUri { + /** + * @var array + */ protected array $options; + /** + * @param array $options + */ public function __construct(array $options) { $this->options = $options; } + /** + * @param array $params + */ public function execute(string $path, array $params = []): string { $paramsString = http_build_query($params); diff --git a/src/MailerLite.php b/src/MailerLite.php index b8817ef..bb1d172 100644 --- a/src/MailerLite.php +++ b/src/MailerLite.php @@ -21,7 +21,14 @@ */ class MailerLite { + /** + * @var array + */ protected array $options; + + /** + * @var array + */ protected static array $defaultOptions = [ 'host' => 'connect.mailerlite.com', 'protocol' => 'https', @@ -30,7 +37,7 @@ class MailerLite 'debug' => false, ]; - protected ?HttpLayer $httpLayer; + protected HttpLayer $httpLayer; public Subscriber $subscribers; public Campaign $campaigns; @@ -44,6 +51,9 @@ class MailerLite public CampaignLanguage $campaignLanguages; public Batch $batches; + /** + * @param array $options + */ public function __construct(array $options = [], ?HttpLayer $httpLayer = null) { $this->setOptions($options); @@ -51,7 +61,10 @@ public function __construct(array $options = [], ?HttpLayer $httpLayer = null) $this->setEndpoints(); } - protected function setOptions(?array $options): void + /** + * @param array $options + */ + protected function setOptions(array $options): void { $this->options = self::$defaultOptions;