Skip to content

Commit 2914a2e

Browse files
Merge pull request #2769 from nextcloud/dependabot/composer/vendor-bin/cs-fixer/main/nextcloud/coding-standard-1.4.0
2 parents 38d2fdb + 3adb419 commit 2914a2e

26 files changed

+103
-94
lines changed

lib/Activity/ActivityManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use OCP\Share\IShare;
1717

1818
class ActivityManager {
19-
19+
2020
public function __construct(
2121
protected string $appName,
2222
private ?string $userId,

lib/Controller/ApiController.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -310,9 +310,9 @@ public function updateForm(int $formId, array $keyValuePairs): DataResponse {
310310

311311
// Don't allow to change params id, hash, ownerId, created, lastUpdated, fileId
312312
if (
313-
key_exists('id', $keyValuePairs) || key_exists('hash', $keyValuePairs) ||
314-
key_exists('ownerId', $keyValuePairs) || key_exists('created', $keyValuePairs) ||
315-
isset($keyValuePairs['fileId']) || key_exists('lastUpdated', $keyValuePairs)
313+
key_exists('id', $keyValuePairs) || key_exists('hash', $keyValuePairs)
314+
|| key_exists('ownerId', $keyValuePairs) || key_exists('created', $keyValuePairs)
315+
|| isset($keyValuePairs['fileId']) || key_exists('lastUpdated', $keyValuePairs)
316316
) {
317317
$this->logger->info('Not allowed to update id, hash, ownerId, created, fileId or lastUpdated');
318318
throw new OCSForbiddenException('Not allowed to update id, hash, ownerId, created, fileId or lastUpdated');

lib/Db/FormMapper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function __construct(
3434
parent::__construct($db, 'forms_v2_forms', Form::class);
3535
}
3636

37-
37+
3838
/**
3939
* @param Entity $entity
4040
* @psalm-param Form $entity

lib/FormsMigrator.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ public function export(IUser $user, IExportDestination $exportDestination, Outpu
9494
// Mark userIds with instance.
9595
foreach ($formData['submissions'] as $sKey => $submission) {
9696
// Anonymous submission or already migrated, just keep it.
97-
if (substr($submission['userId'], 0, 10) === 'anon-user-' ||
98-
substr($submission['userId'], 0, 8) === 'unknown~') {
97+
if (substr($submission['userId'], 0, 10) === 'anon-user-'
98+
|| substr($submission['userId'], 0, 8) === 'unknown~') {
9999
continue;
100100
}
101101

@@ -148,7 +148,7 @@ public function import(IUser $user, IImportSource $importSource, OutputInterface
148148
$form->setSubmitMultiple($formData['submitMultiple']);
149149
$form->setAllowEditSubmissions($formData['allowEditSubmissions']);
150150
$form->setShowExpiration($formData['showExpiration']);
151-
151+
152152
$this->formMapper->insert($form);
153153

154154
$questionIdMap = [];

lib/Migration/Version020300Date20210406114130.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
4646

4747
return $schema;
4848
}
49-
49+
5050
return null;
5151
}
5252

lib/Migration/Version020300Date20210406133704.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ class Version020300Date20210406133704 extends SimpleMigrationStep {
2424
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
2525
/** @var ISchemaWrapper $schema */
2626
$schema = $schemaClosure();
27-
27+
2828
$table = $schema->getTable('forms_v2_questions');
29-
29+
3030
if ($table->hasColumn('mandatory') && $table->hasColumn('is_required')) {
3131
$table->dropColumn('mandatory');
32-
32+
3333
return $schema;
3434
}
3535

lib/Migration/Version030000Date20220414203511.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
3434

3535
return $schema;
3636
}
37-
37+
3838
return null;
3939
}
4040
}

lib/Migration/Version030000Date20220705192811.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
4545

4646
return $schema;
4747
}
48-
48+
4949
return null;
5050
}
5151

lib/Migration/Version030000Date20220707130109.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
2525
$schema = $schemaClosure();
2626

2727
$table = $schema->getTable('forms_v2_forms');
28-
28+
2929
if ($table->hasColumn('submit_once') && $table->hasColumn('submit_multiple')) {
3030
$table->dropColumn('submit_once');
3131
return $schema;

lib/Migration/Version030000Date20220831195000.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
3232

3333
return $schema;
3434
}
35-
35+
3636
return null;
3737
}
3838
}

lib/Migration/Version030100Date20221231100426.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
3838

