diff options
Diffstat (limited to 'lib/public')
-rw-r--r-- | lib/public/Files/Template/BeforeGetTemplatesEvent.php | 6 | ||||
-rw-r--r-- | lib/public/Files/Template/Field.php | 20 | ||||
-rw-r--r-- | lib/public/Files/Template/ITemplateManager.php | 4 |
3 files changed, 11 insertions, 19 deletions
diff --git a/lib/public/Files/Template/BeforeGetTemplatesEvent.php b/lib/public/Files/Template/BeforeGetTemplatesEvent.php index c4e23c17c7c..006163c5f7f 100644 --- a/lib/public/Files/Template/BeforeGetTemplatesEvent.php +++ b/lib/public/Files/Template/BeforeGetTemplatesEvent.php @@ -1,5 +1,7 @@ <?php +declare(strict_types=1); + /** * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -18,7 +20,7 @@ class BeforeGetTemplatesEvent extends Event { /** * @param array<Template> $templates - * + * * @since 30.0.0 */ public function __construct(array $templates) { @@ -29,7 +31,7 @@ class BeforeGetTemplatesEvent extends Event { /** * @return array<Template> - * + * * @since 30.0.0 */ public function getTemplates(): array { diff --git a/lib/public/Files/Template/Field.php b/lib/public/Files/Template/Field.php index 49c6a033e5c..ce0ed3176d9 100644 --- a/lib/public/Files/Template/Field.php +++ b/lib/public/Files/Template/Field.php @@ -1,5 +1,7 @@ <?php +declare(strict_types=1); + /** * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later @@ -19,32 +21,18 @@ class Field implements \JsonSerializable { private ?string $tag; /** - * @param string $index - * @param string $content - * @param FieldType $type - * @param ?string $alias - * @param ?int $id - * @param ?string $tag - * * @since 30.0.0 */ - public function __construct($index, $content, $type, $alias = null, $id = null, $tag = null) { + public function __construct(string $index, string $content, FieldType $type, ?string $alias = null, ?int $id = null, ?string $tag = null) { $this->index = $index; $this->alias = $alias; + $this->type = $type; $this->id = $id; $this->tag = $tag; $this->content = $content; - - if ($type instanceof FieldType) { - $this->type = $type; - } else { - $this->type = FieldType::tryFrom($type) ?? throw new InvalidFieldTypeException(); - } } /** - * @return array - * * @since 30.0.0 */ public function jsonSerialize(): array { diff --git a/lib/public/Files/Template/ITemplateManager.php b/lib/public/Files/Template/ITemplateManager.php index 5adcc0ded25..94e0db935e7 100644 --- a/lib/public/Files/Template/ITemplateManager.php +++ b/lib/public/Files/Template/ITemplateManager.php @@ -67,9 +67,11 @@ interface ITemplateManager { /** * @param string $filePath * @param string $templateId + * @param string $templateType + * @param array $templateFields Since 30.0.0 * @return array * @throws GenericFileException * @since 21.0.0 */ - public function createFromTemplate(string $filePath, string $templateId = '', string $templateType = 'user'): array; + public function createFromTemplate(string $filePath, string $templateId = '', string $templateType = 'user', array $templateFields = []): array; } |