Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -56,15 +56,15 @@ 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
### Requirements
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.
Expand Down
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "*",
Expand Down Expand Up @@ -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/",
Expand Down Expand Up @@ -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"
}
}
}
2 changes: 2 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
>
<projectFiles>
<directory name="src" />
Expand Down
15 changes: 9 additions & 6 deletions src/Http/SetCookie.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ final class SetCookie implements \Stringable
/**
* @var array<string,string|bool|int|null> Cookie data
*/
private ?array $data;
private array $data;

/**
* Create a new SetCookie object from a string.
Expand All @@ -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);
Expand Down Expand Up @@ -96,7 +96,7 @@ public static function fromString(string $cookie): self
}

/**
* @param array<string,string|int> $data Array of cookie data provided by a Cookie parser
* @param array<string,string|bool|int|null> $data Array of cookie data provided by a Cookie parser
*/
public function __construct(array $data = [])
{
Expand All @@ -110,6 +110,7 @@ public function __construct(array $data = [])
}
}

#[\Override]
public function __toString(): string
{
$str = $this->data['Name'].'='.$this->data['Value'].'; ';
Expand All @@ -126,7 +127,9 @@ public function __toString(): string
return rtrim($str, '; ');
}

/** @return array<string,string|bool|int|null> */
/**
* @return array<string, bool|int|string|null>
*/
public function toArray(): array
{
return $this->data;
Expand Down Expand Up @@ -223,7 +226,7 @@ public function setMaxAge(int $maxAge): void
/**
* The UNIX timestamp when the cookie Expires.
*/
public function getExpires(): int|string|null
public function getExpires(): ?int
{
return $this->data['Expires'];
}
Expand All @@ -241,7 +244,7 @@ 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(): ?bool
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,16 @@
/**
* 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 = [])
{
}

#[\Override]
public function request(TransportRequest $request): TransportResponse
{
if ('' !== $payload = $request->getPayload()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [])
{
}

Expand All @@ -83,6 +83,7 @@ public static function create(array $defaultHeaders = [], array $defaultOptions
// @codeCoverageIgnoreEnd
}

#[\Override]
public function request(TransportRequest $request): TransportResponse
{
$headers = $this->defaultHeaders;
Expand Down Expand Up @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion src/Http/Transport/Cookie.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 4 additions & 3 deletions src/Http/Transport/CurlTransport.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 = [])
{
}

Expand All @@ -78,6 +78,7 @@ public static function createWithDefaultOptions(array $additionalCurlOptions = [
// @codeCoverageIgnoreEnd
}

#[\Override]
public function request(TransportRequest $request): TransportResponse
{
// @codeCoverageIgnoreStart
Expand Down Expand Up @@ -193,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
Expand Down
Loading
Loading