From 50c7a0bb008dda51d250c092c17fe1ea660e722a Mon Sep 17 00:00:00 2001 From: Samuel Weirich <4281791+SamuelWei@users.noreply.github.com> Date: Tue, 21 Jul 2026 10:57:18 +0200 Subject: [PATCH 1/4] Drop php8.1, change to min php 8.2 --- .github/workflows/ci.yml | 12 ++++++------ .gitignore | 2 +- README.md | 6 +++--- composer.json | 10 +++++----- tools/.phpstan/composer.json | 2 +- tools/.phpstan/composer.lock | 36 +++++++++++++++++++++--------------- tools/.phpunit/composer.json | 2 +- tools/.psalm/composer.json | 2 +- tools/.rector/composer.json | 2 +- 9 files changed, 40 insertions(+), 34 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 557a7733..9529e4b8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ jobs: strategy: fail-fast: false matrix: - php-versions: ['8.1', '8.2', '8.3'] + php-versions: ['8.2', '8.3', '8.4', '8.5'] experimental: [false] steps: @@ -37,7 +37,7 @@ jobs: strategy: fail-fast: false matrix: - php-versions: ['8.1', '8.2', '8.3'] + php-versions: ['8.2', '8.3', '8.4', '8.5'] experimental: [false] steps: - name: Checkout @@ -64,14 +64,14 @@ jobs: run: tools/phpunit --testsuite="BigBlueButton unit test suite,BigBlueButton integration test suite" continue-on-error: true - name: Upload coverage - if: ${{ matrix.php-versions == '8.1' }} + if: ${{ matrix.php-versions == '8.2' }} uses: codecov/codecov-action@v3 - name: Run rector - if: ${{ matrix.php-versions == '8.1' }} + if: ${{ matrix.php-versions == '8.2' }} run: tools/rector process --dry-run - name: Run psalm - if: ${{ matrix.php-versions == '8.1' }} + if: ${{ matrix.php-versions == '8.2' }} run: tools/psalm - name: Run phpstan - if: ${{ matrix.php-versions == '8.1' }} + if: ${{ matrix.php-versions == '8.2' }} run: tools/phpstan diff --git a/.gitignore b/.gitignore index 3fdf8edd..c714baae 100644 --- a/.gitignore +++ b/.gitignore @@ -25,7 +25,7 @@ reports # The library does not locks down the dependencies for several reasons: # # * In the outer world, the lock is not effective. Only the lock of the requiring application is accounted. -# * It makes it hard, to run the library with its deps in the CI as when running `composer require` under PHP 8.1, +# * It makes it hard, to run the library with its deps in the CI as when running `composer require` under PHP 8.2, # an incompatible lock file is created which is unsuable unter PHP 7.x. # # See https://github.com/littleredbutton/bigbluebutton-api-php/pull/115 for the discussion. diff --git a/README.md b/README.md index 9b29b0ef..915ba49f 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # :tada: Best BigBlueButton API for PHP The unofficial and easiest to use **BigBlueButton API for PHP**, makes easy for -developers to use [BigBlueButton API] v2.2+ for **PHP 8.1+**. +developers to use [BigBlueButton API] v2.2+ for **PHP 8.2+**. ![Build Status](https://github.com/littleredbutton/bigbluebutton-api-php/workflows/CI/badge.svg) [![Coverage Status](https://coveralls.io/repos/github/littleredbutton/bigbluebutton-api-php/badge.svg?branch=master)](https://coveralls.io/github/littleredbutton/bigbluebutton-api-php?branch=master) @@ -56,7 +56,7 @@ following advantages: - Development is simplified through git hooks and contributor guidelines - Documentation is up-to-date and complete - API is fixed and extended to exploit the full potential -- Require at least PHP 8.1, which allows to make the code more efficient and +- Require at least PHP 8.2, which allows to make the code more efficient and readable ## :gear: Installation and usage @@ -64,7 +64,7 @@ following advantages: In order to use this library you have to make sure to meet the following requirements: -- PHP 8.1 or above. +- PHP 8.2 or above. - curl library installed. - mbstring library installed. - xml library installed. diff --git a/composer.json b/composer.json index d27ba7f3..30d48549 100644 --- a/composer.json +++ b/composer.json @@ -58,7 +58,7 @@ "docs": "https://github.com/littleredbutton/bigbluebutton-api-php/blob/master/README.md" }, "require": { - "php": ">=8.1", + "php": ">=8.2", "ext-curl": "*", "ext-simplexml": "*", "ext-mbstring": "*", @@ -143,10 +143,10 @@ } }, "friendsofphp/php-cs-fixer": "^3.3", - "phpstan/phpstan": "^1.10", - "phpunit/phpunit": "^10", - "rector/rector": "^1.0", - "vimeo/psalm": "^5.23" + "phpstan/phpstan": "^2.0", + "phpunit/phpunit": "^11", + "rector/rector": "^2.0", + "vimeo/psalm": "^6.0" } } } diff --git a/tools/.phpstan/composer.json b/tools/.phpstan/composer.json index 90c99dfd..6dea17a8 100644 --- a/tools/.phpstan/composer.json +++ b/tools/.phpstan/composer.json @@ -1,5 +1,5 @@ { "require": { - "phpstan/phpstan": "^1.10" + "phpstan/phpstan": "^2.0" } } diff --git a/tools/.phpstan/composer.lock b/tools/.phpstan/composer.lock index 2c3ffe96..eebbe4ff 100644 --- a/tools/.phpstan/composer.lock +++ b/tools/.phpstan/composer.lock @@ -4,24 +4,19 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "14812c2a05a5972f00f9d67abbd710a9", + "content-hash": "a1a9a305e36d2c71272f49ce0f9c92fe", "packages": [ { "name": "phpstan/phpstan", - "version": "1.12.3", - "source": { - "type": "git", - "url": "https://github.com/phpstan/phpstan.git", - "reference": "0fcbf194ab63d8159bb70d9aa3e1350051632009" - }, + "version": "2.2.5", "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/0fcbf194ab63d8159bb70d9aa3e1350051632009", - "reference": "0fcbf194ab63d8159bb70d9aa3e1350051632009", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/909c1e5fef7989ac0d0c1c5c42e32a5c4f6198a0", + "reference": "909c1e5fef7989ac0d0c1c5c42e32a5c4f6198a0", "shasum": "" }, "require": { - "php": "^7.2|^8.0" + "php": "^7.4|^8.0" }, "conflict": { "phpstan/phpstan-shim": "*" @@ -40,6 +35,17 @@ "license": [ "MIT" ], + "authors": [ + { + "name": "Ondřej Mirtes" + }, + { + "name": "Markus Staab" + }, + { + "name": "Vincent Langlet" + } + ], "description": "PHPStan - PHP Static Analysis Tool", "keywords": [ "dev", @@ -62,16 +68,16 @@ "type": "github" } ], - "time": "2024-09-09T08:10:35+00:00" + "time": "2026-07-05T06:31:06+00:00" } ], "packages-dev": [], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": {}, "prefer-stable": false, "prefer-lowest": false, - "platform": [], - "platform-dev": [], - "plugin-api-version": "2.6.0" + "platform": {}, + "platform-dev": {}, + "plugin-api-version": "2.9.0" } diff --git a/tools/.phpunit/composer.json b/tools/.phpunit/composer.json index 2dc16d75..71198119 100644 --- a/tools/.phpunit/composer.json +++ b/tools/.phpunit/composer.json @@ -1,6 +1,6 @@ { "require": { - "phpunit/phpunit": "^10.0", + "phpunit/phpunit": "^11.0", "fakerphp/faker": "1.24.*" } } diff --git a/tools/.psalm/composer.json b/tools/.psalm/composer.json index 70de5195..7ee4658e 100644 --- a/tools/.psalm/composer.json +++ b/tools/.psalm/composer.json @@ -1,5 +1,5 @@ { "require": { - "vimeo/psalm": "^5.23" + "vimeo/psalm": "^6.0" } } diff --git a/tools/.rector/composer.json b/tools/.rector/composer.json index 056d015c..d4420aba 100644 --- a/tools/.rector/composer.json +++ b/tools/.rector/composer.json @@ -1,5 +1,5 @@ { "require": { - "rector/rector": "^1.0" + "rector/rector": "^2.0" } } From 64d52a68b101209ea5d7897630f26aeae66adb04 Mon Sep 17 00:00:00 2001 From: Samuel Weirich <4281791+SamuelWei@users.noreply.github.com> Date: Tue, 21 Jul 2026 11:08:53 +0200 Subject: [PATCH 2/4] Fix rector --- src/Http/SetCookie.php | 2 +- .../Bridge/PsrHttpClient/PsrHttpClientTransport.php | 4 ++-- .../SymfonyHttpClient/SymfonyHttpClientTransport.php | 4 ++-- src/Http/Transport/CurlTransport.php | 4 ++-- src/Util/UrlBuilder.php | 8 ++++---- tests/integration/Http/Transport/Fixtures/web/dump.php | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Http/SetCookie.php b/src/Http/SetCookie.php index 923ad56f..af895158 100644 --- a/src/Http/SetCookie.php +++ b/src/Http/SetCookie.php @@ -62,7 +62,7 @@ public static function fromString(string $cookie): self // Create the default return array $data = self::$defaults; // Explode the cookie string using a series of semicolons - $pieces = array_filter(array_map('trim', explode(';', $cookie))); + $pieces = array_filter(array_map(trim(...), explode(';', $cookie))); // The name of the cookie (first kvp) must exist and include an equal sign. if (!isset($pieces[0]) || !str_contains($pieces[0], '=')) { return new self($data); diff --git a/src/Http/Transport/Bridge/PsrHttpClient/PsrHttpClientTransport.php b/src/Http/Transport/Bridge/PsrHttpClient/PsrHttpClientTransport.php index befa70d9..2db4c8de 100644 --- a/src/Http/Transport/Bridge/PsrHttpClient/PsrHttpClientTransport.php +++ b/src/Http/Transport/Bridge/PsrHttpClient/PsrHttpClientTransport.php @@ -67,12 +67,12 @@ /** * Allows to send requests to the BBB server with a {@link https://www.php-fig.org/psr/psr-18/} implementation. */ -final class PsrHttpClientTransport implements TransportInterface +final readonly class PsrHttpClientTransport implements TransportInterface { /** * @param string[] $defaultHeaders additional headers to pass on each request */ - public function __construct(private readonly ClientInterface $httpClient, private readonly RequestFactoryInterface $requestFactory, private readonly StreamFactoryInterface $streamFactory, private readonly array $defaultHeaders = []) + public function __construct(private ClientInterface $httpClient, private RequestFactoryInterface $requestFactory, private StreamFactoryInterface $streamFactory, private array $defaultHeaders = []) { } diff --git a/src/Http/Transport/Bridge/SymfonyHttpClient/SymfonyHttpClientTransport.php b/src/Http/Transport/Bridge/SymfonyHttpClient/SymfonyHttpClientTransport.php index 0545c74d..d0b3e5fd 100644 --- a/src/Http/Transport/Bridge/SymfonyHttpClient/SymfonyHttpClientTransport.php +++ b/src/Http/Transport/Bridge/SymfonyHttpClient/SymfonyHttpClientTransport.php @@ -51,13 +51,13 @@ /** * Allows to send requests to the BBB server with a Symfony HTTP Client contract implementation. */ -final class SymfonyHttpClientTransport implements TransportInterface +final readonly class SymfonyHttpClientTransport implements TransportInterface { /** * @param string[] $defaultHeaders additional HTTP headers to pass on each request * @param mixed[] $defaultOptions Options for Symfony HTTP client passed on every request. See {@link https://symfony.com/doc/current/http_client.html} for details. */ - public function __construct(private readonly HttpClientInterface $httpClient, private readonly array $defaultHeaders = [], private readonly array $defaultOptions = []) + public function __construct(private HttpClientInterface $httpClient, private array $defaultHeaders = [], private array $defaultOptions = []) { } diff --git a/src/Http/Transport/CurlTransport.php b/src/Http/Transport/CurlTransport.php index 8f537677..903fe4d3 100644 --- a/src/Http/Transport/CurlTransport.php +++ b/src/Http/Transport/CurlTransport.php @@ -28,7 +28,7 @@ /** * Allows to send requests to the BBB server with the pure PHP cURL implementation. */ -final class CurlTransport implements TransportInterface +final readonly class CurlTransport implements TransportInterface { public const DEFAULT_CURL_OPTIONS = [ \CURLOPT_SSL_VERIFYPEER => 1, @@ -64,7 +64,7 @@ final class CurlTransport implements TransportInterface * * @param mixed[] $curlOptions A list of cURL options to pass to the cURL handle. Option name as key, option value as value. */ - public function __construct(private readonly array $curlOptions = []) + public function __construct(private array $curlOptions = []) { } diff --git a/src/Util/UrlBuilder.php b/src/Util/UrlBuilder.php index 822e04a9..0a4bba9f 100644 --- a/src/Util/UrlBuilder.php +++ b/src/Util/UrlBuilder.php @@ -30,12 +30,12 @@ * * @internal */ -final class UrlBuilder +final readonly class UrlBuilder { public function __construct( - private readonly string $securitySalt, - private readonly string $bbbServerBaseUrl, - private readonly HashingAlgorithm $hashingAlgorithm, + private string $securitySalt, + private string $bbbServerBaseUrl, + private HashingAlgorithm $hashingAlgorithm, ) { } diff --git a/tests/integration/Http/Transport/Fixtures/web/dump.php b/tests/integration/Http/Transport/Fixtures/web/dump.php index 31445fdc..95c82f62 100644 --- a/tests/integration/Http/Transport/Fixtures/web/dump.php +++ b/tests/integration/Http/Transport/Fixtures/web/dump.php @@ -38,7 +38,7 @@ foreach ($_SERVER as $k => $v) { switch ($k) { default: - if (!str_starts_with($k, 'HTTP_')) { + if (!str_starts_with((string) $k, 'HTTP_')) { continue 2; } // no break From 940142326ba4657b06166b24a13cb5fdb7dd1ca6 Mon Sep 17 00:00:00 2001 From: Samuel Weirich <4281791+SamuelWei@users.noreply.github.com> Date: Tue, 21 Jul 2026 11:26:08 +0200 Subject: [PATCH 3/4] Fix psalm --- composer.json | 2 +- psalm.xml | 1 + src/Http/SetCookie.php | 27 +++++++++++-------- .../PsrHttpClient/PsrHttpClientTransport.php | 1 + .../SymfonyHttpClientTransport.php | 3 ++- src/Http/Transport/Cookie.php | 2 +- src/Http/Transport/CurlTransport.php | 1 + src/Parameters/CreateMeetingParameters.php | 1 + src/Parameters/MetaParameters.php | 1 + src/Parameters/UserDataParameters.php | 1 + src/Responses/BaseResponseAsJson.php | 2 +- 11 files changed, 27 insertions(+), 15 deletions(-) diff --git a/composer.json b/composer.json index 30d48549..faf69532 100644 --- a/composer.json +++ b/composer.json @@ -114,7 +114,7 @@ "cs-test": "tools/php-cs-fixer fix --dry-run --allow-risky=yes", "psalm": "tools/psalm --threads=1", "psalm-clear": "tools/psalm --clear-cache && tools/psalm --clear-global-cache", - "psalm-fix": "tools/psalm --alter --issues=InvalidReturnType,InvalidNullableReturnType,MissingParamType,InvalidFalsableReturnType", + "psalm-fix": "tools/psalm --alter --issues=InvalidReturnType,InvalidNullableReturnType,MissingParamType,InvalidFalsableReturnType,MissingOverrideAttribute", "phpstan": "tools/phpstan analyse", "rector": "tools/rector process --dry-run src/ tests/", "rector-fix": "tools/rector process src/ tests/", diff --git a/psalm.xml b/psalm.xml index 7c0333df..27372f7a 100644 --- a/psalm.xml +++ b/psalm.xml @@ -5,6 +5,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://getpsalm.org/schema/config" xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd" + findUnusedCode="false" > diff --git a/src/Http/SetCookie.php b/src/Http/SetCookie.php index af895158..429e528b 100644 --- a/src/Http/SetCookie.php +++ b/src/Http/SetCookie.php @@ -110,6 +110,7 @@ public function __construct(array $data = []) } } + #[\Override] public function __toString(): string { $str = $this->data['Name'].'='.$this->data['Value'].'; '; @@ -126,8 +127,12 @@ public function __toString(): string return rtrim($str, '; '); } - /** @return array */ - public function toArray(): array + /** + * @return (bool|int|string|null)[]|null + * + * @psalm-return array|null + */ + public function toArray(): ?array { return $this->data; } @@ -135,7 +140,7 @@ public function toArray(): array /** * Get the cookie name. */ - public function getName(): string + public function getName(): string|bool|int|null { return $this->data['Name']; } @@ -153,7 +158,7 @@ public function setName(string $name): void /** * Get the cookie value. */ - public function getValue(): ?string + public function getValue(): string|bool|int|null { return $this->data['Value']; } @@ -161,9 +166,9 @@ public function getValue(): ?string /** * Set the cookie value. * - * @param string $value Cookie value + * @param string|bool|int|null $value Cookie value */ - public function setValue(string $value): void + public function setValue(string|bool|int|null $value): void { $this->data['Value'] = $value; } @@ -171,7 +176,7 @@ public function setValue(string $value): void /** * Get the domain. */ - public function getDomain(): ?string + public function getDomain(): string|bool|int|null { return $this->data['Domain']; } @@ -187,7 +192,7 @@ public function setDomain(string $domain): void /** * Get the path. */ - public function getPath(): string + public function getPath(): string|bool|int|null { return $this->data['Path']; } @@ -223,7 +228,7 @@ public function setMaxAge(int $maxAge): void /** * The UNIX timestamp when the cookie Expires. */ - public function getExpires(): int|string|null + public function getExpires(): bool|int|string|null { return $this->data['Expires']; } @@ -243,7 +248,7 @@ public function setExpires(int|string $timestamp): void /** * Get whether or not this is a secure cookie. */ - public function getSecure(): ?bool + public function getSecure(): string|bool|int|null { return $this->data['Secure']; } @@ -261,7 +266,7 @@ public function setSecure(bool $secure): void /** * Get whether or not this is a session cookie. */ - public function getDiscard(): ?bool + public function getDiscard(): string|bool|int|null { return $this->data['Discard']; } diff --git a/src/Http/Transport/Bridge/PsrHttpClient/PsrHttpClientTransport.php b/src/Http/Transport/Bridge/PsrHttpClient/PsrHttpClientTransport.php index 2db4c8de..ed9f94ab 100644 --- a/src/Http/Transport/Bridge/PsrHttpClient/PsrHttpClientTransport.php +++ b/src/Http/Transport/Bridge/PsrHttpClient/PsrHttpClientTransport.php @@ -76,6 +76,7 @@ public function __construct(private ClientInterface $httpClient, private Request { } + #[\Override] public function request(TransportRequest $request): TransportResponse { if ('' !== $payload = $request->getPayload()) { diff --git a/src/Http/Transport/Bridge/SymfonyHttpClient/SymfonyHttpClientTransport.php b/src/Http/Transport/Bridge/SymfonyHttpClient/SymfonyHttpClientTransport.php index d0b3e5fd..6c093a13 100644 --- a/src/Http/Transport/Bridge/SymfonyHttpClient/SymfonyHttpClientTransport.php +++ b/src/Http/Transport/Bridge/SymfonyHttpClient/SymfonyHttpClientTransport.php @@ -83,6 +83,7 @@ public static function create(array $defaultHeaders = [], array $defaultOptions // @codeCoverageIgnoreEnd } + #[\Override] public function request(TransportRequest $request): TransportResponse { $headers = $this->defaultHeaders; @@ -125,7 +126,7 @@ public function request(TransportRequest $request): TransportResponse * @throws RedirectionExceptionInterface * @throws ServerExceptionInterface */ - private static function extractJsessionCookie(ResponseInterface $symfonyResponse): ?string + private static function extractJsessionCookie(ResponseInterface $symfonyResponse): bool|int|string|null { $responseHeaders = $symfonyResponse->getHeaders(); diff --git a/src/Http/Transport/Cookie.php b/src/Http/Transport/Cookie.php index 6f7aae89..511bb6d0 100644 --- a/src/Http/Transport/Cookie.php +++ b/src/Http/Transport/Cookie.php @@ -33,7 +33,7 @@ final class Cookie /** * @param string[] $headerValues */ - public static function extractJsessionId(array $headerValues): ?string + public static function extractJsessionId(array $headerValues): bool|int|string|null { foreach ($headerValues as $headerValue) { $cookie = SetCookie::fromString($headerValue); diff --git a/src/Http/Transport/CurlTransport.php b/src/Http/Transport/CurlTransport.php index 903fe4d3..524f48e8 100644 --- a/src/Http/Transport/CurlTransport.php +++ b/src/Http/Transport/CurlTransport.php @@ -78,6 +78,7 @@ public static function createWithDefaultOptions(array $additionalCurlOptions = [ // @codeCoverageIgnoreEnd } + #[\Override] public function request(TransportRequest $request): TransportResponse { // @codeCoverageIgnoreStart diff --git a/src/Parameters/CreateMeetingParameters.php b/src/Parameters/CreateMeetingParameters.php index a903daaf..0c763a26 100644 --- a/src/Parameters/CreateMeetingParameters.php +++ b/src/Parameters/CreateMeetingParameters.php @@ -452,6 +452,7 @@ public function addPresentationsModule(SimpleXMLElementExtended $xml): void } } + #[\Override] public function getHTTPQuery(): string { $queries = $this->getHTTPQueryArray(); diff --git a/src/Parameters/MetaParameters.php b/src/Parameters/MetaParameters.php index 2adab816..14dc0c99 100644 --- a/src/Parameters/MetaParameters.php +++ b/src/Parameters/MetaParameters.php @@ -42,6 +42,7 @@ public function addMeta(string $key, bool|string $value): static return $this; } + #[\Override] protected function getHTTPQueryArray(): array { $properties = parent::getHTTPQueryArray(); diff --git a/src/Parameters/UserDataParameters.php b/src/Parameters/UserDataParameters.php index a1f788f0..4529a147 100644 --- a/src/Parameters/UserDataParameters.php +++ b/src/Parameters/UserDataParameters.php @@ -42,6 +42,7 @@ public function addUserData(string $key, bool|string $value): self return $this; } + #[\Override] protected function getHTTPQueryArray(): array { $properties = parent::getHTTPQueryArray(); diff --git a/src/Responses/BaseResponseAsJson.php b/src/Responses/BaseResponseAsJson.php index 77b8fa56..aff7bebd 100644 --- a/src/Responses/BaseResponseAsJson.php +++ b/src/Responses/BaseResponseAsJson.php @@ -43,7 +43,7 @@ public function __construct($rawJson) $this->data = json_decode($rawJson); } - public function getRawJson(): string + public function getRawJson(): string|false { return json_encode($this->data); } From 259685f13f29ab98279cae528299d6220fba933a Mon Sep 17 00:00:00 2001 From: Samuel Weirich <4281791+SamuelWei@users.noreply.github.com> Date: Tue, 21 Jul 2026 14:11:03 +0200 Subject: [PATCH 4/4] Fix phpstan --- phpstan.neon | 2 + src/Http/SetCookie.php | 30 +- src/Http/Transport/CurlTransport.php | 2 +- src/Parameters/CreateMeetingParameters.php | 285 +++++++++--------- tests/bootstrap.php | 20 +- .../Http/Transport/CurlTransportTest.php | 4 +- tests/unit/Http/SetCookieTest.php | 2 +- .../SymfonyHttpClientTransportTest.php | 36 +-- tests/unit/Util/ArrayHelperTest.php | 10 +- 9 files changed, 180 insertions(+), 211 deletions(-) diff --git a/phpstan.neon b/phpstan.neon index 9110ad71..4817ce70 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -9,6 +9,8 @@ parameters: bootstrapFiles: - tools/bootstrap.php ignoreErrors: + - + identifier: method.alreadyNarrowedType - message: '#^Offset ''input'' does not exist on array\{\}\.$#' path: tests/integration/Http/Transport/CurlTransportTest.php diff --git a/src/Http/SetCookie.php b/src/Http/SetCookie.php index 429e528b..99302b05 100644 --- a/src/Http/SetCookie.php +++ b/src/Http/SetCookie.php @@ -50,7 +50,7 @@ final class SetCookie implements \Stringable /** * @var array Cookie data */ - private ?array $data; + private array $data; /** * Create a new SetCookie object from a string. @@ -96,7 +96,7 @@ public static function fromString(string $cookie): self } /** - * @param array $data Array of cookie data provided by a Cookie parser + * @param array $data Array of cookie data provided by a Cookie parser */ public function __construct(array $data = []) { @@ -128,11 +128,9 @@ public function __toString(): string } /** - * @return (bool|int|string|null)[]|null - * - * @psalm-return array|null + * @return array */ - public function toArray(): ?array + public function toArray(): array { return $this->data; } @@ -140,7 +138,7 @@ public function toArray(): ?array /** * Get the cookie name. */ - public function getName(): string|bool|int|null + public function getName(): string { return $this->data['Name']; } @@ -158,7 +156,7 @@ public function setName(string $name): void /** * Get the cookie value. */ - public function getValue(): string|bool|int|null + public function getValue(): ?string { return $this->data['Value']; } @@ -166,9 +164,9 @@ public function getValue(): string|bool|int|null /** * Set the cookie value. * - * @param string|bool|int|null $value Cookie value + * @param string $value Cookie value */ - public function setValue(string|bool|int|null $value): void + public function setValue(string $value): void { $this->data['Value'] = $value; } @@ -176,7 +174,7 @@ public function setValue(string|bool|int|null $value): void /** * Get the domain. */ - public function getDomain(): string|bool|int|null + public function getDomain(): ?string { return $this->data['Domain']; } @@ -192,7 +190,7 @@ public function setDomain(string $domain): void /** * Get the path. */ - public function getPath(): string|bool|int|null + public function getPath(): string { return $this->data['Path']; } @@ -228,7 +226,7 @@ public function setMaxAge(int $maxAge): void /** * The UNIX timestamp when the cookie Expires. */ - public function getExpires(): bool|int|string|null + public function getExpires(): ?int { return $this->data['Expires']; } @@ -246,9 +244,9 @@ public function setExpires(int|string $timestamp): void } /** - * Get whether or not this is a secure cookie. + * Get whether this is a secure cookie. */ - public function getSecure(): string|bool|int|null + public function getSecure(): ?bool { return $this->data['Secure']; } @@ -266,7 +264,7 @@ public function setSecure(bool $secure): void /** * Get whether or not this is a session cookie. */ - public function getDiscard(): string|bool|int|null + public function getDiscard(): ?bool { return $this->data['Discard']; } diff --git a/src/Http/Transport/CurlTransport.php b/src/Http/Transport/CurlTransport.php index 524f48e8..fea68831 100644 --- a/src/Http/Transport/CurlTransport.php +++ b/src/Http/Transport/CurlTransport.php @@ -194,7 +194,7 @@ private static function getHeadersAndContentFromCurlHandle(\CurlHandle $curlHand { $headers = []; - curl_setopt($curlHandle, \CURLOPT_HEADER, 1); + curl_setopt($curlHandle, \CURLOPT_HEADER, true); $responseContent = curl_exec($curlHandle); // @codeCoverageIgnoreStart diff --git a/src/Parameters/CreateMeetingParameters.php b/src/Parameters/CreateMeetingParameters.php index 0c763a26..4af0c92a 100644 --- a/src/Parameters/CreateMeetingParameters.php +++ b/src/Parameters/CreateMeetingParameters.php @@ -28,148 +28,148 @@ use BigBlueButton\Util\SimpleXMLElementExtended; /** - * @method string getName() - * @method $this setName(string $name) - * @method string getMeetingID() - * @method $this setMeetingID(string $id) - * @method string getWelcome() - * @method $this setWelcome(string $welcome) - * @method string getDialNumber() - * @method $this setDialNumber(string $dialNumber) - * @method string getVoiceBridge() - * @method $this setVoiceBridge(string $voiceBridge) - * @method string getWebVoice() - * @method $this setWebVoice(string $webVoice) - * @method int getMaxParticipants() - * @method $this setMaxParticipants(int $maxParticipants) - * @method string getLoginURL() - * @method $this setLoginURL(string $loginURL) - * @method string getLogoutURL() - * @method $this setLogoutURL(string $logoutURL) - * @method bool|null isRecord() - * @method $this setRecord(bool $isRecord) - * @method bool|null isNotifyRecordingIsOn() - * @method $this setNotifyRecordingIsOn(bool $isNotifyRecordingIsOn) - * @method bool|null isRemindRecordingIsOn() - * @method $this setRemindRecordingIsOn(bool $remindRecordingIsOn) - * @method bool|null isRecordFullDurationMedia() - * @method $this setRecordFullDurationMedia(bool $recordFullDurationMedia) - * @method int getDuration() - * @method $this setDuration(int $duration) - * @method string getParentMeetingID() - * @method $this setParentMeetingID(string $parentMeetingID) - * @method int getSequence() - * @method $this setSequence(int $sequence) - * @method bool|null isFreeJoin() - * @method $this setFreeJoin(bool $isFreeJoin) - * @method bool|null isBreakoutRoomsPrivateChatEnabled() - * @method $this setBreakoutRoomsPrivateChatEnabled(bool $isBreakoutRoomsPrivateChatEnabled) - * @method bool|null isBreakoutRoomsRecord() - * @method $this setBreakoutRoomsRecord(bool $isBreakoutRoomsRecord) - * @method string getModeratorOnlyMessage() - * @method $this setModeratorOnlyMessage(string $message) - * @method bool|null isAutoStartRecording() - * @method $this setAutoStartRecording(bool $isAutoStartRecording) - * @method bool|null isAllowStartStopRecording() - * @method $this setAllowStartStopRecording(bool $isAllow) - * @method bool|null isWebcamsOnlyForModerator() - * @method $this setWebcamsOnlyForModerator(bool $isWebcamsOnlyForModerator) - * @method string getLogo() - * @method $this setLogo(string $logo) - * @method string getDarklogo() - * @method $this setDarklogo(string $darklogo) - * @method string getBannerText() - * @method $this setBannerText(string $bannerText) - * @method string getBannerColor() - * @method $this setBannerColor(string $bannerColor) - * @method string getCopyright() - * @method $this setCopyright(string $copyright) - * @method bool|null isMuteOnStart() - * @method $this setMuteOnStart(bool $isMuteOnStart) - * @method bool|null isAllowModsToUnmuteUsers() - * @method $this setAllowModsToUnmuteUsers(bool $isAllowModsToUnmuteUsers) - * @method bool|null isLockSettingsDisableCam() - * @method $this setLockSettingsDisableCam(bool $isLockSettingsDisableCam) - * @method bool|null isLockSettingsDisableMic() - * @method $this setLockSettingsDisableMic(bool $isLockSettingsDisableMic) - * @method bool|null isLockSettingsDisablePrivateChat() - * @method $this setLockSettingsDisablePrivateChat(bool $isLockSettingsDisablePrivateChat) - * @method bool|null isLockSettingsDisablePublicChat() - * @method $this setLockSettingsDisablePublicChat(bool $isLockSettingsDisablePublicChat) - * @method bool|null isLockSettingsDisableNotes() - * @method $this setLockSettingsDisableNotes(bool $isLockSettingsDisableNotes) - * @method bool|null isLockSettingsLockedLayout() - * @method $this setLockSettingsLockedLayout(bool $isLockSettingsLockedLayout) - * @method bool|null isLockSettingsHideUserList() - * @method $this setLockSettingsHideUserList(bool $isLockSettingsHideUserList) - * @method bool|null isLockSettingsLockOnJoin() - * @method $this setLockSettingsLockOnJoin(bool $isLockSettingsLockOnJoin) - * @method bool|null isLockSettingsLockOnJoinConfigurable() - * @method $this setLockSettingsLockOnJoinConfigurable(bool $isLockSettingsLockOnJoinConfigurable) - * @method $this setLockSettingsHideViewersCursor(bool $isLockSettingsHideViewersCursor) - * @method bool|null isLockSettingsHideViewersCursor() - * @method string getGuestPolicy() - * @method $this setGuestPolicy(string $guestPolicy) - * @method bool|null isMeetingKeepEvents() - * @method $this setMeetingKeepEvents(bool $isMeetingKeepEvents) - * @method bool|null isEndWhenNoModerator() - * @method $this setEndWhenNoModerator(bool $isEndWhenNoModerator) - * @method int getEndWhenNoModeratorDelayInMinutes() - * @method $this setEndWhenNoModeratorDelayInMinutes(int $endWhenNoModeratorDelayInMinutes) - * @method int getMeetingExpireIfNoUserJoinedInMinutes() - * @method $this setMeetingExpireIfNoUserJoinedInMinutes(int $meetingExpireIfNoUserJoinedInMinutes) - * @method int getMeetingExpireWhenLastUserLeftInMinutes() - * @method $this setMeetingExpireWhenLastUserLeftInMinutes(int $meetingExpireWhenLastUserLeftInMinutes) - * @method string getMeetingLayout() - * @method $this setMeetingLayout(MeetingLayout $meetingLayout) - * @method string getMeetingEndedURL() - * @method $this setMeetingEndedURL(string $meetingEndedURL) - * @method int getLearningDashboardCleanupDelayInMinutes() - * @method $this setLearningDashboardCleanupDelayInMinutes(int $learningDashboardCleanupDelayInMinutes) - * @method bool|null isAllowModsToEjectCameras() - * @method $this setAllowModsToEjectCameras(bool $isAllowModsToEjectCameras) - * @method bool|null isAllowRequestsWithoutSession() - * @method $this setAllowRequestsWithoutSession(bool $isAllowRequestsWithoutSession) - * @method bool|null isAllowPromoteGuestToModerator() - * @method $this setAllowPromoteGuestToModerator(bool $isAllowPromoteGuestToModerator) - * @method int getUserCameraCap() - * @method $this setUserCameraCap(int $cap) - * @method int getMeetingCameraCap() - * @method $this setMeetingCameraCap(int $cap) - * @method array getDisabledFeatures() - * @method $this setDisabledFeatures(array $disabledFeatures) - * @method array getDisabledFeaturesExclude() - * @method $this setDisabledFeaturesExclude(array $disabledFeaturesExclude) - * @method bool|null isPreUploadedPresentationOverrideDefault() - * @method $this setPreUploadedPresentationOverrideDefault(bool $preUploadedPresentationOverrideDefault) - * @method string getPresentationUploadExternalUrl() - * @method $this setPresentationUploadExternalUrl(string $presentationUploadExternalUrl) - * @method string getPresentationUploadExternalDescription() - * @method $this setPresentationUploadExternalDescription(string $presentationUploadExternalDescription) - * @method string getPreUploadedPresentation() - * @method $this setPreUploadedPresentation(string $preUploadedPresentation) - * @method string getPreUploadedPresentationName() - * @method $this setPreUploadedPresentationName(string $preUploadedPresentationName) - * @method int|null getMaxNumPages() - * @method $this setMaxNumPages(int $maxNumPages) - * @method string getPluginManifests() - * @method $this setPluginManifests(string $pluginManifests) - * @method string getPluginManifestsFetchUrl() - * @method $this setPluginManifestsFetchUrl(string $pluginManifestsFetchUrl) - * @method bool|null isPresentationConversionCacheEnabled() - * @method $this setPresentationConversionCacheEnabled(bool $presentationConversionCacheEnabled) - * @method bool|null isAllowOverrideClientSettingsOnCreateCall() - * @method $this setAllowOverrideClientSettingsOnCreateCall(bool $allowOverrideClientSettingsOnCreateCall) - * @method string getClientSettingsOverride() - * @method $this setClientSettingsOverride(string $clientSettingsOverride) - * @method string getClientSettingsOverrideJsonUrl() - * @method $this setClientSettingsOverrideJsonUrl(string $clientSettingsOverrideJsonUrl) - * @method bool|null isMultiUserWhiteboardEnabled() - * @method $this setMultiUserWhiteboardEnabled(bool $multiUserWhiteboardEnabled) - * @method string getSharedNotesEditor() - * @method $this setSharedNotesEditor(string $sharedNotesEditor) - * @method string getSharedNotesInitialContentJsonUrl() - * @method $this setSharedNotesInitialContentJsonUrl(string $sharedNotesInitialContentJsonUrl) + * @method string getName() + * @method $this setName(string $name) + * @method string getMeetingID() + * @method $this setMeetingID(string $id) + * @method string getWelcome() + * @method $this setWelcome(string $welcome) + * @method string getDialNumber() + * @method $this setDialNumber(string $dialNumber) + * @method string getVoiceBridge() + * @method $this setVoiceBridge(string $voiceBridge) + * @method string getWebVoice() + * @method $this setWebVoice(string $webVoice) + * @method int getMaxParticipants() + * @method $this setMaxParticipants(int $maxParticipants) + * @method string getLoginURL() + * @method $this setLoginURL(string $loginURL) + * @method string getLogoutURL() + * @method $this setLogoutURL(string $logoutURL) + * @method bool|null isRecord() + * @method $this setRecord(bool $isRecord) + * @method bool|null isNotifyRecordingIsOn() + * @method $this setNotifyRecordingIsOn(bool $isNotifyRecordingIsOn) + * @method bool|null isRemindRecordingIsOn() + * @method $this setRemindRecordingIsOn(bool $remindRecordingIsOn) + * @method bool|null isRecordFullDurationMedia() + * @method $this setRecordFullDurationMedia(bool $recordFullDurationMedia) + * @method int getDuration() + * @method $this setDuration(int $duration) + * @method string getParentMeetingID() + * @method $this setParentMeetingID(string $parentMeetingID) + * @method int getSequence() + * @method $this setSequence(int $sequence) + * @method bool|null isFreeJoin() + * @method $this setFreeJoin(bool $isFreeJoin) + * @method bool|null isBreakoutRoomsPrivateChatEnabled() + * @method $this setBreakoutRoomsPrivateChatEnabled(bool $isBreakoutRoomsPrivateChatEnabled) + * @method bool|null isBreakoutRoomsRecord() + * @method $this setBreakoutRoomsRecord(bool $isBreakoutRoomsRecord) + * @method string getModeratorOnlyMessage() + * @method $this setModeratorOnlyMessage(string $message) + * @method bool|null isAutoStartRecording() + * @method $this setAutoStartRecording(bool $isAutoStartRecording) + * @method bool|null isAllowStartStopRecording() + * @method $this setAllowStartStopRecording(bool $isAllow) + * @method bool|null isWebcamsOnlyForModerator() + * @method $this setWebcamsOnlyForModerator(bool $isWebcamsOnlyForModerator) + * @method string getLogo() + * @method $this setLogo(string $logo) + * @method string getDarklogo() + * @method $this setDarklogo(string $darklogo) + * @method string getBannerText() + * @method $this setBannerText(string $bannerText) + * @method string getBannerColor() + * @method $this setBannerColor(string $bannerColor) + * @method string getCopyright() + * @method $this setCopyright(string $copyright) + * @method bool|null isMuteOnStart() + * @method $this setMuteOnStart(bool $isMuteOnStart) + * @method bool|null isAllowModsToUnmuteUsers() + * @method $this setAllowModsToUnmuteUsers(bool $isAllowModsToUnmuteUsers) + * @method bool|null isLockSettingsDisableCam() + * @method $this setLockSettingsDisableCam(bool $isLockSettingsDisableCam) + * @method bool|null isLockSettingsDisableMic() + * @method $this setLockSettingsDisableMic(bool $isLockSettingsDisableMic) + * @method bool|null isLockSettingsDisablePrivateChat() + * @method $this setLockSettingsDisablePrivateChat(bool $isLockSettingsDisablePrivateChat) + * @method bool|null isLockSettingsDisablePublicChat() + * @method $this setLockSettingsDisablePublicChat(bool $isLockSettingsDisablePublicChat) + * @method bool|null isLockSettingsDisableNotes() + * @method $this setLockSettingsDisableNotes(bool $isLockSettingsDisableNotes) + * @method bool|null isLockSettingsLockedLayout() + * @method $this setLockSettingsLockedLayout(bool $isLockSettingsLockedLayout) + * @method bool|null isLockSettingsHideUserList() + * @method $this setLockSettingsHideUserList(bool $isLockSettingsHideUserList) + * @method bool|null isLockSettingsLockOnJoin() + * @method $this setLockSettingsLockOnJoin(bool $isLockSettingsLockOnJoin) + * @method bool|null isLockSettingsLockOnJoinConfigurable() + * @method $this setLockSettingsLockOnJoinConfigurable(bool $isLockSettingsLockOnJoinConfigurable) + * @method $this setLockSettingsHideViewersCursor(bool $isLockSettingsHideViewersCursor) + * @method bool|null isLockSettingsHideViewersCursor() + * @method string getGuestPolicy() + * @method $this setGuestPolicy(string $guestPolicy) + * @method bool|null isMeetingKeepEvents() + * @method $this setMeetingKeepEvents(bool $isMeetingKeepEvents) + * @method bool|null isEndWhenNoModerator() + * @method $this setEndWhenNoModerator(bool $isEndWhenNoModerator) + * @method int getEndWhenNoModeratorDelayInMinutes() + * @method $this setEndWhenNoModeratorDelayInMinutes(int $endWhenNoModeratorDelayInMinutes) + * @method int getMeetingExpireIfNoUserJoinedInMinutes() + * @method $this setMeetingExpireIfNoUserJoinedInMinutes(int $meetingExpireIfNoUserJoinedInMinutes) + * @method int getMeetingExpireWhenLastUserLeftInMinutes() + * @method $this setMeetingExpireWhenLastUserLeftInMinutes(int $meetingExpireWhenLastUserLeftInMinutes) + * @method string getMeetingLayout() + * @method $this setMeetingLayout(MeetingLayout $meetingLayout) + * @method string getMeetingEndedURL() + * @method $this setMeetingEndedURL(string $meetingEndedURL) + * @method int getLearningDashboardCleanupDelayInMinutes() + * @method $this setLearningDashboardCleanupDelayInMinutes(int $learningDashboardCleanupDelayInMinutes) + * @method bool|null isAllowModsToEjectCameras() + * @method $this setAllowModsToEjectCameras(bool $isAllowModsToEjectCameras) + * @method bool|null isAllowRequestsWithoutSession() + * @method $this setAllowRequestsWithoutSession(bool $isAllowRequestsWithoutSession) + * @method bool|null isAllowPromoteGuestToModerator() + * @method $this setAllowPromoteGuestToModerator(bool $isAllowPromoteGuestToModerator) + * @method int getUserCameraCap() + * @method $this setUserCameraCap(int $cap) + * @method int getMeetingCameraCap() + * @method $this setMeetingCameraCap(int $cap) + * @method array getDisabledFeatures() + * @method $this setDisabledFeatures(array $disabledFeatures) + * @method array getDisabledFeaturesExclude() + * @method $this setDisabledFeaturesExclude(array $disabledFeaturesExclude) + * @method bool|null isPreUploadedPresentationOverrideDefault() + * @method $this setPreUploadedPresentationOverrideDefault(bool $preUploadedPresentationOverrideDefault) + * @method string getPresentationUploadExternalUrl() + * @method $this setPresentationUploadExternalUrl(string $presentationUploadExternalUrl) + * @method string getPresentationUploadExternalDescription() + * @method $this setPresentationUploadExternalDescription(string $presentationUploadExternalDescription) + * @method string getPreUploadedPresentation() + * @method $this setPreUploadedPresentation(string $preUploadedPresentation) + * @method string getPreUploadedPresentationName() + * @method $this setPreUploadedPresentationName(string $preUploadedPresentationName) + * @method int|null getMaxNumPages() + * @method $this setMaxNumPages(int $maxNumPages) + * @method string getPluginManifests() + * @method $this setPluginManifests(string $pluginManifests) + * @method string getPluginManifestsFetchUrl() + * @method $this setPluginManifestsFetchUrl(string $pluginManifestsFetchUrl) + * @method bool|null isPresentationConversionCacheEnabled() + * @method $this setPresentationConversionCacheEnabled(bool $presentationConversionCacheEnabled) + * @method bool|null isAllowOverrideClientSettingsOnCreateCall() + * @method $this setAllowOverrideClientSettingsOnCreateCall(bool $allowOverrideClientSettingsOnCreateCall) + * @method string getClientSettingsOverride() + * @method $this setClientSettingsOverride(string $clientSettingsOverride) + * @method string getClientSettingsOverrideJsonUrl() + * @method $this setClientSettingsOverrideJsonUrl(string $clientSettingsOverrideJsonUrl) + * @method bool|null isMultiUserWhiteboardEnabled() + * @method $this setMultiUserWhiteboardEnabled(bool $multiUserWhiteboardEnabled) + * @method string getSharedNotesEditor() + * @method $this setSharedNotesEditor(string $sharedNotesEditor) + * @method string getSharedNotesInitialContentJsonUrl() + * @method $this setSharedNotesInitialContentJsonUrl(string $sharedNotesInitialContentJsonUrl) */ class CreateMeetingParameters extends MetaParameters { @@ -445,7 +445,6 @@ public function addPresentationsModule(SimpleXMLElementExtended $xml): void } else { $document = $module->addChild('document'); $document->addAttribute('name', $nameOrUrl); - /* @phpstan-ignore-next-line */ $document[0] = $content; } } diff --git a/tests/bootstrap.php b/tests/bootstrap.php index d22a1a3c..c4419793 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -30,21 +30,5 @@ // Load environment $dotenv = new Dotenv(); -// usePutenv was not available in version 3.4 und early 4.x versions of symfony/dotenv, so make it optional here -if (method_exists($dotenv, 'usePutenv')) { - $dotenv->usePutenv(true); -} - -// loadEnv was not available in version 3.4 und early 4.x versions of symfony/dotenv, so make it optional here -if (method_exists($dotenv, 'loadEnv')) { - $dotenv->loadEnv(dirname(__DIR__).'/.env'); -} else { - $files = []; - foreach ([dirname(__DIR__).'/.env', dirname(__DIR__).'/.env.local'] as $file) { - if (file_exists($file)) { - $files[] = $file; - } - } - - $dotenv->load(...$files); -} +$dotenv->usePutenv(); +$dotenv->loadEnv(dirname(__DIR__).'/.env'); diff --git a/tests/integration/Http/Transport/CurlTransportTest.php b/tests/integration/Http/Transport/CurlTransportTest.php index fb51caa5..4b094207 100644 --- a/tests/integration/Http/Transport/CurlTransportTest.php +++ b/tests/integration/Http/Transport/CurlTransportTest.php @@ -41,7 +41,9 @@ public static function setUpBeforeClass(): void TestHttpServer::start(); } - /** @return array> */ + /** + * @return iterable> + */ public static function provideBadResponseCodes(): iterable { // cURL does not understand codes below 200 properly. diff --git a/tests/unit/Http/SetCookieTest.php b/tests/unit/Http/SetCookieTest.php index 91a3b834..7ef3765e 100644 --- a/tests/unit/Http/SetCookieTest.php +++ b/tests/unit/Http/SetCookieTest.php @@ -181,7 +181,7 @@ public function testMatchesPath(string $cookiePath, string $requestPath, bool $i self::assertSame($isMatch, $cookie->matchesPath($requestPath)); } - /** @return array> */ + /** @return array> */ public static function cookieValidateProvider(): array { return [ diff --git a/tests/unit/Http/Transport/Bridge/SymfonyHttpClient/SymfonyHttpClientTransportTest.php b/tests/unit/Http/Transport/Bridge/SymfonyHttpClient/SymfonyHttpClientTransportTest.php index 10dc5a99..4e571871 100644 --- a/tests/unit/Http/Transport/Bridge/SymfonyHttpClient/SymfonyHttpClientTransportTest.php +++ b/tests/unit/Http/Transport/Bridge/SymfonyHttpClient/SymfonyHttpClientTransportTest.php @@ -63,9 +63,7 @@ public function testRequestWithoutPayload(): void $this->assertSame('Hi Marty!', $response->getBody(), 'body is OK'); $this->assertSame('MartyMcFlySession', $response->getSessionId(), 'session ID is OK'); - if (method_exists($mockHttpClient, 'getRequestsCount')) { - $this->assertSame(1, $mockHttpClient->getRequestsCount(), 'one request was made'); - } + $this->assertSame(1, $mockHttpClient->getRequestsCount(), 'one request was made'); } public function testRequestWithPayload(): void @@ -87,9 +85,7 @@ public function testRequestWithPayload(): void $this->assertSame('Hi Marty!', $response->getBody(), 'body is OK'); $this->assertSame('MartyMcFlySession', $response->getSessionId(), 'session ID is OK'); - if (method_exists($mockHttpClient, 'getRequestsCount')) { - $this->assertSame(1, $mockHttpClient->getRequestsCount(), 'one request was made'); - } + $this->assertSame(1, $mockHttpClient->getRequestsCount(), 'one request was made'); } public function testRequestWithoutCookie(): void @@ -110,9 +106,7 @@ public function testRequestWithoutCookie(): void $this->assertSame('Hi Marty!', $response->getBody(), 'body is OK'); $this->assertNull($response->getSessionId(), 'session ID is OK'); - if (method_exists($mockHttpClient, 'getRequestsCount')) { - $this->assertSame(1, $mockHttpClient->getRequestsCount(), 'one request was made'); - } + $this->assertSame(1, $mockHttpClient->getRequestsCount(), 'one request was made'); } public function testRequestWithEmptyCookie(): void @@ -133,9 +127,7 @@ public function testRequestWithEmptyCookie(): void $this->assertSame('Hi Marty!', $response->getBody(), 'body is OK'); $this->assertNull($response->getSessionId(), 'session ID is OK'); - if (method_exists($mockHttpClient, 'getRequestsCount')) { - $this->assertSame(1, $mockHttpClient->getRequestsCount(), 'one request was made'); - } + $this->assertSame(1, $mockHttpClient->getRequestsCount(), 'one request was made'); } public function testRequestWithDefaultHeaders(): void @@ -163,9 +155,7 @@ public function testRequestWithDefaultHeaders(): void $this->assertSame('Hi Marty!', $response->getBody(), 'body is OK'); $this->assertSame('MartyMcFlySession', $response->getSessionId(), 'session ID is OK'); - if (method_exists($mockHttpClient, 'getRequestsCount')) { - $this->assertSame(1, $mockHttpClient->getRequestsCount(), 'one request was made'); - } + $this->assertSame(1, $mockHttpClient->getRequestsCount(), 'one request was made'); } public function testRequestWithDefaultOptions(): void @@ -196,9 +186,7 @@ public function testRequestWithDefaultOptions(): void $this->assertSame('Hi Marty!', $response->getBody(), 'body is OK'); $this->assertSame('MartyMcFlySession', $response->getSessionId(), 'session ID is OK'); - if (method_exists($mockHttpClient, 'getRequestsCount')) { - $this->assertSame(1, $mockHttpClient->getRequestsCount(), 'one request was made'); - } + $this->assertSame(1, $mockHttpClient->getRequestsCount(), 'one request was made'); } /** @return iterable> */ @@ -237,9 +225,7 @@ public function testRequestWithBadResponseCode(int $badCode): void try { $transport->request($request); } finally { - if (method_exists($mockHttpClient, 'getRequestsCount')) { - $this->assertSame(1, $mockHttpClient->getRequestsCount(), 'one request was made'); - } + $this->assertSame(1, $mockHttpClient->getRequestsCount(), 'one request was made'); } } @@ -275,9 +261,7 @@ public function testRequestWithBadResponseException(HttpExceptionInterface $exce try { $transport->request($request); } finally { - if (method_exists($mockHttpClient, 'getRequestsCount')) { - $this->assertSame(0, $mockHttpClient->getRequestsCount(), 'no full request was made'); - } + $this->assertSame(0, $mockHttpClient->getRequestsCount(), 'no full request was made'); } } @@ -302,9 +286,7 @@ public function testRequestWithTransportException(): void try { $transport->request($request); } finally { - if (method_exists($mockHttpClient, 'getRequestsCount')) { - $this->assertSame(0, $mockHttpClient->getRequestsCount(), 'no full request was made'); - } + $this->assertSame(0, $mockHttpClient->getRequestsCount(), 'no full request was made'); } } } diff --git a/tests/unit/Util/ArrayHelperTest.php b/tests/unit/Util/ArrayHelperTest.php index 9c1f5b75..192e5ea6 100644 --- a/tests/unit/Util/ArrayHelperTest.php +++ b/tests/unit/Util/ArrayHelperTest.php @@ -29,7 +29,9 @@ */ final class ArrayHelperTest extends TestCase { - /** @return iterable> */ + /** + * @return iterable, 1: array, 2: bool, 3: array}> + */ public static function provideArrays(): iterable { yield 'simple flat arrays' => [ @@ -61,9 +63,9 @@ public static function provideArrays(): iterable /** * @dataProvider provideArrays * - * @param array $input1 - * @param array $input2 - * @param array $output + * @param array $input1 + * @param array $input2 + * @param array $output */ public function testMergeRecursive(array $input1, array $input2, bool $reorderNested, array $output): void {