diff --git a/src/BigBlueButton.php b/src/BigBlueButton.php index 795feb17..3557ba41 100644 --- a/src/BigBlueButton.php +++ b/src/BigBlueButton.php @@ -59,7 +59,6 @@ use BigBlueButton\Responses\PutRecordingTextTrackResponse; use BigBlueButton\Responses\UpdateRecordingsResponse; use BigBlueButton\Util\UrlBuilder; -use SimpleXMLElement; /** * Class BigBlueButton. @@ -113,7 +112,7 @@ class BigBlueButton * * @throws ConfigException */ - public function __construct(?string $baseUrl = null, ?string $secret = null, ?TransportInterface $transport = null, string $hashAlgorithm = 'sha1') + public function __construct(string $baseUrl = null, string $secret = null, TransportInterface $transport = null, string $hashAlgorithm = 'sha1') { // Keeping backward compatibility with older deployed versions $this->securitySecret = $secret ?: getenv('BBB_SECURITY_SALT') ?: getenv('BBB_SECRET'); @@ -485,10 +484,10 @@ public function setJSessionId(string $jSessionId): void * @throws ParsingException * @throws RuntimeException */ - private function processXmlResponse(string $url, string $payload = '', string $contentType = 'application/xml'): SimpleXMLElement + private function processXmlResponse(string $url, string $payload = '', string $contentType = 'application/xml'): \SimpleXMLElement { try { - return new SimpleXMLElement($this->requestUrl($url, $payload, $contentType)); + return new \SimpleXMLElement($this->requestUrl($url, $payload, $contentType)); } catch (NetworkException|RuntimeException $e) { throw $e; } catch (\Throwable $e) { diff --git a/src/Exceptions/BaseException.php b/src/Exceptions/BaseException.php index bd6e8576..68f42be0 100644 --- a/src/Exceptions/BaseException.php +++ b/src/Exceptions/BaseException.php @@ -21,11 +21,9 @@ namespace BigBlueButton\Exceptions; -use Exception; - /** * @abstract since 4.0. */ -class BaseException extends Exception +class BaseException extends \Exception { } diff --git a/src/Http/SetCookie.php b/src/Http/SetCookie.php index b7854496..2416a076 100644 --- a/src/Http/SetCookie.php +++ b/src/Http/SetCookie.php @@ -66,7 +66,7 @@ public static function fromString(string $cookie): self // Explode the cookie string using a series of semicolons $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]) || strpos($pieces[0], '=') === false) { + if (!isset($pieces[0]) || !str_contains($pieces[0], '=')) { return new self($data); } @@ -330,7 +330,7 @@ public function matchesPath(string $requestPath): bool } // Ensure that the cookie-path is a prefix of the request path. - if (0 !== strpos($requestPath, $cookiePath)) { + if (!str_starts_with($requestPath, $cookiePath)) { return false; } diff --git a/src/Http/Transport/Bridge/PsrHttpClient/PsrHttpClientTransport.php b/src/Http/Transport/Bridge/PsrHttpClient/PsrHttpClientTransport.php index a8b10278..9c76ce50 100644 --- a/src/Http/Transport/Bridge/PsrHttpClient/PsrHttpClientTransport.php +++ b/src/Http/Transport/Bridge/PsrHttpClient/PsrHttpClientTransport.php @@ -104,9 +104,6 @@ public function __construct( $this->defaultHeaders = $defaultHeaders; } - /** - * {@inheritDoc} - */ 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 943ac80e..3c91cc5c 100644 --- a/src/Http/Transport/Bridge/SymfonyHttpClient/SymfonyHttpClientTransport.php +++ b/src/Http/Transport/Bridge/SymfonyHttpClient/SymfonyHttpClientTransport.php @@ -101,9 +101,6 @@ public static function create(array $defaultHeaders = [], array $defaultOptions // @codeCoverageIgnoreEnd } - /** - * {@inheritDoc} - */ public function request(TransportRequest $request): TransportResponse { $headers = $this->defaultHeaders; diff --git a/src/Http/Transport/CurlTransport.php b/src/Http/Transport/CurlTransport.php index 40d0b7eb..7a89fb06 100644 --- a/src/Http/Transport/CurlTransport.php +++ b/src/Http/Transport/CurlTransport.php @@ -84,9 +84,6 @@ public static function createWithDefaultOptions(array $additionalCurlOptions = [ // @codeCoverageIgnoreEnd } - /** - * {@inheritDoc} - */ public function request(TransportRequest $request): TransportResponse { // @codeCoverageIgnoreStart @@ -202,7 +199,7 @@ private static function getHeadersAndContentFromCurlHandle($curlHandle): array /* @noinspection PhpElementIsNotAvailableInCurrentPhpVersionInspection */ throw new \InvalidArgumentException(sprintf('$curlHandle must be "%s". "%s" given.', \CurlHandle::class, get_debug_type($curlHandle))); } elseif (\PHP_VERSION_ID < 80000 && !\is_resource($curlHandle)) { - throw new \InvalidArgumentException(sprintf('$curlHandle must be resource. "%s" given.', \is_object($curlHandle) ? \get_class($curlHandle) : \gettype($curlHandle))); + throw new \InvalidArgumentException(sprintf('$curlHandle must be resource. "%s" given.', \is_object($curlHandle) ? $curlHandle::class : \gettype($curlHandle))); } // @codeCoverageIgnoreEnd diff --git a/src/Http/Transport/Header.php b/src/Http/Transport/Header.php index 1a38bf2a..6af9db31 100644 --- a/src/Http/Transport/Header.php +++ b/src/Http/Transport/Header.php @@ -45,7 +45,7 @@ public static function mergeCurlHeaders(array ...$headers): array if (!\is_string($header)) { throw new \InvalidArgumentException(sprintf( 'Non-string header with type "%s" passed.', - \is_object($header) ? \get_class($header) : \gettype($header) + \is_object($header) ? $header::class : \gettype($header) )); } diff --git a/src/Parameters/BaseParameters.php b/src/Parameters/BaseParameters.php index f87e95c5..78899bd3 100644 --- a/src/Parameters/BaseParameters.php +++ b/src/Parameters/BaseParameters.php @@ -34,20 +34,17 @@ public function __call(string $name, array $arguments) if (!preg_match('/^(get|is|set)[A-Z]/', $name)) { throw new \BadFunctionCallException($name.' does not exist'); } - if (strpos($name, 'get') === 0) { + if (str_starts_with($name, 'get')) { return $this->getter(lcfirst(substr($name, 3))); - } elseif (strpos($name, 'is') === 0) { + } elseif (str_starts_with($name, 'is')) { return $this->booleanGetter(lcfirst(substr($name, 2))); - } elseif (strpos($name, 'set') === 0) { + } elseif (str_starts_with($name, 'set')) { return $this->setter(lcfirst(substr($name, 3)), $arguments); } return null; } - /** - * @return mixed - */ protected function getter(string $name) { if (property_exists($this, $name)) { diff --git a/src/Parameters/CreateMeetingParameters.php b/src/Parameters/CreateMeetingParameters.php index 0afa4b0d..ab27a290 100644 --- a/src/Parameters/CreateMeetingParameters.php +++ b/src/Parameters/CreateMeetingParameters.php @@ -476,7 +476,7 @@ public function setGuestPolicyAlwaysAccept(): self return $this; } - public function addPresentation(string $nameOrUrl, ?string $content = null, ?string $filename = null): self + public function addPresentation(string $nameOrUrl, string $content = null, string $filename = null): self { if (!$filename) { $this->presentations[$nameOrUrl] = !$content ?: base64_encode($content); @@ -492,9 +492,6 @@ public function getPresentations(): array return $this->presentations; } - /** - * @return mixed - */ public function getPresentationsAsXML() { $result = ''; @@ -505,7 +502,7 @@ public function getPresentationsAsXML() $module->addAttribute('name', 'presentation'); foreach ($this->presentations as $nameOrUrl => $content) { - if (strpos($nameOrUrl, 'http') === 0) { + if (str_starts_with($nameOrUrl, 'http')) { $presentation = $module->addChild('document'); $presentation->addAttribute('url', $nameOrUrl); if (\is_string($content)) { diff --git a/src/Parameters/InsertDocumentParameters.php b/src/Parameters/InsertDocumentParameters.php index 3542dd9b..7140c447 100644 --- a/src/Parameters/InsertDocumentParameters.php +++ b/src/Parameters/InsertDocumentParameters.php @@ -42,7 +42,7 @@ public function __construct(string $meetingID) $this->meetingID = $meetingID; } - public function addPresentation(string $url, string $filename, ?bool $downloadable = null, ?bool $removable = null): self + public function addPresentation(string $url, string $filename, bool $downloadable = null, bool $removable = null): self { $this->presentations[$url] = [ 'filename' => $filename, @@ -60,9 +60,6 @@ public function removePresentation(string $url): self return $this; } - /** - * @return mixed - */ public function getPresentationsAsXML() { $result = ''; diff --git a/src/Parameters/PutRecordingTextTrackParameters.php b/src/Parameters/PutRecordingTextTrackParameters.php index 95c7cdba..b8fb2fc9 100644 --- a/src/Parameters/PutRecordingTextTrackParameters.php +++ b/src/Parameters/PutRecordingTextTrackParameters.php @@ -62,9 +62,6 @@ class PutRecordingTextTrackParameters extends BaseParameters */ protected $contentType; - /** - * @var mixed - */ protected $file; /** diff --git a/src/Responses/BaseResponseAsJson.php b/src/Responses/BaseResponseAsJson.php index 7d45bba9..66cb6746 100644 --- a/src/Responses/BaseResponseAsJson.php +++ b/src/Responses/BaseResponseAsJson.php @@ -28,9 +28,6 @@ abstract class BaseResponseAsJson public const FAILED = 'FAILED'; public const CHECKSUM_ERROR = 'checksumError'; - /** - * @var mixed - */ protected $data; /** diff --git a/tests/TestCase.php b/tests/TestCase.php index c4f3c5c8..1b66cf1c 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -40,9 +40,6 @@ class TestCase extends \PHPUnit\Framework\TestCase */ protected $faker; - /** - * {@inheritdoc} - */ protected function setUp(): void { parent::setUp(); diff --git a/tests/functional/BigBlueButtonWithCurlTransportTest.php b/tests/functional/BigBlueButtonWithCurlTransportTest.php index 9bfc9a0f..61d40766 100644 --- a/tests/functional/BigBlueButtonWithCurlTransportTest.php +++ b/tests/functional/BigBlueButtonWithCurlTransportTest.php @@ -26,9 +26,6 @@ final class BigBlueButtonWithCurlTransportTest extends AbstractBigBlueButtonFunctionalTest { - /** - * {@inheritDoc} - */ protected static function createTransport(): TransportInterface { return CurlTransport::createWithDefaultOptions(); diff --git a/tests/functional/BigBlueButtonWithPsrHttpClientTransport.php b/tests/functional/BigBlueButtonWithPsrHttpClientTransport.php index 3bebccef..cd5bd19c 100644 --- a/tests/functional/BigBlueButtonWithPsrHttpClientTransport.php +++ b/tests/functional/BigBlueButtonWithPsrHttpClientTransport.php @@ -29,9 +29,6 @@ final class BigBlueButtonWithPsrHttpClientTransport extends AbstractBigBlueButtonFunctionalTest { - /** - * {@inheritDoc} - */ protected static function createTransport(): TransportInterface { $psr17Factory = new Psr17Factory(); diff --git a/tests/functional/BigBlueButtonWithSymfonyHttpClientTransportTest.php b/tests/functional/BigBlueButtonWithSymfonyHttpClientTransportTest.php index 0dc733b8..3f75ce6f 100644 --- a/tests/functional/BigBlueButtonWithSymfonyHttpClientTransportTest.php +++ b/tests/functional/BigBlueButtonWithSymfonyHttpClientTransportTest.php @@ -26,9 +26,6 @@ final class BigBlueButtonWithSymfonyHttpClientTransportTest extends AbstractBigBlueButtonFunctionalTest { - /** - * {@inheritDoc} - */ protected static function createTransport(): TransportInterface { return SymfonyHttpClientTransport::create(); diff --git a/tests/integration/Http/Transport/CurlTransportTest.php b/tests/integration/Http/Transport/CurlTransportTest.php index 8517e011..6f79185a 100644 --- a/tests/integration/Http/Transport/CurlTransportTest.php +++ b/tests/integration/Http/Transport/CurlTransportTest.php @@ -34,9 +34,6 @@ */ final class CurlTransportTest extends TestCase { - /** - * {@inheritDoc} - */ public static function setUpBeforeClass(): void { TestHttpServer::start(); @@ -45,9 +42,9 @@ public static function setUpBeforeClass(): void public function provideBadResponseCodes(): iterable { // cURL does not understand codes below 200 properly. -// foreach (range(100, 199) as $badCode) { -// yield 'HTTP code ' . $badCode => [$badCode]; -// } + // foreach (range(100, 199) as $badCode) { + // yield 'HTTP code ' . $badCode => [$badCode]; + // } foreach (range(300, 599) as $badCode) { yield 'HTTP code '.$badCode => [$badCode]; diff --git a/tests/integration/Http/Transport/Fixtures/web/dump.php b/tests/integration/Http/Transport/Fixtures/web/dump.php index a74efeaa..66a3503f 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 (0 !== strpos($k, 'HTTP_')) { + if (!str_starts_with($k, 'HTTP_')) { continue 2; } // no break diff --git a/tests/unit/Http/Transport/Bridge/PsrHttpClient/PsrHttpClientTransportTest.php b/tests/unit/Http/Transport/Bridge/PsrHttpClient/PsrHttpClientTransportTest.php index 73d97637..dc7fa204 100644 --- a/tests/unit/Http/Transport/Bridge/PsrHttpClient/PsrHttpClientTransportTest.php +++ b/tests/unit/Http/Transport/Bridge/PsrHttpClient/PsrHttpClientTransportTest.php @@ -62,9 +62,6 @@ final class PsrHttpClientTransportTest extends TestCase */ private $streamFactoryMock; - /** - * {@inheritDoc} - */ protected function setUp(): void { $this->transport = $this->createTransport(); diff --git a/tests/unit/Http/Transport/HeaderTest.php b/tests/unit/Http/Transport/HeaderTest.php index 70abb5d5..58837857 100644 --- a/tests/unit/Http/Transport/HeaderTest.php +++ b/tests/unit/Http/Transport/HeaderTest.php @@ -78,15 +78,13 @@ public function provideNonStringHeaders(): iterable /** * @dataProvider provideNonStringHeaders - * - * @param mixed $badHeader */ public function testMergeCurlHeadersWithNonStringHeaders($badHeader): void { $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage(sprintf( 'Non-string header with type "%s" passed.', - \is_object($badHeader) ? \get_class($badHeader) : \gettype($badHeader) + \is_object($badHeader) ? $badHeader::class : \gettype($badHeader) )); Header::mergeCurlHeaders([$badHeader]);