Skip to content

Commit

Permalink
fix: PHP formatting
Browse files Browse the repository at this point in the history
Signed-off-by: Elizabeth Danzberger <lizzy7128@tutanota.de>
  • Loading branch information
elzody authored and juliusknorr committed Jul 25, 2024
1 parent f427caf commit 0cc86db
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 15 deletions.
3 changes: 2 additions & 1 deletion apps/files/lib/Controller/TemplateController.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
/**
* @psalm-import-type FilesTemplateFile from ResponseDefinitions
* @psalm-import-type FilesTemplateFileCreator from ResponseDefinitions
* @psalm-import-type FilesTemplateField from ResponseDefinitions
*/
class TemplateController extends OCSController {
protected $templateManager;
Expand Down Expand Up @@ -51,7 +52,7 @@ public function list(): DataResponse {
* @param string $filePath Path of the file
* @param string $templatePath Name of the template
* @param string $templateType Type of the template
* @param array $templateFields Fields of the template
* @param FilesTemplateField[] $templateFields Fields of the template
*
* @return DataResponse<Http::STATUS_OK, FilesTemplateFile, array{}>
* @throws OCSForbiddenException Creating template is not allowed
Expand Down
6 changes: 6 additions & 0 deletions apps/files/lib/ResponseDefinitions.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@
* ratio: ?float,
* actionLabel: string,
* }
*
* @psalm-type FilesTemplateField = array{
* index: string,
* content: string,
* type: string,
* }
*/
class ResponseDefinitions {
}
2 changes: 1 addition & 1 deletion apps/files/src/components/TemplateFiller.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</div>

<div class="template-field-modal__buttons">
<NcLoadingIcon v-if="loading" :name="t('files', 'Submitting fields...')" />
<NcLoadingIcon v-if="loading" :name="t('files', 'Submitting fields')" />
<NcButton aria-label="Submit button"
type="primary"
@click="submit">
Expand Down
6 changes: 4 additions & 2 deletions lib/public/Files/Template/BeforeGetTemplatesEvent.php
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -18,7 +20,7 @@ class BeforeGetTemplatesEvent extends Event {

/**
* @param array<Template> $templates
*
*
* @since 30.0.0
*/
public function __construct(array $templates) {
Expand All @@ -29,7 +31,7 @@ public function __construct(array $templates) {

/**
* @return array<Template>
*
*
* @since 30.0.0
*/
public function getTemplates(): array {
Expand Down
13 changes: 3 additions & 10 deletions lib/public/Files/Template/Field.php
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -19,16 +21,9 @@ 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, string|FieldType $type, ?string $alias = null, ?int $id = null, ?string $tag = null) {
$this->index = $index;
$this->alias = $alias;
$this->id = $id;
Expand All @@ -43,8 +38,6 @@ public function __construct($index, $content, $type, $alias = null, $id = null,
}

/**
* @return array
*
* @since 30.0.0
*/
public function jsonSerialize(): array {
Expand Down
4 changes: 3 additions & 1 deletion lib/public/Files/Template/ITemplateManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,11 @@ public function initializeTemplateDirectory(?string $path = null, ?string $userI
/**
* @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;
}

0 comments on commit 0cc86db

Please sign in to comment.