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
6 changes: 6 additions & 0 deletions apps/dav/composer/composer/autoload_classmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@
'OCA\\DAV\\CalDAV\\FreeBusy\\FreeBusyGenerator' => $baseDir . '/../lib/CalDAV/FreeBusy/FreeBusyGenerator.php',
'OCA\\DAV\\CalDAV\\ICSExportPlugin\\ICSExportPlugin' => $baseDir . '/../lib/CalDAV/ICSExportPlugin/ICSExportPlugin.php',
'OCA\\DAV\\CalDAV\\IRestorable' => $baseDir . '/../lib/CalDAV/IRestorable.php',
'OCA\\DAV\\CalDAV\\Import\\ImportCountEvent' => $baseDir . '/../lib/CalDAV/Import/ImportCountEvent.php',
'OCA\\DAV\\CalDAV\\Import\\ImportDisposition' => $baseDir . '/../lib/CalDAV/Import/ImportDisposition.php',
'OCA\\DAV\\CalDAV\\Import\\ImportEvent' => $baseDir . '/../lib/CalDAV/Import/ImportEvent.php',
'OCA\\DAV\\CalDAV\\Import\\ImportObjectEvent' => $baseDir . '/../lib/CalDAV/Import/ImportObjectEvent.php',
'OCA\\DAV\\CalDAV\\Import\\ImportService' => $baseDir . '/../lib/CalDAV/Import/ImportService.php',
'OCA\\DAV\\CalDAV\\Import\\TextImporter' => $baseDir . '/../lib/CalDAV/Import/TextImporter.php',
'OCA\\DAV\\CalDAV\\Import\\XmlImporter' => $baseDir . '/../lib/CalDAV/Import/XmlImporter.php',
Expand Down Expand Up @@ -261,6 +265,8 @@
'OCA\\DAV\\Connector\\Sabre\\UserIdHeaderPlugin' => $baseDir . '/../lib/Connector/Sabre/UserIdHeaderPlugin.php',
'OCA\\DAV\\Connector\\Sabre\\ZipFolderPlugin' => $baseDir . '/../lib/Connector/Sabre/ZipFolderPlugin.php',
'OCA\\DAV\\Controller\\BirthdayCalendarController' => $baseDir . '/../lib/Controller/BirthdayCalendarController.php',
'OCA\\DAV\\Controller\\CalendarExportController' => $baseDir . '/../lib/Controller/CalendarExportController.php',
'OCA\\DAV\\Controller\\CalendarImportController' => $baseDir . '/../lib/Controller/CalendarImportController.php',
'OCA\\DAV\\Controller\\DirectController' => $baseDir . '/../lib/Controller/DirectController.php',
'OCA\\DAV\\Controller\\ExampleContentController' => $baseDir . '/../lib/Controller/ExampleContentController.php',
'OCA\\DAV\\Controller\\InvitationResponseController' => $baseDir . '/../lib/Controller/InvitationResponseController.php',
Expand Down
10 changes: 8 additions & 2 deletions apps/dav/composer/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
class ComposerStaticInitDAV
{
public static $prefixLengthsPsr4 = array (
'O' =>
'O' =>
array (
'OCA\\DAV\\' => 8,
),
);

public static $prefixDirsPsr4 = array (
'OCA\\DAV\\' =>
'OCA\\DAV\\' =>
array (
0 => __DIR__ . '/..' . '/../lib',
),
Expand Down Expand Up @@ -102,6 +102,10 @@ class ComposerStaticInitDAV
'OCA\\DAV\\CalDAV\\FreeBusy\\FreeBusyGenerator' => __DIR__ . '/..' . '/../lib/CalDAV/FreeBusy/FreeBusyGenerator.php',
'OCA\\DAV\\CalDAV\\ICSExportPlugin\\ICSExportPlugin' => __DIR__ . '/..' . '/../lib/CalDAV/ICSExportPlugin/ICSExportPlugin.php',
'OCA\\DAV\\CalDAV\\IRestorable' => __DIR__ . '/..' . '/../lib/CalDAV/IRestorable.php',
'OCA\\DAV\\CalDAV\\Import\\ImportCountEvent' => __DIR__ . '/..' . '/../lib/CalDAV/Import/ImportCountEvent.php',
'OCA\\DAV\\CalDAV\\Import\\ImportDisposition' => __DIR__ . '/..' . '/../lib/CalDAV/Import/ImportDisposition.php',
'OCA\\DAV\\CalDAV\\Import\\ImportEvent' => __DIR__ . '/..' . '/../lib/CalDAV/Import/ImportEvent.php',
'OCA\\DAV\\CalDAV\\Import\\ImportObjectEvent' => __DIR__ . '/..' . '/../lib/CalDAV/Import/ImportObjectEvent.php',
'OCA\\DAV\\CalDAV\\Import\\ImportService' => __DIR__ . '/..' . '/../lib/CalDAV/Import/ImportService.php',
'OCA\\DAV\\CalDAV\\Import\\TextImporter' => __DIR__ . '/..' . '/../lib/CalDAV/Import/TextImporter.php',
'OCA\\DAV\\CalDAV\\Import\\XmlImporter' => __DIR__ . '/..' . '/../lib/CalDAV/Import/XmlImporter.php',
Expand Down Expand Up @@ -276,6 +280,8 @@ class ComposerStaticInitDAV
'OCA\\DAV\\Connector\\Sabre\\UserIdHeaderPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/UserIdHeaderPlugin.php',
'OCA\\DAV\\Connector\\Sabre\\ZipFolderPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/ZipFolderPlugin.php',
'OCA\\DAV\\Controller\\BirthdayCalendarController' => __DIR__ . '/..' . '/../lib/Controller/BirthdayCalendarController.php',
'OCA\\DAV\\Controller\\CalendarExportController' => __DIR__ . '/..' . '/../lib/Controller/CalendarExportController.php',
'OCA\\DAV\\Controller\\CalendarImportController' => __DIR__ . '/..' . '/../lib/Controller/CalendarImportController.php',
'OCA\\DAV\\Controller\\DirectController' => __DIR__ . '/..' . '/../lib/Controller/DirectController.php',
'OCA\\DAV\\Controller\\ExampleContentController' => __DIR__ . '/..' . '/../lib/Controller/ExampleContentController.php',
'OCA\\DAV\\Controller\\InvitationResponseController' => __DIR__ . '/..' . '/../lib/Controller/InvitationResponseController.php',
Expand Down
34 changes: 34 additions & 0 deletions apps/dav/lib/CalDAV/Import/ImportCountEvent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

namespace OCA\DAV\CalDAV\Import;

final readonly class ImportCountEvent implements ImportEvent {
public function __construct(
public int $vevent,
public int $vtodo,
public int $vjournal,
) {
}

public function total(): int {
return $this->vevent + $this->vtodo + $this->vjournal;
}

/**
* @return array{type: 'counts', counts: array{VEVENT: int, VTODO: int, VJOURNAL: int}}

Check failure on line 24 in apps/dav/lib/CalDAV/Import/ImportCountEvent.php

View workflow job for this annotation

GitHub Actions / static-code-analysis

InvalidReturnType

apps/dav/lib/CalDAV/Import/ImportCountEvent.php:24:13: InvalidReturnType: The declared return type 'array{counts: array{VEVENT: int, VJOURNAL: int, VTODO: int}, type: 'counts'}' for OCA\DAV\CalDAV\Import\ImportCountEvent::jsonSerialize is incorrect, got 'array{type: 'counts', vevent: int, vjournal: int, vtodo: int}' which is different due to additional array shape fields (vevent, vtodo, vjournal) (see https://psalm.dev/011)
*/
public function jsonSerialize(): array {

Check failure on line 26 in apps/dav/lib/CalDAV/Import/ImportCountEvent.php

View workflow job for this annotation

GitHub Actions / static-code-analysis

MissingOverrideAttribute

apps/dav/lib/CalDAV/Import/ImportCountEvent.php:26:2: MissingOverrideAttribute: Method OCA\DAV\CalDAV\Import\ImportCountEvent::jsonserialize should have the "Override" attribute (see https://psalm.dev/358)
return [

Check failure on line 27 in apps/dav/lib/CalDAV/Import/ImportCountEvent.php

View workflow job for this annotation

GitHub Actions / static-code-analysis

InvalidReturnStatement

apps/dav/lib/CalDAV/Import/ImportCountEvent.php:27:10: InvalidReturnStatement: The inferred type 'array{type: 'counts', vevent: int, vjournal: int, vtodo: int}' does not match the declared return type 'array{counts: array{VEVENT: int, VJOURNAL: int, VTODO: int}, type: 'counts'}' for OCA\DAV\CalDAV\Import\ImportCountEvent::jsonSerialize due to additional array shape fields (vevent, vtodo, vjournal) (see https://psalm.dev/128)
'type' => 'counts',
'vevent' => $this->vevent,
'vtodo' => $this->vtodo,
'vjournal' => $this->vjournal,
];
}
}
16 changes: 16 additions & 0 deletions apps/dav/lib/CalDAV/Import/ImportDisposition.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

namespace OCA\DAV\CalDAV\Import;

enum ImportDisposition: string {
case Created = 'created';
case Updated = 'updated';
case Exists = 'exists';
case Error = 'error';
}
14 changes: 14 additions & 0 deletions apps/dav/lib/CalDAV/Import/ImportEvent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

namespace OCA\DAV\CalDAV\Import;

use JsonSerializable;

interface ImportEvent extends JsonSerializable {
}
39 changes: 39 additions & 0 deletions apps/dav/lib/CalDAV/Import/ImportObjectEvent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

namespace OCA\DAV\CalDAV\Import;

final readonly class ImportObjectEvent implements ImportEvent {
/**
* @param list<string> $errors
*/
public function __construct(
public ?string $identifier,
public ImportDisposition $disposition,
public array $errors = [],
) {
}

public function isError(): bool {
return $this->disposition === ImportDisposition::Error;
}

/**
* @return array{type: 'object', identifier: ?string, disposition: string, errors: list<string>}
*/
public function jsonSerialize(): array {

Check failure on line 29 in apps/dav/lib/CalDAV/Import/ImportObjectEvent.php

View workflow job for this annotation

GitHub Actions / static-code-analysis

MissingOverrideAttribute

apps/dav/lib/CalDAV/Import/ImportObjectEvent.php:29:2: MissingOverrideAttribute: Method OCA\DAV\CalDAV\Import\ImportObjectEvent::jsonserialize should have the "Override" attribute (see https://psalm.dev/358)
$result = [
'type' => 'object',
'identifier' => $this->identifier,
'disposition' => $this->disposition->value,
'errors' => $this->errors,
];

return $result;
}
}
Loading
Loading