Skip to content

Commit ec86e75

Browse files
committed
Adjust tests to remove phpstan errors
1 parent 7f95ac0 commit ec86e75

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

tests/VObject/EmptyParameterTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,12 @@ public function testRead(): void
2424

2525
$this->assertInstanceOf(Component\VCard::class, $vcard);
2626
$vcard = $vcard->convert(\Sabre\VObject\Document::VCARD30);
27-
$vcard = $vcard->serialize();
27+
$serializedVcard = $vcard->serialize();
2828

29-
$converted = Reader::read($vcard);
29+
$converted = Reader::read($serializedVcard);
3030
$converted->validate();
3131

32+
/* @phpstan-ignore-next-line Offset 'X-INTERN' in isset() does not exist. */
3233
$this->assertTrue(isset($converted->EMAIL['X-INTERN']));
3334

3435
$version = Version::VERSION;
@@ -45,7 +46,7 @@ public function testRead(): void
4546
4647
VCF;
4748

48-
$this->assertEquals($expected, str_replace("\r", '', $vcard));
49+
$this->assertEquals($expected, str_replace("\r", '', $serializedVcard));
4950
}
5051

5152
public function testVCard21Parameter(): void

tests/VObject/ITip/BrokerTester.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Sabre\VObject\InvalidDataException;
99
use Sabre\VObject\ParseException;
1010
use Sabre\VObject\PHPUnitAssertions;
11+
use Sabre\VObject\Property;
1112
use Sabre\VObject\Reader;
1213
use Sabre\VObject\Recur\MaxInstancesExceededException;
1314
use Sabre\VObject\Recur\NoInstancesException;
@@ -85,10 +86,17 @@ public function process(string $input, ?string $old = null, ?string $expected =
8586
$message->sequence = isset($vcal->VEVENT[0]) ? $vcal->VEVENT[0]->SEQUENCE->getValue() : null;
8687

8788
if ('REPLY' === $message->method) {
88-
$message->sender = $mainComponent->ATTENDEE->getValue();
89-
$message->senderName = isset($mainComponent->ATTENDEE['CN']) ? $mainComponent->ATTENDEE['CN']->getValue() : null;
90-
$message->recipient = $mainComponent->ORGANIZER->getValue();
91-
$message->recipientName = isset($mainComponent->ORGANIZER['CN']) ? $mainComponent->ORGANIZER['CN'] : null;
89+
/**
90+
* @var Property<int, mixed> $attendee
91+
*/
92+
$attendee = $mainComponent->ATTENDEE;
93+
$message->sender = $attendee->getValue();
94+
/* @phpstan-ignore-next-line Offset 'CN' in isset() does not exist. Call to an undefined method getValue(). */
95+
$message->senderName = isset($attendee['CN']) ? $attendee['CN']->getValue() : null;
96+
$organizer = $mainComponent->ORGANIZER;
97+
$message->recipient = $organizer->getValue();
98+
/* @phpstan-ignore-next-line Offset 'CN' in isset() does not exist. */
99+
$message->recipientName = isset($organizer['CN']) ? $organizer['CN'] : null;
92100
}
93101

94102
$broker = new Broker();

0 commit comments

Comments
 (0)