diff --git a/phpstan.neon b/phpstan.neon
index 9110ad71..f5dcb9ed 100644
--- a/phpstan.neon
+++ b/phpstan.neon
@@ -4,7 +4,7 @@ parameters:
- tests
parallel:
maximumNumberOfProcesses: 4
- level: 6
+ level: 7
inferPrivatePropertyTypeFromConstructor: true
bootstrapFiles:
- tools/bootstrap.php
diff --git a/src/Parameters/CreateMeetingParameters.php b/src/Parameters/CreateMeetingParameters.php
index 85ace07d..8350efc8 100644
--- a/src/Parameters/CreateMeetingParameters.php
+++ b/src/Parameters/CreateMeetingParameters.php
@@ -363,7 +363,7 @@ public function getPresentations(): array
return $this->presentations;
}
- public function getPresentationsAsXML(): string|false
+ public function getPresentationsAsXML(): string
{
$result = '';
@@ -389,6 +389,10 @@ public function getPresentationsAsXML(): string|false
$result = $xml->asXML();
}
+ if (false === $result) {
+ throw new \LogicException('Could not generate XML.');
+ }
+
return $result;
}
diff --git a/src/Parameters/InsertDocumentParameters.php b/src/Parameters/InsertDocumentParameters.php
index 538266e6..aee8ad32 100644
--- a/src/Parameters/InsertDocumentParameters.php
+++ b/src/Parameters/InsertDocumentParameters.php
@@ -52,7 +52,7 @@ public function removePresentation(string $url): self
return $this;
}
- public function getPresentationsAsXML(): string|false
+ public function getPresentationsAsXML(): string
{
$result = '';
@@ -77,6 +77,10 @@ public function getPresentationsAsXML(): string|false
$result = $xml->asXML();
}
+ if (false === $result) {
+ throw new \LogicException('Could not generate XML.');
+ }
+
return $result;
}
}
diff --git a/tests/unit/Parameters/CreateMeetingParametersTest.php b/tests/unit/Parameters/CreateMeetingParametersTest.php
index a9389a61..2f2adc25 100644
--- a/tests/unit/Parameters/CreateMeetingParametersTest.php
+++ b/tests/unit/Parameters/CreateMeetingParametersTest.php
@@ -216,7 +216,13 @@ public function testGetPresentationsAsXMLWithFile(): void
{
$params = $this->generateCreateParams();
$createMeetingParams = $this->getCreateMock($params);
- $createMeetingParams->addPresentation('bbb_logo.png', file_get_contents(__DIR__.\DIRECTORY_SEPARATOR.'..'.\DIRECTORY_SEPARATOR.'..'.\DIRECTORY_SEPARATOR.'fixtures'.\DIRECTORY_SEPARATOR.'bbb_logo.png'));
+
+ $content = file_get_contents(
+ __DIR__ . \DIRECTORY_SEPARATOR . '..' . \DIRECTORY_SEPARATOR . '..' . \DIRECTORY_SEPARATOR . 'fixtures' . \DIRECTORY_SEPARATOR . 'bbb_logo.png'
+ );
+ $this->assertIsString($content);
+
+ $createMeetingParams->addPresentation('bbb_logo.png', $content);
$this->assertXmlStringEqualsXmlFile(__DIR__.\DIRECTORY_SEPARATOR.'..'.\DIRECTORY_SEPARATOR.'..'.\DIRECTORY_SEPARATOR.'fixtures'.\DIRECTORY_SEPARATOR.'presentation_with_embedded_file.xml', $createMeetingParams->getPresentationsAsXML());
}
diff --git a/tests/unit/Responses/GetMeetingsResponseTest.php b/tests/unit/Responses/GetMeetingsResponseTest.php
index f39df44a..d9d506a9 100644
--- a/tests/unit/Responses/GetMeetingsResponseTest.php
+++ b/tests/unit/Responses/GetMeetingsResponseTest.php
@@ -85,12 +85,16 @@ public function testGetMeetingsNoMeetings(): void
{
// scalelite response no meetings
$xml = simplexml_load_string('SUCCESSnoMeetingsNo meetings were found on this server.');
+ $this->assertInstanceOf(\SimpleXMLElement::class, $xml);
+
$this->meetings = new GetMeetingsResponse($xml);
$this->assertEquals('SUCCESS', $this->meetings->getReturnCode());
$this->assertCount(0, $this->meetings->getMeetings());
// normal bbb response no meetings
$xml = simplexml_load_string('SUCCESSnoMeetingsNo meetings were found on this server.');
+ $this->assertInstanceOf(\SimpleXMLElement::class, $xml);
+
$this->meetings = new GetMeetingsResponse($xml);
$this->assertEquals('SUCCESS', $this->meetings->getReturnCode());
$this->assertCount(0, $this->meetings->getMeetings());
diff --git a/tests/unit/Responses/GetRecordingsResponseTest.php b/tests/unit/Responses/GetRecordingsResponseTest.php
index d95d8e6b..38bc372a 100644
--- a/tests/unit/Responses/GetRecordingsResponseTest.php
+++ b/tests/unit/Responses/GetRecordingsResponseTest.php
@@ -128,7 +128,10 @@ public function testHasNoRecordings(): void
There are no recordings for the meeting(s).
';
- $response = new GetRecordingsResponse(simplexml_load_string($xml));
+ $xml = simplexml_load_string($xml);
+ $this->assertInstanceOf(\SimpleXMLElement::class, $xml);
+
+ $response = new GetRecordingsResponse($xml);
$this->assertTrue($response->hasNoRecordings());
}
diff --git a/tests/unit/Responses/HooksDestroyResponseTest.php b/tests/unit/Responses/HooksDestroyResponseTest.php
index 7704ee1a..4838e7cf 100644
--- a/tests/unit/Responses/HooksDestroyResponseTest.php
+++ b/tests/unit/Responses/HooksDestroyResponseTest.php
@@ -53,6 +53,7 @@ public function testHooksDestroyResponseTypes(): void
public function testHookDestroyMissingHook(): void
{
$xml = simplexml_load_string('FAILEDdestroyMissingHookThe hook informed was not found.');
+ $this->assertInstanceOf(\SimpleXMLElement::class, $xml);
$destroyResponse = new HooksDestroyResponse($xml);
$this->assertTrue($destroyResponse->failed());
@@ -62,6 +63,7 @@ public function testHookDestroyMissingHook(): void
public function testHookDestroyHookError(): void
{
$xml = simplexml_load_string('FAILEDdestroyHookErrorAn error happened while removing your hook. Check the logs.');
+ $this->assertInstanceOf(\SimpleXMLElement::class, $xml);
$destroyResponse = new HooksDestroyResponse($xml);
$this->assertTrue($destroyResponse->failed());
diff --git a/tests/unit/Responses/InsertDocumentResponseTest.php b/tests/unit/Responses/InsertDocumentResponseTest.php
index 01d1012e..62899ad6 100644
--- a/tests/unit/Responses/InsertDocumentResponseTest.php
+++ b/tests/unit/Responses/InsertDocumentResponseTest.php
@@ -41,7 +41,12 @@ public function testIsMeetingRunningResponseContent(): void
{
$this->assertEquals('SUCCESS', $this->running->getReturnCode());
- $this->assertEquals('SUCCESS', $this->minifyString($this->running->getRawXml()->asXML()));
+ $xml = $this->running->getRawXml()->asXML();
+ $this->assertIsString($xml);
+
+ $this->assertEquals('SUCCESS', $this->minifyString(
+ $xml
+ ));
}
public function testIsMeetingRunningResponseTypes(): void
diff --git a/tests/unit/Responses/IsMeetingRunningResponseTest.php b/tests/unit/Responses/IsMeetingRunningResponseTest.php
index 70dce13f..003cf7f2 100644
--- a/tests/unit/Responses/IsMeetingRunningResponseTest.php
+++ b/tests/unit/Responses/IsMeetingRunningResponseTest.php
@@ -43,7 +43,12 @@ public function testIsMeetingRunningResponseContent(): void
$this->assertEquals('SUCCESS', $this->running->getReturnCode());
$this->assertTrue($this->running->isRunning());
- $this->assertEquals('SUCCESStrue', $this->minifyString($this->running->getRawXml()->asXML()));
+ $xml = $this->running->getRawXml()->asXML();
+ $this->assertIsString($xml);
+
+ $this->assertEquals('SUCCESStrue', $this->minifyString(
+ $xml
+ ));
}
public function testIsMeetingRunningResponseTypes(): void
diff --git a/tests/unit/Util/ArrayHelperTest.php b/tests/unit/Util/ArrayHelperTest.php
index 9ea33908..2e0cc9e7 100644
--- a/tests/unit/Util/ArrayHelperTest.php
+++ b/tests/unit/Util/ArrayHelperTest.php
@@ -29,7 +29,7 @@
*/
final class ArrayHelperTest extends TestCase
{
- /** @return iterable> */
+ /** @return iterable> */
public function provideArrays(): iterable
{
yield 'simple flat arrays' => [