From 22ddeb00c4e831b87cae3f52a2909b68ed5c0472 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 21 Jul 2026 10:17:35 +0200 Subject: [PATCH 1/3] chore: Apply rector fixes Signed-off-by: Joas Schilling --- lib/Model/SessionMapper.php | 2 +- lib/Service/RecordingService.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Model/SessionMapper.php b/lib/Model/SessionMapper.php index fd4439be172..b50a935cce5 100644 --- a/lib/Model/SessionMapper.php +++ b/lib/Model/SessionMapper.php @@ -92,7 +92,7 @@ public function findSessionIdsWithoutAttendee(int $limit): array { $result = $query->executeQuery(); $ids = []; - while ($row = $result->fetch()) { + while ($row = $result->fetchAssociative()) { $ids[] = (int)$row['id']; } $result->closeCursor(); diff --git a/lib/Service/RecordingService.php b/lib/Service/RecordingService.php index 1d9d0168335..4c3cca3ad3e 100644 --- a/lib/Service/RecordingService.php +++ b/lib/Service/RecordingService.php @@ -141,7 +141,7 @@ public function store(Room $room, string $owner, array $file): void { $this->appConfig->deleteAppValue(self::APPCONFIG_PREFIX . $room->getToken()); try { $participant = $this->participantService->getParticipant($room, $owner); - } catch (ParticipantNotFoundException $e) { + } catch (ParticipantNotFoundException) { throw new InvalidArgumentException('owner_participant'); } From 211ccad507792ccfa9eba8ccb6505c0cd607f86c Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 21 Jul 2026 10:40:09 +0200 Subject: [PATCH 2/3] ci(rector): Update list of rector rules Signed-off-by: Joas Schilling --- rector.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rector.php b/rector.php index a0f803acbc5..e5794c09bd6 100644 --- a/rector.php +++ b/rector.php @@ -22,7 +22,9 @@ ->withPhpSets(php83: true) ->withSets([ PHPUnitSetList::PHPUNIT_120, - NextcloudSets::NEXTCLOUD_34, + PHPUnitSetList::PHPUNIT_NARROW_ASSERTS, + PHPUnitSetList::PHPUNIT_MOCK_TO_STUB, + NextcloudSets::NEXTCLOUD_35, ]) ->withSkip([ ReplaceInjectedMethodCallRector::class, From 2ff762d5036565882cd73fba41bc774c7067b329 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 21 Jul 2026 10:42:37 +0200 Subject: [PATCH 3/3] ci(rector): Automatically send rector PRs Signed-off-by: Joas Schilling --- .github/workflows/rector-apply.yml | 69 ++++++++++++++++++++++++ .github/workflows/rector-apply.yml.patch | 9 ++++ composer.json | 2 +- 3 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/rector-apply.yml create mode 100644 .github/workflows/rector-apply.yml.patch diff --git a/.github/workflows/rector-apply.yml b/.github/workflows/rector-apply.yml new file mode 100644 index 00000000000..c98cbe37213 --- /dev/null +++ b/.github/workflows/rector-apply.yml @@ -0,0 +1,69 @@ +# This workflow is provided via the organization template repository +# +# https://github.com/nextcloud/.github +# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization +# +# SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors +# SPDX-License-Identifier: MIT + +name: Apply rector changes + +on: + workflow_dispatch: + schedule: + # At 14:30 on Sundays + - cron: '30 14 * * 0' + +permissions: + contents: read + +jobs: + build: + runs-on: ubuntu-latest + + name: rector-apply + + steps: + - name: Checkout + id: checkout + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + with: + persist-credentials: false + ref: ${{ github.event.repository.default_branch }} + + - name: Get php version + id: versions + uses: icewind1991/nextcloud-version-matrix@8a7bac6300b2f0f3100088b297995a229558ddba # v1.3.2 + + - name: Set up php${{ steps.versions.outputs.php-min }} + uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2 + with: + php-version: ${{ steps.versions.outputs.php-min }} + extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite + coverage: none + ini-file: development + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Remove nextcloud/ocp + run: | + composer remove nextcloud/ocp --dev --no-scripts + + - name: Install composer dependencies + uses: ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda # 4.0.0 + + - name: Rector + run: composer run rector + + - name: Create Pull Request + uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1 + with: + token: ${{ secrets.COMMAND_BOT_PAT }} + commit-message: 'refactor: Apply rector changes' + committer: GitHub + author: nextcloud-command + signoff: true + branch: automated/noid/rector-changes + title: 'Apply rector changes' + labels: | + technical debt diff --git a/.github/workflows/rector-apply.yml.patch b/.github/workflows/rector-apply.yml.patch new file mode 100644 index 00000000000..282a5f340a6 --- /dev/null +++ b/.github/workflows/rector-apply.yml.patch @@ -0,0 +1,9 @@ +diff --git a/.github/workflows/rector-apply.yml b/.github/workflows/rector-apply.yml +index c61c5b1062..c98cbe3721 100644 +--- a/.github/workflows/rector-apply.yml ++++ b/.github/workflows/rector-apply.yml +@@ -67,4 +67,3 @@ jobs: + title: 'Apply rector changes' + labels: | + technical debt +- 3. to review diff --git a/composer.json b/composer.json index 8b790506858..9e4d5020665 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,7 @@ "lint": "find . -type f -name '*.php' -not -path './vendor/*' -not -path './vendor-bin/*' -not -path './lib/Vendor/*' -not -path './build/*' -not -path './tests/integration/vendor/*' -not -path 'tests/stubs/*' -print0 | xargs -0 -n200 -P$(nproc) php -l", "openapi": "generate-spec && (npm run ts:generate || echo 'Please manually regenerate the typescript OpenAPI models')", "rector:check": "rector --dry-run", - "rector:fix": "rector && php-cs-fixer fix", + "rector": "rector && php-cs-fixer fix", "psalm": "psalm --no-cache --threads=$(nproc)", "psalm:dev": "@psalm", "psalm:update-baseline": "psalm --threads=1 --update-baseline --set-baseline=tests/psalm-baseline.xml",