From 2de9117dabfc3d4550e892203b75c0f8a2f7dd91 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 21 Sep 2024 01:09:17 +0000 Subject: [PATCH 1/2] Chore(deps): Bump nextcloud/coding-standard in /vendor-bin/cs-fixer Bumps [nextcloud/coding-standard](https://github.com/nextcloud/coding-standard) from 1.2.3 to 1.3.1. - [Release notes](https://github.com/nextcloud/coding-standard/releases) - [Changelog](https://github.com/nextcloud/coding-standard/blob/master/CHANGELOG.md) - [Commits](https://github.com/nextcloud/coding-standard/compare/v1.2.3...v1.3.1) --- updated-dependencies: - dependency-name: nextcloud/coding-standard dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- vendor-bin/cs-fixer/composer.lock | 59 +++++++++++++++++++++++++++---- 1 file changed, 53 insertions(+), 6 deletions(-) diff --git a/vendor-bin/cs-fixer/composer.lock b/vendor-bin/cs-fixer/composer.lock index 460f080d6..40009afc1 100644 --- a/vendor-bin/cs-fixer/composer.lock +++ b/vendor-bin/cs-fixer/composer.lock @@ -6,21 +6,68 @@ ], "content-hash": "f2391d39f330ebebb8b0d663f5b60927", "packages": [ + { + "name": "kubawerlos/php-cs-fixer-custom-fixers", + "version": "v3.22.0", + "source": { + "type": "git", + "url": "https://github.com/kubawerlos/php-cs-fixer-custom-fixers.git", + "reference": "8701394f0c7cd450ac4fa577d24589122c1d5d5e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/kubawerlos/php-cs-fixer-custom-fixers/zipball/8701394f0c7cd450ac4fa577d24589122c1d5d5e", + "reference": "8701394f0c7cd450ac4fa577d24589122c1d5d5e", + "shasum": "" + }, + "require": { + "ext-filter": "*", + "ext-tokenizer": "*", + "friendsofphp/php-cs-fixer": "^3.61.1", + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.6.4 || ^10.5.29" + }, + "type": "library", + "autoload": { + "psr-4": { + "PhpCsFixerCustomFixers\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Kuba Werłos", + "email": "werlos@gmail.com" + } + ], + "description": "A set of custom fixers for PHP CS Fixer", + "support": { + "issues": "https://github.com/kubawerlos/php-cs-fixer-custom-fixers/issues", + "source": "https://github.com/kubawerlos/php-cs-fixer-custom-fixers/tree/v3.22.0" + }, + "time": "2024-08-16T20:44:35+00:00" + }, { "name": "nextcloud/coding-standard", - "version": "v1.2.3", + "version": "v1.3.1", "source": { "type": "git", "url": "https://github.com/nextcloud/coding-standard.git", - "reference": "bc9c53a5306114b60c4363057aff9c2ed10a54da" + "reference": "e88acb0df6217b808d1632286ddfec9267a102e4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nextcloud/coding-standard/zipball/bc9c53a5306114b60c4363057aff9c2ed10a54da", - "reference": "bc9c53a5306114b60c4363057aff9c2ed10a54da", + "url": "https://api.github.com/repos/nextcloud/coding-standard/zipball/e88acb0df6217b808d1632286ddfec9267a102e4", + "reference": "e88acb0df6217b808d1632286ddfec9267a102e4", "shasum": "" }, "require": { + "kubawerlos/php-cs-fixer-custom-fixers": "^3.22", "php": "^7.3|^8.0", "php-cs-fixer/shim": "^3.17" }, @@ -43,9 +90,9 @@ "description": "Nextcloud coding standards for the php cs fixer", "support": { "issues": "https://github.com/nextcloud/coding-standard/issues", - "source": "https://github.com/nextcloud/coding-standard/tree/v1.2.3" + "source": "https://github.com/nextcloud/coding-standard/tree/v1.3.1" }, - "time": "2024-08-23T14:32:32+00:00" + "time": "2024-09-19T09:07:10+00:00" }, { "name": "php-cs-fixer/shim", From f756024b2acccc40584adee48239ee187b33aaf6 Mon Sep 17 00:00:00 2001 From: Christian Hartmann Date: Sat, 21 Sep 2024 11:28:20 +0200 Subject: [PATCH 2/2] Adjust php files to new CS Signed-off-by: Christian Hartmann --- lib/Activity/Filter.php | 2 +- lib/Activity/Settings/FormsActivitySettings.php | 2 +- lib/BackgroundJob/CleanupUploadedFilesJob.php | 2 +- lib/BackgroundJob/UserDeletedJob.php | 2 +- lib/Capabilities.php | 2 +- lib/Controller/ApiController.php | 4 ++-- lib/Controller/ConfigController.php | 2 +- lib/Db/QuestionMapper.php | 2 +- lib/Db/SubmissionMapper.php | 2 +- lib/FormsMigrator.php | 2 +- lib/Listener/UserDeletedListener.php | 2 +- lib/Service/ConfigService.php | 2 +- lib/Service/FormsService.php | 10 +++++----- lib/Settings/Settings.php | 2 +- lib/Settings/SettingsSection.php | 2 +- license.php | 6 +++--- tests/Integration/Api/ApiV2Test.php | 2 +- tests/Unit/Service/FormsServiceTest.php | 2 +- tests/Unit/Service/SubmissionServiceTest.php | 4 ++-- 19 files changed, 27 insertions(+), 27 deletions(-) diff --git a/lib/Activity/Filter.php b/lib/Activity/Filter.php index 036bc9334..2fb193dd9 100644 --- a/lib/Activity/Filter.php +++ b/lib/Activity/Filter.php @@ -31,7 +31,7 @@ class Filter implements IFilter { public function __construct( protected string $appName, private IL10N $l10n, - private IURLGenerator $urlGenerator + private IURLGenerator $urlGenerator, ) { } diff --git a/lib/Activity/Settings/FormsActivitySettings.php b/lib/Activity/Settings/FormsActivitySettings.php index db1f858e8..376dfeeed 100644 --- a/lib/Activity/Settings/FormsActivitySettings.php +++ b/lib/Activity/Settings/FormsActivitySettings.php @@ -29,7 +29,7 @@ abstract class FormsActivitySettings extends ActivitySettings { public function __construct( protected string $appName, - protected IL10N $l10n + protected IL10N $l10n, ) { } diff --git a/lib/BackgroundJob/CleanupUploadedFilesJob.php b/lib/BackgroundJob/CleanupUploadedFilesJob.php index 1db1568b5..290e1e56e 100644 --- a/lib/BackgroundJob/CleanupUploadedFilesJob.php +++ b/lib/BackgroundJob/CleanupUploadedFilesJob.php @@ -40,7 +40,7 @@ public function __construct( private FormMapper $formMapper, private UploadedFileMapper $uploadedFileMapper, private LoggerInterface $logger, - ITimeFactory $time + ITimeFactory $time, ) { parent::__construct($time); diff --git a/lib/BackgroundJob/UserDeletedJob.php b/lib/BackgroundJob/UserDeletedJob.php index 4c3d9a9ab..67f269a68 100644 --- a/lib/BackgroundJob/UserDeletedJob.php +++ b/lib/BackgroundJob/UserDeletedJob.php @@ -34,7 +34,7 @@ class UserDeletedJob extends QueuedJob { public function __construct( private FormMapper $formMapper, ITimeFactory $time, - private LoggerInterface $logger + private LoggerInterface $logger, ) { parent::__construct($time); } diff --git a/lib/Capabilities.php b/lib/Capabilities.php index 8d294dab0..94b4db1d1 100644 --- a/lib/Capabilities.php +++ b/lib/Capabilities.php @@ -28,7 +28,7 @@ class Capabilities implements ICapability { public function __construct( - private IAppManager $appManager + private IAppManager $appManager, ) { } diff --git a/lib/Controller/ApiController.php b/lib/Controller/ApiController.php index dcb2acf4f..3730069ec 100644 --- a/lib/Controller/ApiController.php +++ b/lib/Controller/ApiController.php @@ -1056,7 +1056,7 @@ public function newSubmission(int $formId, array $answers, string $shareHash = ' // If not logged in, anonymous, or embedded use anonID if (!$this->currentUser || $form->getIsAnonymous()) { - $anonID = 'anon-user-' . hash('md5', strval(time() + rand())); + $anonID = 'anon-user-' . hash('md5', strval(time() + rand())); $submission->setUserId($anonID); } else { $submission->setUserId($this->currentUser->getUID()); @@ -2326,7 +2326,7 @@ public function insertSubmissionLegacy(int $formId, array $answers, string $shar // If not logged in, anonymous, or embedded use anonID if (!$this->currentUser || $form->getIsAnonymous()) { - $anonID = 'anon-user-' . hash('md5', strval(time() + rand())); + $anonID = 'anon-user-' . hash('md5', strval(time() + rand())); $submission->setUserId($anonID); } else { $submission->setUserId($this->currentUser->getUID()); diff --git a/lib/Controller/ConfigController.php b/lib/Controller/ConfigController.php index 6d0211cc8..eb5487270 100644 --- a/lib/Controller/ConfigController.php +++ b/lib/Controller/ConfigController.php @@ -41,7 +41,7 @@ public function __construct( private ConfigService $configService, private IConfig $config, private LoggerInterface $logger, - IRequest $request + IRequest $request, ) { parent::__construct($appName, $request); } diff --git a/lib/Db/QuestionMapper.php b/lib/Db/QuestionMapper.php index 6b38b656f..c56697884 100644 --- a/lib/Db/QuestionMapper.php +++ b/lib/Db/QuestionMapper.php @@ -37,7 +37,7 @@ class QuestionMapper extends QBMapper { public function __construct( IDBConnection $db, - private OptionMapper $optionMapper + private OptionMapper $optionMapper, ) { parent::__construct($db, 'forms_v2_questions', Question::class); } diff --git a/lib/Db/SubmissionMapper.php b/lib/Db/SubmissionMapper.php index 769005a2a..6e9d771ef 100644 --- a/lib/Db/SubmissionMapper.php +++ b/lib/Db/SubmissionMapper.php @@ -42,7 +42,7 @@ class SubmissionMapper extends QBMapper { */ public function __construct( IDBConnection $db, - private AnswerMapper $answerMapper + private AnswerMapper $answerMapper, ) { parent::__construct($db, 'forms_v2_submissions', Submission::class); } diff --git a/lib/FormsMigrator.php b/lib/FormsMigrator.php index 3d24439ab..d0e28b604 100644 --- a/lib/FormsMigrator.php +++ b/lib/FormsMigrator.php @@ -65,7 +65,7 @@ public function __construct( private FormsService $formsService, private SubmissionService $submissionService, private IL10N $l10n, - private IUserManager $userManager + private IUserManager $userManager, ) { } diff --git a/lib/Listener/UserDeletedListener.php b/lib/Listener/UserDeletedListener.php index a60570d35..0c1c7cc27 100644 --- a/lib/Listener/UserDeletedListener.php +++ b/lib/Listener/UserDeletedListener.php @@ -34,7 +34,7 @@ */ class UserDeletedListener implements IEventListener { public function __construct( - private IJobList $jobList + private IJobList $jobList, ) { } diff --git a/lib/Service/ConfigService.php b/lib/Service/ConfigService.php index c947292e3..3b6cca0ef 100644 --- a/lib/Service/ConfigService.php +++ b/lib/Service/ConfigService.php @@ -40,7 +40,7 @@ public function __construct( protected string $appName, private IConfig $config, private IGroupManager $groupManager, - IUserSession $userSession + IUserSession $userSession, ) { $this->currentUser = $userSession->getUser(); } diff --git a/lib/Service/FormsService.php b/lib/Service/FormsService.php index 0540e27d2..2fcf89661 100644 --- a/lib/Service/FormsService.php +++ b/lib/Service/FormsService.php @@ -760,7 +760,7 @@ public function getFileName(Form $form, string $fileFormat): string { } // TRANSLATORS Appendix for CSV-Export: 'Form Title (responses).csv' - $fileName = $form->getTitle() . ' (' . $this->l10n->t('responses') . ').'.$fileFormat; + $fileName = $form->getTitle() . ' (' . $this->l10n->t('responses') . ').' . $fileFormat; return self::normalizeFileName($fileName); } @@ -768,7 +768,7 @@ public function getFileName(Form $form, string $fileFormat): string { public function getFormUploadedFilesFolderPath(Form $form): string { return implode('/', [ Constants::FILES_FOLDER, - self::normalizeFileName($form->getId().' - '.$form->getTitle()), + self::normalizeFileName($form->getId() . ' - ' . $form->getTitle()), ]); } @@ -777,7 +777,7 @@ public function getUploadedFilePath(Form $form, int $submissionId, int $question return implode('/', [ $this->getFormUploadedFilesFolderPath($form), $submissionId, - self::normalizeFileName($questionId.' - '.($questionName ?: $questionText)) + self::normalizeFileName($questionId . ' - ' . ($questionName ?: $questionText)) ]); } @@ -785,8 +785,8 @@ public function getTemporaryUploadedFilePath(Form $form, Question $question): st return implode('/', [ Constants::UNSUBMITTED_FILES_FOLDER, microtime(true), - self::normalizeFileName($form->getId().' - '.$form->getTitle()), - self::normalizeFileName($question->getId().' - '.($question->getName() ?: $question->getText())) + self::normalizeFileName($form->getId() . ' - ' . $form->getTitle()), + self::normalizeFileName($question->getId() . ' - ' . ($question->getName() ?: $question->getText())) ]); } diff --git a/lib/Settings/Settings.php b/lib/Settings/Settings.php index 5a6eb55ba..ad0a6618d 100644 --- a/lib/Settings/Settings.php +++ b/lib/Settings/Settings.php @@ -37,7 +37,7 @@ public function __construct( private string $appName, private ConfigService $configService, private IGroupManager $groupManager, - private IInitialState $initialState + private IInitialState $initialState, ) { } diff --git a/lib/Settings/SettingsSection.php b/lib/Settings/SettingsSection.php index b2ebd1171..219bf68a6 100644 --- a/lib/Settings/SettingsSection.php +++ b/lib/Settings/SettingsSection.php @@ -32,7 +32,7 @@ class SettingsSection implements IIconSection { public function __construct( private IL10N $l10n, - private IURLGenerator $urlGenerator + private IURLGenerator $urlGenerator, ) { } diff --git a/license.php b/license.php index 1b97357f5..6d32070b9 100644 --- a/license.php +++ b/license.php @@ -133,10 +133,10 @@ public function writeAuthorsFile() { … '; $authors = implode(PHP_EOL, array_map(function ($author) { - return ' - '.$author; + return ' - ' . $author; }, $this->authors)); $template = str_replace('@AUTHORS@', $authors, $template); - file_put_contents(__DIR__.'/../AUTHORS', $template); + file_put_contents(__DIR__ . '/../AUTHORS', $template); } public function handleFile($path, $gitRoot) { @@ -371,7 +371,7 @@ private function checkCoreMailMap($author) { private function fixInvalidEmail($author) { preg_match('/<(.*)>/', $author, $mailMatch); if (count($mailMatch) === 2 && !filter_var($mailMatch[1], FILTER_VALIDATE_EMAIL)) { - $author = str_replace('<'.$mailMatch[1].'>', '"'.$mailMatch[1].'"', $author); + $author = str_replace('<' . $mailMatch[1] . '>', '"' . $mailMatch[1] . '"', $author); } return $author; } diff --git a/tests/Integration/Api/ApiV2Test.php b/tests/Integration/Api/ApiV2Test.php index 5d77d94ea..f435030f2 100644 --- a/tests/Integration/Api/ApiV2Test.php +++ b/tests/Integration/Api/ApiV2Test.php @@ -1318,7 +1318,7 @@ public function dataInsertSubmission() { public function testInsertSubmission(array $submissionsExpected) { $uploadedFileResponse = $this->http->request('POST', - 'api/v2.5/uploadFiles/'.$this->testForms[0]['id'].'/'.$this->testForms[0]['questions'][2]['id'], + 'api/v2.5/uploadFiles/' . $this->testForms[0]['id'] . '/' . $this->testForms[0]['questions'][2]['id'], [ 'multipart' => [ [ diff --git a/tests/Unit/Service/FormsServiceTest.php b/tests/Unit/Service/FormsServiceTest.php index c72d9596e..987ded790 100644 --- a/tests/Unit/Service/FormsServiceTest.php +++ b/tests/Unit/Service/FormsServiceTest.php @@ -1378,7 +1378,7 @@ public function dataAreExtraSettingsValid() { 'invalid-custom-regex-pattern' => [ 'extraSettings' => [ 'validationType' => 'regex', - 'validationRegex' => '/'.'[/' + 'validationRegex' => '/' . '[/' ], 'questionType' => Constants::ANSWER_TYPE_SHORT, 'rval' => false diff --git a/tests/Unit/Service/SubmissionServiceTest.php b/tests/Unit/Service/SubmissionServiceTest.php index 7a1afcbd3..07f71e2a3 100644 --- a/tests/Unit/Service/SubmissionServiceTest.php +++ b/tests/Unit/Service/SubmissionServiceTest.php @@ -400,7 +400,7 @@ public function dataGetSubmissionsData() { // Expected CSV-Result ' "User ID","User display name","Timestamp","Question 1" - "user1","User 1","1973-11-29T22:33:09+01:00","file1.txt; '.' + "user1","User 1","1973-11-29T22:33:09+01:00","file1.txt; ' . ' file2.txt" ' ], @@ -616,7 +616,7 @@ private function setUpCsvTest(array $questions, array $submissions, string $csvT })); // Prepend BOM-Sequence as Writer does and remove formatting-artefacts of dataProvider. - $dataExpectation = chr(239).chr(187).chr(191) . ltrim(preg_replace('/\t+/', '', $csvText)); + $dataExpectation = chr(239) . chr(187) . chr(191) . ltrim(preg_replace('/\t+/', '', $csvText)); return $dataExpectation; }