mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
Improve typing on new methods
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
parent
e29720f9b2
commit
cb0450b5c4
3 changed files with 8 additions and 12 deletions
|
|
@ -42,7 +42,6 @@ use Sabre\VObject\Reader;
|
|||
use function Sabre\Uri\split as uriSplit;
|
||||
|
||||
class CalendarImpl implements ICreateFromString, IHandleImipMessage {
|
||||
|
||||
private CalDavBackend $backend;
|
||||
private Calendar $calendar;
|
||||
/** @var array<string, mixed> */
|
||||
|
|
@ -204,25 +203,25 @@ class CalendarImpl implements ICreateFromString, IHandleImipMessage {
|
|||
/** @var VEvent $vEvent */
|
||||
$vEvent = $vObject->{'VEVENT'};
|
||||
|
||||
if($vObject->{'METHOD'} === null) {
|
||||
if ($vObject->{'METHOD'} === null) {
|
||||
throw new CalendarException('No Method provided for scheduling data. Could not process message');
|
||||
}
|
||||
|
||||
if(!isset($vEvent->{'ORGANIZER'}) || !isset($vEvent->{'ATTENDEE'})) {
|
||||
if (!isset($vEvent->{'ORGANIZER'}) || !isset($vEvent->{'ATTENDEE'})) {
|
||||
throw new CalendarException('Could not process scheduling data, neccessary data missing from ICAL');
|
||||
}
|
||||
$organizer = $vEvent->{'ORGANIZER'}->getValue();
|
||||
$attendee = $vEvent->{'ATTENDEE'}->getValue();
|
||||
|
||||
$iTipMessage->method = $vObject->{'METHOD'}->getValue();
|
||||
if($iTipMessage->method === 'REPLY') {
|
||||
if ($iTipMessage->method === 'REPLY') {
|
||||
if ($server->isExternalAttendee($vEvent->{'ATTENDEE'}->getValue())) {
|
||||
$iTipMessage->recipient = $organizer;
|
||||
} else {
|
||||
$iTipMessage->recipient = $attendee;
|
||||
}
|
||||
$iTipMessage->sender = $attendee;
|
||||
} else if($iTipMessage->method === 'CANCEL') {
|
||||
} elseif ($iTipMessage->method === 'CANCEL') {
|
||||
$iTipMessage->recipient = $attendee;
|
||||
$iTipMessage->sender = $organizer;
|
||||
}
|
||||
|
|
@ -233,7 +232,7 @@ class CalendarImpl implements ICreateFromString, IHandleImipMessage {
|
|||
$schedulingPlugin->scheduleLocalDelivery($iTipMessage);
|
||||
}
|
||||
|
||||
public function getInvitationResponseServer() {
|
||||
public function getInvitationResponseServer(): InvitationResponseServer {
|
||||
return new InvitationResponseServer(false);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@ use Psr\Log\LoggerInterface;
|
|||
use Sabre\VObject\ITip\Message;
|
||||
|
||||
class InvitationResponseServer {
|
||||
|
||||
/** @var \OCA\DAV\Connector\Sabre\Server */
|
||||
public $server;
|
||||
|
||||
|
|
@ -131,7 +130,7 @@ class InvitationResponseServer {
|
|||
return $aclPlugin->getPrincipalByUri($principalUri) === null;
|
||||
}
|
||||
|
||||
public function getServer() {
|
||||
public function getServer(): \OCA\DAV\Connector\Sabre\Server {
|
||||
return $this->server;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,12 +32,10 @@ namespace OCA\DAV\Tests\unit\BackgroundJob;
|
|||
use OCA\DAV\BackgroundJob\CleanupInvitationTokenJob;
|
||||
use OCP\AppFramework\Utility\ITimeFactory;
|
||||
use OCP\DB\QueryBuilder\IQueryBuilder;
|
||||
use OCP\DB\QueryBuilder\IQueryFunction;
|
||||
use OCP\IDBConnection;
|
||||
use Test\TestCase;
|
||||
|
||||
class CleanupInvitationTokenJobTest extends TestCase {
|
||||
|
||||
/** @var IDBConnection | \PHPUnit\Framework\MockObject\MockObject */
|
||||
private $dbConnection;
|
||||
|
||||
|
|
@ -78,11 +76,11 @@ class CleanupInvitationTokenJobTest extends TestCase {
|
|||
[1337, \PDO::PARAM_STR, null, 'namedParameter1337']
|
||||
]);
|
||||
|
||||
$function = $this->createMock(IQueryFunction::class);
|
||||
$function = 'fakefunction';
|
||||
$expr->expects($this->once())
|
||||
->method('lt')
|
||||
->with('expiration', 'namedParameter1337')
|
||||
->willReturn((string)$function);
|
||||
->willReturn($function);
|
||||
|
||||
$this->dbConnection->expects($this->once())
|
||||
->method('getQueryBuilder')
|
||||
|
|
|
|||
Loading…
Reference in a new issue