3939
return $schema;
4040
}
41-
41+
4242
return null;
4343
}
4444
}

lib/Migration/Version030100Date20230123182700.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
3434

3535
return $schema;
3636
}
37-
37+
3838
return null;
3939
}
4040
}

lib/Migration/Version040200Date20240402200139.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function postSchemaChange(IOutput $output, Closure $schemaClosure, array
7070
$qbUpdate->update('forms_v2_forms')
7171
->set('access_enum', $qbUpdate->createParameter('access_enum'))
7272
->where($qbUpdate->expr()->eq('id', $qbUpdate->createParameter('id')));
73-
73+
7474
// Fetch Forms...
7575
$cursor = $qbFetch->executeQuery();
7676

lib/Migration/Version040200Date20240402224725.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
3030
$schema = $schemaClosure();
3131

3232
$table = $schema->getTable('forms_v2_forms');
33-
33+
3434
if ($table->hasColumn('access_json') && $table->hasColumn('access_enum')) {
3535
$table->dropColumn('access_json');
3636
return $schema;

lib/Migration/Version050000Date20241005173955.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function __construct(
2222
protected IDBConnection $db,
2323
) {
2424
}
25-
25+
2626
/**
2727
* @param IOutput $output
2828
* @param Closure(): ISchemaWrapper $schemaClosure

lib/Service/ConfigService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
class ConfigService {
2020
private ?IUser $currentUser;
21-
21+
2222
public function __construct(
2323
protected string $appName,
2424
private IConfig $config,

lib/Service/FormsService.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ public function canDeleteResults(Form $form): bool {
354354
if ($this->isFormArchived($form)) {
355355
return false;
356356
}
357-
357+
358358
// Allow deleting results if the current user has the "results_delete" permission
359359
if (in_array(Constants::PERMISSION_RESULTS_DELETE, $this->getPermissions($form))) {
360360
return true;
@@ -387,8 +387,8 @@ public function canSubmit(Form $form): bool {
387387

388388
// Refuse access, if submitMultiple is not set and user already has taken part.
389389
if (
390-
!$form->getSubmitMultiple() &&
391-
$this->submissionMapper->hasFormSubmissionsByUser($form, $this->currentUser->getUID())
390+
!$form->getSubmitMultiple()
391+
&& $this->submissionMapper->hasFormSubmissionsByUser($form, $this->currentUser->getUID())
392392
) {
393393
return false;
394394
}
@@ -480,10 +480,10 @@ private function isSharedFormShown(Form $form): bool {
480480
}
481481

482482
// Shown if permitAll and showToAll are both set.
483-
if ($form->getAccess()['permitAllUsers'] &&
484-
$form->getAccess()['showToAllUsers'] &&
485-
$this->configService->getAllowPermitAll() &&
486-
$this->configService->getAllowShowToAll()) {
483+
if ($form->getAccess()['permitAllUsers']
484+
&& $form->getAccess()['showToAllUsers']
485+
&& $this->configService->getAllowPermitAll()
486+
&& $this->configService->getAllowShowToAll()) {
487487

488488
return true;
489489
}
@@ -585,9 +585,9 @@ public function notifyNewShares(Form $form, Share $share): void {
585585
'Error while publishing new share activity',
586586
[$e]
587587
);
588-
588+
589589
}
590-
590+
591591
}
592592

593593
/**
@@ -806,8 +806,8 @@ public function areExtraSettingsValid(array $extraSettings, string $questionType
806806
// Special handling of linear scale validation
807807
} elseif ($questionType === Constants::ANSWER_TYPE_LINEARSCALE) {
808808
// Ensure limits are sane
809-
if (isset($extraSettings['optionsLowest']) && ($extraSettings['optionsLowest'] < 0 || $extraSettings['optionsLowest'] > 1) ||
810-
isset($extraSettings['optionsHighest']) && ($extraSettings['optionsHighest'] < 2 || $extraSettings['optionsHighest'] > 10)) {
809+
if (isset($extraSettings['optionsLowest']) && ($extraSettings['optionsLowest'] < 0 || $extraSettings['optionsLowest'] > 1)
810+
|| isset($extraSettings['optionsHighest']) && ($extraSettings['optionsHighest'] < 2 || $extraSettings['optionsHighest'] > 10)) {
811811
return false;
812812
}
813813
}

lib/Service/SubmissionService.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,8 @@ public function getSubmissionsData(Form $form, string $fileFormat, ?File $file =
276276
function (array $carry, Answer $answer) use ($questionPerQuestionId) {
277277
$questionId = $answer->getQuestionId();
278278

279-
if (isset($questionPerQuestionId[$questionId]) &&
280-
$questionPerQuestionId[$questionId]->getType() === Constants::ANSWER_TYPE_FILE) {
279+
if (isset($questionPerQuestionId[$questionId])
280+
&& $questionPerQuestionId[$questionId]->getType() === Constants::ANSWER_TYPE_FILE) {
281281
if (array_key_exists($questionId, $carry)) {
282282
$carry[$questionId]['label'] .= "; \n" . $answer->getText();
283283
} else {
@@ -373,17 +373,17 @@ public function validateSubmission(array $questions, array $answers, string $for
373373
$questionAnswered = array_key_exists($questionId, $answers);
374374

375375
// Check if all required questions have an answer
376-
if ($question['isRequired'] &&
377-
(!$questionAnswered ||
378-
!array_filter($answers[$questionId], static function (string|array $value): bool {
376+
if ($question['isRequired']
377+
&& (!$questionAnswered
378+
|| !array_filter($answers[$questionId], static function (string|array $value): bool {
379379
// file type
380380
if (is_array($value)) {
381381
return !empty($value['uploadedFileId']);
382382
}
383383

384384
return $value !== '';
385-
}) ||
386-
(!empty($question['extraSettings']['allowOtherAnswer']) && !array_filter($answers[$questionId], fn ($value) => $value !== Constants::QUESTION_EXTRASETTINGS_OTHER_PREFIX)))
385+
})
386+
|| (!empty($question['extraSettings']['allowOtherAnswer']) && !array_filter($answers[$questionId], fn ($value) => $value !== Constants::QUESTION_EXTRASETTINGS_OTHER_PREFIX)))
387387
) {
388388
throw new \InvalidArgumentException(sprintf('Question "%s" is required.', $question['text']));
389389
}
@@ -505,10 +505,10 @@ private function validateDateTime(array $answers, string $format, ?string $text
505505
$previousDate = $d;
506506

507507
if ($extraSettings) {
508-
if ((isset($extraSettings['dateMin']) && $d < (new DateTime())->setTimestamp($extraSettings['dateMin'])) ||
509-
(isset($extraSettings['dateMax']) && $d > (new DateTime())->setTimestamp($extraSettings['dateMax'])) ||
510-
(isset($extraSettings['timeMin']) && $d < DateTime::createFromFormat($format, $extraSettings['timeMin'])) ||
511-
(isset($extraSettings['timeMax']) && $d > DateTime::createFromFormat($format, $extraSettings['timeMax']))
508+
if ((isset($extraSettings['dateMin']) && $d < (new DateTime())->setTimestamp($extraSettings['dateMin']))
509+
|| (isset($extraSettings['dateMax']) && $d > (new DateTime())->setTimestamp($extraSettings['dateMax']))
510+
|| (isset($extraSettings['timeMin']) && $d < DateTime::createFromFormat($format, $extraSettings['timeMin']))
511+
|| (isset($extraSettings['timeMax']) && $d > DateTime::createFromFormat($format, $extraSettings['timeMax']))
512512
) {
513513
throw new \InvalidArgumentException(sprintf('Date/time is not in the allowed range for question "%s".', $text));
514514
}

tests/Unit/Activity/ActivityManagerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public function testPublishNewGroupShare() {
7979
$form->setTitle('TestForm-Title');
8080
$form->setHash('abcdefg12345');
8181
$groupId = 'sharedGroup';
82-
82+
8383
$group = $this->createMock(IGroup::class);
8484
$user = $this->createMock(IUser::class);
8585

@@ -154,7 +154,7 @@ public function testPublishNewCircleShare() {
154154

155155
public function testPublishNewCircleShare_circlesDisabled() {
156156
$form = $this->createMock(Form::class);
157-
157+
158158
$this->circlesService->expects($this->once())
159159
->method('getCircleUsers')
160160
->with('circle')

tests/Unit/Activity/ProviderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function setUp(): void {
7373
$this->l10nFactory = $this->createMock(IFactory::class);
7474
$this->validator = $this->createMock(IValidator::class);
7575
$this->circlesService = $this->createMock(CirclesService::class);
76-
76+
7777
$this->urlGenerator->expects($this->any())
7878
->method('linkToRouteAbsolute')
7979
->with('forms.page.index')

0 commit comments

Comments
 (0)