Skip to content

Commit

Permalink
fix lint errors
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Hartmann <[email protected]>
  • Loading branch information
Chartman123 committed Oct 21, 2024
1 parent 18bc722 commit 190bc42
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
22 changes: 11 additions & 11 deletions lib/Controller/ApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
use OCA\Forms\Db\SubmissionMapper;
use OCA\Forms\Db\UploadedFile;
use OCA\Forms\Db\UploadedFileMapper;
use OCA\Forms\ResponseDefinitions;
use OCA\Forms\Service\ConfigService;
use OCA\Forms\Service\FormsService;
use OCA\Forms\Service\SubmissionService;
Expand Down Expand Up @@ -108,7 +109,6 @@ public function __construct(
/**
* Handle CORS options request by calling parent function
*/
// #[ApiRoute(verb: 'OPTIONS', url: '/api/{apiVersion}/{path}', requirements:
#[ApiRoute(verb: 'OPTIONS', url: '/api/{apiVersion}/{path}', requirements: [
'apiVersion' => 'v3',
'path' => '.+'
Expand All @@ -121,11 +121,11 @@ public function preflightedCors() {
// Forms
/**
* Get all forms available to the user (owned/shared)
*
*
* @param string $type The type of forms to retrieve. Defaults to `owned`.
* Possible values:
* - `owned`: Forms owned by the user.
* - `shared`: Forms shared with the user.
* Possible values:
* - `owned`: Forms owned by the user.
* - `shared`: Forms shared with the user.
* @return DataResponse<array<FormsPartialForm>, Http::STATUS_PARTIAL_CONTENT, array<>>
* @throws OCSBadRequestException wrong Form type supplied
*/
Expand All @@ -136,7 +136,7 @@ public function preflightedCors() {
url: '/api/{apiVersion}/forms',
requirements: [
'apiVersion' => 'v3'
])]
])]
public function getForms(string $type = 'owned'): DataResponse {
$result = [];

Expand Down Expand Up @@ -170,7 +170,7 @@ public function getForms(string $type = 'owned'): DataResponse {
url: '/api/{apiVersion}/forms',
requirements: [
'apiVersion' => 'v3'
])]
])]
public function newForm(?int $fromId = null): DataResponse {
// Check if user is allowed
if (!$this->configService->canCreateForms()) {
Expand Down Expand Up @@ -252,7 +252,7 @@ public function newForm(?int $fromId = null): DataResponse {
requirements: [
'apiVersion' => 'v3',
'formId' => '\d+'
])]
])]
public function getForm(int $formId): DataResponse {
try {
$form = $this->formMapper->findById($formId);
Expand Down Expand Up @@ -289,7 +289,7 @@ public function getForm(int $formId): DataResponse {
requirements: [
'apiVersion' => 'v3',
'formId' => '\d+'
])]
])]
public function updateForm(int $formId, array $keyValuePairs): DataResponse {
$this->logger->debug('Updating form: formId: {formId}, values: {keyValuePairs}', [
'formId' => $formId,
Expand Down Expand Up @@ -372,7 +372,7 @@ public function updateForm(int $formId, array $keyValuePairs): DataResponse {
* @param int $formId the form id
* @return DataResponse<int formId, Http::STATUS_OK, array<>>
* @throws OCSForbiddenException User is not allowed to delete the form
* @throws OCSNotFoundException Form not found
* @throws OCSNotFoundException Form not found
*/
#[CORS()]

Check failure on line 377 in lib/Controller/ApiController.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis

InvalidDocblock

lib/Controller/ApiController.php:377:2: InvalidDocblock: Cannot parse generic type in docblock for OCA\Forms\Controller\ApiController::deleteForm (see https://psalm.dev/008)
#[NoAdminRequired()]
Expand All @@ -382,7 +382,7 @@ public function updateForm(int $formId, array $keyValuePairs): DataResponse {
requirements: [
'apiVersion' => 'v3',
'formId' => '\d+'
])]
])]
public function deleteForm(int $formId): DataResponse {
$this->logger->debug('Delete Form: {formId}', [
'formId' => $formId,
Expand Down
5 changes: 3 additions & 2 deletions lib/ResponseDefinitions.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*
*/

namespace OCA\Forms;
namespace OCA\Forms;

/**
* @psalm-type FormsForm = array{
Expand Down Expand Up @@ -53,4 +53,5 @@
* "state": int
* }
*/
class ResponseDefinitions {}
class ResponseDefinitions {
}

0 comments on commit 190bc42

Please sign in to comment.