From 575c5476ed55c6466cf2cb7ad1ad965f048498af Mon Sep 17 00:00:00 2001 From: Benjamin Gaussorgues Date: Tue, 19 May 2026 10:59:54 +0200 Subject: [PATCH 1/3] chore(deps): upgrade Rector and use Nextcloud rules Signed-off-by: Benjamin Gaussorgues --- rector.php | 11 +- vendor-bin/rector/composer.json | 6 +- vendor-bin/rector/composer.lock | 403 +++++++++++++++++++++++++- vendor/composer/autoload_classmap.php | 1 - vendor/composer/autoload_static.php | 1 - vendor/composer/installed.php | 4 +- 6 files changed, 401 insertions(+), 25 deletions(-) diff --git a/rector.php b/rector.php index ad5ae769..d928a932 100644 --- a/rector.php +++ b/rector.php @@ -7,6 +7,7 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ +use Nextcloud\Rector\Set\NextcloudSets; use Rector\Config\RectorConfig; return RectorConfig::configure() @@ -14,7 +15,8 @@ __DIR__ . '/lib', __DIR__ . '/tests', ]) - ->withImportNames(importShortClasses:false) + ->withSkipPath(__DIR__ . '/tests/data') + ->withImportNames(importShortClasses: false) ->withPreparedSets( codeQuality: true, codingStyle: true, @@ -22,6 +24,9 @@ earlyReturn: true, instanceOf: true, privatization: true, - strictBooleans: true, ) - ->withPhpSets(php82: true); + ->withPhpSets(php82: true) + ->withSets([ + NextcloudSets::NEXTCLOUD_34, + ]); +; diff --git a/vendor-bin/rector/composer.json b/vendor-bin/rector/composer.json index a266a586..207531ee 100644 --- a/vendor-bin/rector/composer.json +++ b/vendor-bin/rector/composer.json @@ -1,5 +1,5 @@ { - "require-dev": { - "rector/rector": "^1.2" - } + "require-dev": { + "nextcloud/rector": "^0.5.1" + } } diff --git a/vendor-bin/rector/composer.lock b/vendor-bin/rector/composer.lock index eda73870..5f720f2b 100644 --- a/vendor-bin/rector/composer.lock +++ b/vendor-bin/rector/composer.lock @@ -4,20 +4,133 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "eb58f3061bde78d58fa424c73947025f", + "content-hash": "c4f98c41e69b97073e22e2fdafb46933", "packages": [], "packages-dev": [ + { + "name": "nextcloud/ocp", + "version": "v33.0.3", + "source": { + "type": "git", + "url": "https://github.com/nextcloud-deps/ocp.git", + "reference": "cc85b9dcf0236ff8c3acbe9a62dfd511c6ee5ea6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nextcloud-deps/ocp/zipball/cc85b9dcf0236ff8c3acbe9a62dfd511c6ee5ea6", + "reference": "cc85b9dcf0236ff8c3acbe9a62dfd511c6ee5ea6", + "shasum": "" + }, + "require": { + "php": "~8.1 || ~8.2 || ~8.3 || ~8.4 || ~8.5", + "psr/clock": "^1.0", + "psr/container": "^2.0.2", + "psr/event-dispatcher": "^1.0", + "psr/log": "^3.0.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-stable33": "33.0.0-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "AGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Christoph Wurst", + "email": "christoph@winzerhof-wurst.at" + }, + { + "name": "Joas Schilling", + "email": "coding@schilljs.com" + } + ], + "description": "Composer package containing Nextcloud's public OCP API and the unstable NCU API", + "support": { + "issues": "https://github.com/nextcloud-deps/ocp/issues", + "source": "https://github.com/nextcloud-deps/ocp/tree/v33.0.3" + }, + "time": "2026-04-29T01:55:59+00:00" + }, + { + "name": "nextcloud/rector", + "version": "v0.5.1", + "source": { + "type": "git", + "url": "https://github.com/nextcloud-libraries/rector.git", + "reference": "d9c4cf53d9bce0fa95edc87cb093307958317e28" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nextcloud-libraries/rector/zipball/d9c4cf53d9bce0fa95edc87cb093307958317e28", + "reference": "d9c4cf53d9bce0fa95edc87cb093307958317e28", + "shasum": "" + }, + "require": { + "nextcloud/ocp": ">=27", + "php": "^8.1", + "rector/rector": "^2.0.4", + "webmozart/assert": "^1.11" + }, + "require-dev": { + "phpunit/phpunit": "^10.5", + "ramsey/devtools": "^2.0" + }, + "type": "library", + "extra": { + "captainhook": { + "force-install": true + }, + "ramsey/devtools": { + "memory-limit": "-1", + "command-prefix": "dev" + }, + "ramsey/conventional-commits": { + "configFile": "conventional-commits.json" + } + }, + "autoload": { + "psr-4": { + "OCP\\": "vendor/nextcloud/ocp/OCP", + "Nextcloud\\Rector\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "AGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Christoph Wurst", + "email": "christoph@winzerhof-wurst.at", + "homepage": "https://wuc.me" + } + ], + "description": "Rector upgrade rules for Nextcloud", + "keywords": [ + "nextcloud", + "refactoring" + ], + "support": { + "issues": "https://github.com/nextcloud-libraries/rector/issues", + "source": "https://github.com/nextcloud-libraries/rector/tree/v0.5.1" + }, + "time": "2026-05-08T07:32:27+00:00" + }, { "name": "phpstan/phpstan", - "version": "1.12.32", + "version": "2.1.55", "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/2770dcdf5078d0b0d53f94317e06affe88419aa8", - "reference": "2770dcdf5078d0b0d53f94317e06affe88419aa8", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/9eaac3826ed5e9b8427350a43cac825eeca3f566", + "reference": "9eaac3826ed5e9b8427350a43cac825eeca3f566", "shasum": "" }, "require": { - "php": "^7.2|^8.0" + "php": "^7.4|^8.0" }, "conflict": { "phpstan/phpstan-shim": "*" @@ -58,25 +171,226 @@ "type": "github" } ], - "time": "2025-09-30T10:16:31+00:00" + "time": "2026-05-18T11:57:34+00:00" + }, + { + "name": "psr/clock", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/clock.git", + "reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/clock/zipball/e41a24703d4560fd0acb709162f73b8adfc3aa0d", + "reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^8.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Psr\\Clock\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for reading the clock.", + "homepage": "https://github.com/php-fig/clock", + "keywords": [ + "clock", + "now", + "psr", + "psr-20", + "time" + ], + "support": { + "issues": "https://github.com/php-fig/clock/issues", + "source": "https://github.com/php-fig/clock/tree/1.0.0" + }, + "time": "2022-11-25T14:36:26+00:00" + }, + { + "name": "psr/container", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "shasum": "" + }, + "require": { + "php": ">=7.4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "support": { + "issues": "https://github.com/php-fig/container/issues", + "source": "https://github.com/php-fig/container/tree/2.0.2" + }, + "time": "2021-11-05T16:47:00+00:00" + }, + { + "name": "psr/event-dispatcher", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/event-dispatcher.git", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0", + "shasum": "" + }, + "require": { + "php": ">=7.2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\EventDispatcher\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Standard interfaces for event handling.", + "keywords": [ + "events", + "psr", + "psr-14" + ], + "support": { + "issues": "https://github.com/php-fig/event-dispatcher/issues", + "source": "https://github.com/php-fig/event-dispatcher/tree/1.0.0" + }, + "time": "2019-01-08T18:20:26+00:00" + }, + { + "name": "psr/log", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", + "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", + "shasum": "" + }, + "require": { + "php": ">=8.0.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "support": { + "source": "https://github.com/php-fig/log/tree/3.0.2" + }, + "time": "2024-09-11T13:17:53+00:00" }, { "name": "rector/rector", - "version": "1.2.10", + "version": "2.4.3", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "40f9cf38c05296bd32f444121336a521a293fa61" + "reference": "891824c6c59f02a56a5dd58ea8edc44e6c0ece29" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/40f9cf38c05296bd32f444121336a521a293fa61", - "reference": "40f9cf38c05296bd32f444121336a521a293fa61", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/891824c6c59f02a56a5dd58ea8edc44e6c0ece29", + "reference": "891824c6c59f02a56a5dd58ea8edc44e6c0ece29", "shasum": "" }, "require": { - "php": "^7.2|^8.0", - "phpstan/phpstan": "^1.12.5" + "php": "^7.4|^8.0", + "phpstan/phpstan": "^2.1.48" }, "conflict": { "rector/rector-doctrine": "*", @@ -101,6 +415,7 @@ "MIT" ], "description": "Instant Upgrade and Automated Refactoring of any PHP code", + "homepage": "https://getrector.com/", "keywords": [ "automation", "dev", @@ -109,7 +424,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/1.2.10" + "source": "https://github.com/rectorphp/rector/tree/2.4.3" }, "funding": [ { @@ -117,7 +432,65 @@ "type": "github" } ], - "time": "2024-11-08T13:59:10+00:00" + "time": "2026-05-12T11:17:24+00:00" + }, + { + "name": "webmozart/assert", + "version": "1.12.1", + "source": { + "type": "git", + "url": "https://github.com/webmozarts/assert.git", + "reference": "9be6926d8b485f55b9229203f962b51ed377ba68" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/9be6926d8b485f55b9229203f962b51ed377ba68", + "reference": "9be6926d8b485f55b9229203f962b51ed377ba68", + "shasum": "" + }, + "require": { + "ext-ctype": "*", + "ext-date": "*", + "ext-filter": "*", + "php": "^7.2 || ^8.0" + }, + "suggest": { + "ext-intl": "", + "ext-simplexml": "", + "ext-spl": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.10-dev" + } + }, + "autoload": { + "psr-4": { + "Webmozart\\Assert\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Assertions to validate method input/output with nice error messages.", + "keywords": [ + "assert", + "check", + "validate" + ], + "support": { + "issues": "https://github.com/webmozarts/assert/issues", + "source": "https://github.com/webmozarts/assert/tree/1.12.1" + }, + "time": "2025-10-29T15:56:20+00:00" } ], "aliases": [], @@ -127,5 +500,5 @@ "prefer-lowest": false, "platform": {}, "platform-dev": {}, - "plugin-api-version": "2.6.0" + "plugin-api-version": "2.9.0" } diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index 00778138..3ae12af1 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -25,7 +25,6 @@ 'NC\\Updater\\UpdateCommand' => $baseDir . '/lib/UpdateCommand.php', 'NC\\Updater\\UpdateException' => $baseDir . '/lib/UpdateException.php', 'NC\\Updater\\Updater' => $baseDir . '/lib/Updater.php', - 'NC\\Updater\\Version' => $baseDir . '/lib/Version.php', 'Normalizer' => $vendorDir . '/symfony/polyfill-intl-normalizer/Resources/stubs/Normalizer.php', 'Psr\\Container\\ContainerExceptionInterface' => $vendorDir . '/psr/container/src/ContainerExceptionInterface.php', 'Psr\\Container\\ContainerInterface' => $vendorDir . '/psr/container/src/ContainerInterface.php', diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 173bf8d5..fe175374 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -103,7 +103,6 @@ class ComposerStaticInitcbbead1010db4afef500f7adc2b6cac3 'NC\\Updater\\UpdateCommand' => __DIR__ . '/../..' . '/lib/UpdateCommand.php', 'NC\\Updater\\UpdateException' => __DIR__ . '/../..' . '/lib/UpdateException.php', 'NC\\Updater\\Updater' => __DIR__ . '/../..' . '/lib/Updater.php', - 'NC\\Updater\\Version' => __DIR__ . '/../..' . '/lib/Version.php', 'Normalizer' => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer/Resources/stubs/Normalizer.php', 'Psr\\Container\\ContainerExceptionInterface' => __DIR__ . '/..' . '/psr/container/src/ContainerExceptionInterface.php', 'Psr\\Container\\ContainerInterface' => __DIR__ . '/..' . '/psr/container/src/ContainerInterface.php', diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index 5bfe9212..99b12393 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -3,7 +3,7 @@ 'name' => '__root__', 'pretty_version' => 'dev-master', 'version' => 'dev-master', - 'reference' => 'ef7c1a2fde3c86416f5ca4805dd9f0cbf30e4385', + 'reference' => '4123450c26d24ffaa60b2b495e0d8aa934cd982e', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -13,7 +13,7 @@ '__root__' => array( 'pretty_version' => 'dev-master', 'version' => 'dev-master', - 'reference' => 'ef7c1a2fde3c86416f5ca4805dd9f0cbf30e4385', + 'reference' => '4123450c26d24ffaa60b2b495e0d8aa934cd982e', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), From 5af10c104d63fd493975e7190b3433a5a576f0ec Mon Sep 17 00:00:00 2001 From: Benjamin Gaussorgues Date: Tue, 19 May 2026 11:05:38 +0200 Subject: [PATCH 2/3] chore(code): apply Rector Signed-off-by: Benjamin Gaussorgues --- .psalm-baseline.xml | 3 --- index.php | 13 ++++++------- lib/UpdateCommand.php | 10 +++++----- lib/Updater.php | 13 ++++++------- tests/checkSameCodeBase.php | 4 ++-- tests/features/bootstrap/FeatureContext.php | 5 ++++- updater.phar | Bin 1325433 -> 1325357 bytes vendor/composer/autoload_classmap.php | 1 + vendor/composer/autoload_static.php | 1 + 9 files changed, 25 insertions(+), 25 deletions(-) diff --git a/.psalm-baseline.xml b/.psalm-baseline.xml index 39a59d58..c7f5817d 100644 --- a/.psalm-baseline.xml +++ b/.psalm-baseline.xml @@ -58,8 +58,5 @@ - - - diff --git a/index.php b/index.php index ccba6572..2beb3fb2 100644 --- a/index.php +++ b/index.php @@ -87,6 +87,7 @@ public function __construct( if (function_exists('opcache_invalidate')) { opcache_invalidate($versionFileName, true); } + if (!file_exists($versionFileName)) { // fallback to version in config.php $version = $this->getConfigOptionString('version'); @@ -376,7 +377,7 @@ private function getRecursiveDirectoryIterator(string $folder, array $excludedPa /* Store first level children in an array to avoid trouble if changes happen while iterating */ $children = []; while ($name = readdir($handle)) { - if (in_array($name, ['.', '..'])) { + if (in_array($name, ['.', '..'], true)) { continue; } @@ -775,7 +776,7 @@ private function downloadArchive(string $fromUrl, string $toLocation): bool { curl_setopt_array($ch, [ CURLOPT_NOPROGRESS => false, - CURLOPT_PROGRESSFUNCTION => [$this, 'downloadProgressCallback'], + CURLOPT_PROGRESSFUNCTION => $this->downloadProgressCallback(...), CURLOPT_FILE => $fp, ]); @@ -886,6 +887,7 @@ public function verifyIntegrity(string $urlOverride = '', string $signature = '' 'Custom download url provided. You need to provide a signature with --signature or skip integrity check with --no-verify.' ); } + $signature = $this->getSignatureFromUpdater(); } @@ -1349,11 +1351,8 @@ public function currentStep(): array { if (isset($jsonData['step']) && $jsonData['step'] <= self::LAST_STEP && $jsonData['step'] > 0) { $result['step'] = (int)$jsonData['step']; - if (isset($jsonData['state'])) { - $result['state'] = (string)$jsonData['state']; - } else { - $result['state'] = 'start'; - } + $result['state'] = isset($jsonData['state']) ? (string)$jsonData['state'] : 'start'; + if ($result['step'] === self::LAST_STEP && $result['state'] !== 'start') { return []; } diff --git a/lib/UpdateCommand.php b/lib/UpdateCommand.php index fb0e60d5..8ff4913e 100644 --- a/lib/UpdateCommand.php +++ b/lib/UpdateCommand.php @@ -31,6 +31,7 @@ class UpdateCommand extends Command { protected bool $skipIntegrityCheck = false; protected string $urlOverride = ''; + protected string $signature = ''; /** Strings of text for stages of updater */ @@ -137,11 +138,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int } // Check if already a step is in process - if ($this->ignoreState) { - $currentStep = []; - } else { - $currentStep = $this->updater->currentStep(); - } + $currentStep = $this->ignoreState ? [] : $this->updater->currentStep(); + $stepNumber = 0; if ($currentStep !== []) { $stepState = $currentStep['state'] ?? ''; @@ -158,6 +156,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int ); return -1; } + $output->writeln('Found an ongoing update, continue from step ' . $stepNumber); } @@ -466,6 +465,7 @@ protected function executeStep(int $step, OutputInterface $output): array { $this->updater->silentLog('[info] Skipping integrity check as requested'); break; } + $this->updater->verifyIntegrity($this->urlOverride, $this->signature); break; case 6: diff --git a/lib/Updater.php b/lib/Updater.php index b4bd947b..665b3a14 100644 --- a/lib/Updater.php +++ b/lib/Updater.php @@ -71,6 +71,7 @@ public function __construct( if (function_exists('opcache_invalidate')) { opcache_invalidate($versionFileName, true); } + if (!file_exists($versionFileName)) { // fallback to version in config.php $version = $this->getConfigOptionString('version'); @@ -360,7 +361,7 @@ private function getRecursiveDirectoryIterator(string $folder, array $excludedPa /* Store first level children in an array to avoid trouble if changes happen while iterating */ $children = []; while ($name = readdir($handle)) { - if (in_array($name, ['.', '..'])) { + if (in_array($name, ['.', '..'], true)) { continue; } @@ -759,7 +760,7 @@ private function downloadArchive(string $fromUrl, string $toLocation): bool { curl_setopt_array($ch, [ CURLOPT_NOPROGRESS => false, - CURLOPT_PROGRESSFUNCTION => [$this, 'downloadProgressCallback'], + CURLOPT_PROGRESSFUNCTION => $this->downloadProgressCallback(...), CURLOPT_FILE => $fp, ]); @@ -870,6 +871,7 @@ public function verifyIntegrity(string $urlOverride = '', string $signature = '' 'Custom download url provided. You need to provide a signature with --signature or skip integrity check with --no-verify.' ); } + $signature = $this->getSignatureFromUpdater(); } @@ -1333,11 +1335,8 @@ public function currentStep(): array { if (isset($jsonData['step']) && $jsonData['step'] <= self::LAST_STEP && $jsonData['step'] > 0) { $result['step'] = (int)$jsonData['step']; - if (isset($jsonData['state'])) { - $result['state'] = (string)$jsonData['state']; - } else { - $result['state'] = 'start'; - } + $result['state'] = isset($jsonData['state']) ? (string)$jsonData['state'] : 'start'; + if ($result['step'] === self::LAST_STEP && $result['state'] !== 'start') { return []; } diff --git a/tests/checkSameCodeBase.php b/tests/checkSameCodeBase.php index bd1d2c8a..0f87c3dd 100644 --- a/tests/checkSameCodeBase.php +++ b/tests/checkSameCodeBase.php @@ -58,7 +58,7 @@ function findDiffPos($original, $copy) { foreach ($iterator as $path => $fileInfo) { $fileName = explode($libDir, $path)[1]; - if (in_array($fileName, $excludedFiles)) { + if (in_array($fileName, $excludedFiles, true)) { continue; } @@ -67,7 +67,7 @@ function findDiffPos($original, $copy) { $fileContent = explode("namespace NC\\Updater;\n", $fileContent, 2)[1]; $fileContent = preg_replace('/^use [^\\\\]*;\n/m', '', $fileContent); - $fileContent = trim($fileContent); + $fileContent = trim((string)$fileContent); if (in_array(str_contains($indexPhpContent, $fileContent), [0, false], true)) { $failedFiles[] = $fileName; diff --git a/tests/features/bootstrap/FeatureContext.php b/tests/features/bootstrap/FeatureContext.php index fc0428a8..30d529f7 100644 --- a/tests/features/bootstrap/FeatureContext.php +++ b/tests/features/bootstrap/FeatureContext.php @@ -231,10 +231,12 @@ public function theArchiveForVersionIsAvailableLocally(string $version): void { if (curl_exec($ch) === false) { throw new \Exception('Curl error: ' . curl_error($ch)); } + $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); if ($httpCode !== 200) { throw new \Exception('Download failed for ' . $url . ' - HTTP code: ' . $httpCode); } + curl_close($ch); fclose($fp); } @@ -282,6 +284,7 @@ private function runUpdaterWithLocalFileUrl(string $version, bool $noVerify): vo if ($noVerify) { $args .= ' --no-verify'; } + exec('./updater ' . $args . ' 2>&1', $output, $returnCode); // sleep to let the opcache do it's work and invalidate the status.php @@ -505,7 +508,7 @@ public function theConfigKeyIsSetTo(string $key, mixed $value, string $type = 's return; } - if (!in_array($type, ['string', 'boolean', 'integer', 'double'])) { + if (!in_array($type, ['string', 'boolean', 'integer', 'double'], true)) { throw new Exception('Invalid type given: ' . $type); } diff --git a/updater.phar b/updater.phar index ed220978ada8dd8ad6aecbeb27ec630e9238c338..625fae13cb82b6ff19f896a34fea56fc150323e4 100755 GIT binary patch delta 5743 zcma)A2UJ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cLjA@ z1hijQFF<{5>h}lIfQWY3QzWxc0>lIrs!UVgi>I-`K8HbxR_{=6illx#=RAVOOjWNA zKzn=D?fIm4LSb7WuZ07uq=%8Fh`++aH>dMf=uA_aQO9KdtPQ$v@_IPtWw{kj%8`Y_ z<2U$V*cPLoWzE^;EY(gMKmT?^)2-n}tvn>d(+?6420e!!jv)Fhjo$zcHWp>&gOQ)Mzy62fddB zJ#E!z9Yd=ehBh;P^qfCMpoxNZf zUx3nWLaG!FZPlyM-?If@87lFWz8MWm_6u=vWx2!~PCAHrhiw-!vteg~{`T^Qof`bB zMGZT3Ull>j?ThA>OVlK& z=X?F2L~%dpVq|F9HQ|%V;Ch}G-mW%&08yE!gD36_{^->*G5ke%^roOeBZrF)1>}R} z17Pv@;uCmwgi(vm?Gzs_jdaze)+AIX*44U_YSIQLCk(Djsi{s*v!~S7rq|hPCf6m| zUCBvlDX2fjJ5logW{2mKy~|*S#VB9i8Rw0Eji@uuC!a6+vHkS6o;^b0^5w@~o83CC z{6zQ|zp}Y!Zt{yJ%|B4_?w+6HR;~Twun=)l5`K7QOOjZl`tzb|Preu5**I-a<(SKh M@de5i=8VkwAGX|tSpWb4 diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index 3ae12af1..00778138 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -25,6 +25,7 @@ 'NC\\Updater\\UpdateCommand' => $baseDir . '/lib/UpdateCommand.php', 'NC\\Updater\\UpdateException' => $baseDir . '/lib/UpdateException.php', 'NC\\Updater\\Updater' => $baseDir . '/lib/Updater.php', + 'NC\\Updater\\Version' => $baseDir . '/lib/Version.php', 'Normalizer' => $vendorDir . '/symfony/polyfill-intl-normalizer/Resources/stubs/Normalizer.php', 'Psr\\Container\\ContainerExceptionInterface' => $vendorDir . '/psr/container/src/ContainerExceptionInterface.php', 'Psr\\Container\\ContainerInterface' => $vendorDir . '/psr/container/src/ContainerInterface.php', diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index fe175374..173bf8d5 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -103,6 +103,7 @@ class ComposerStaticInitcbbead1010db4afef500f7adc2b6cac3 'NC\\Updater\\UpdateCommand' => __DIR__ . '/../..' . '/lib/UpdateCommand.php', 'NC\\Updater\\UpdateException' => __DIR__ . '/../..' . '/lib/UpdateException.php', 'NC\\Updater\\Updater' => __DIR__ . '/../..' . '/lib/Updater.php', + 'NC\\Updater\\Version' => __DIR__ . '/../..' . '/lib/Version.php', 'Normalizer' => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer/Resources/stubs/Normalizer.php', 'Psr\\Container\\ContainerExceptionInterface' => __DIR__ . '/..' . '/psr/container/src/ContainerExceptionInterface.php', 'Psr\\Container\\ContainerInterface' => __DIR__ . '/..' . '/psr/container/src/ContainerInterface.php', From 16cf10755855ff4ec38b6a507dca47288ef2f94b Mon Sep 17 00:00:00 2001 From: Benjamin Gaussorgues Date: Tue, 19 May 2026 11:25:23 +0200 Subject: [PATCH 3/3] chore(deps): add Rector workflow Signed-off-by: Benjamin Gaussorgues --- .github/workflows/rector-apply.yml | 68 ++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 .github/workflows/rector-apply.yml diff --git a/.github/workflows/rector-apply.yml b/.github/workflows/rector-apply.yml new file mode 100644 index 00000000..f5baba7a --- /dev/null +++ b/.github/workflows/rector-apply.yml @@ -0,0 +1,68 @@ +# 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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + 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@accd6127cb78bee3e8082180cb391013d204ef9f # 2.37.0 + 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: Install dependencies + run: | + composer remove nextcloud/ocp --dev --no-scripts + composer i + + - 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 + 3. to review