diff options
author | Carl Schwan <carl@carlschwan.eu> | 2022-10-11 17:29:49 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-11 17:29:49 +0300 |
commit | fb10d98b0e3404ebb04eec3f14dd229d1f02ee18 (patch) | |
tree | e2d05e81dbed591deb5d3f845fbbd09ad3d72a67 | |
parent | ef25e5104f9b1eff7cad9bc610f3026bf3df243c (diff) | |
parent | 01351ac141d27ce9434baed6a7ba2b03d4987fb8 (diff) |
Merge pull request #2108 from nextcloud/migrate-master-christophwurst-package
Migrate to nextcloud/OCP package in master
-rw-r--r-- | .github/workflows/psalm.yml (renamed from .github/workflows/static-analysis.yml) | 18 | ||||
-rw-r--r-- | .github/workflows/update-nextcloud-ocp.yml | 65 | ||||
-rw-r--r-- | composer.json | 11 | ||||
-rw-r--r-- | composer.lock | 107 | ||||
-rw-r--r-- | lib/Mount/GroupFolderStorage.php | 1 | ||||
-rw-r--r-- | tests/psalm-baseline.xml | 26 | ||||
-rw-r--r-- | tests/stub.phpstub | 50 |
7 files changed, 204 insertions, 74 deletions
diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/psalm.yml index 3536fde5..27091d53 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/psalm.yml @@ -1,3 +1,8 @@ +# 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 + name: Static analysis on: @@ -5,20 +10,17 @@ on: push: branches: - master + - main - stable* jobs: - static-psalm-analysis: + static-analysis: runs-on: ubuntu-latest - strategy: - matrix: - ocp-version: [ 'dev-master' ] - - name: Nextcloud ${{ matrix.ocp-version }} + name: Nextcloud steps: - name: Checkout - uses: actions/checkout@master + uses: actions/checkout@v3 - name: Set up php uses: shivammathur/setup-php@v2 @@ -27,7 +29,7 @@ jobs: coverage: none - name: Install dependencies - run: composer install --dev + run: composer i - name: Run coding standards check run: composer run psalm diff --git a/.github/workflows/update-nextcloud-ocp.yml b/.github/workflows/update-nextcloud-ocp.yml new file mode 100644 index 00000000..cabfc6fe --- /dev/null +++ b/.github/workflows/update-nextcloud-ocp.yml @@ -0,0 +1,65 @@ +# 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 + +name: Update nextcloud/ocp + +on: + workflow_dispatch: + schedule: + - cron: "5 2 * * 0" + +jobs: + update-nextcloud-ocp: + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + branches: ["master", "stable25", "stable24", "stable23"] + + name: update-nextcloud-ocp-${{ matrix.branches }} + + steps: + - uses: actions/checkout@v3 + with: + ref: ${{ matrix.branches }} + submodules: true + + - name: Set up php7.4 + uses: shivammathur/setup-php@v2 + with: + php-version: 7.4 + extensions: ctype,curl,dom,fileinfo,gd,intl,json,mbstring,openssl,pdo_sqlite,posix,sqlite,xml,zip + coverage: none + + - name: Composer install + run: composer install + + - name: Composer update nextcloud/ocp + run: composer require --dev nextcloud/ocp:dev-${{ matrix.branches }} + continue-on-error: true + + - name: Reset checkout dirs + run: | + git clean -f 3rdparty + git clean -f vendor + git checkout 3rdparty vendor + continue-on-error: true + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v3 + with: + token: ${{ secrets.COMMAND_BOT_PAT }} + commit-message: Update psalm baseline + committer: GitHub <noreply@github.com> + author: nextcloud-command <nextcloud-command@users.noreply.github.com> + signoff: true + branch: automated/noid/${{ matrix.branches }}-update-nextcloud-ocp + title: "[${{ matrix.branches }}] Update nextcloud/ocp dependency" + body: | + Auto-generated update of [nextcloud/ocp](https://github.com/nextcloud-deps/ocp/) dependency + labels: | + dependencies + 3. to review diff --git a/composer.json b/composer.json index 3187fb1b..1b1c0886 100644 --- a/composer.json +++ b/composer.json @@ -4,9 +4,9 @@ "sabre/dav": "^4.1", "sabre/xml": "^2.2", "symfony/event-dispatcher": "^5.3.11", - "christophwurst/nextcloud": "dev-master@dev", "psalm/phar": "^4.10", - "nextcloud/coding-standard": "^1.0" + "nextcloud/coding-standard": "^1.0", + "nextcloud/ocp": "dev-master" }, "require": { "php-parallel-lint/php-parallel-lint": "^1.2" @@ -16,7 +16,7 @@ "cs:check": "php-cs-fixer fix --dry-run --diff", "cs:fix": "php-cs-fixer fix", "psalm": "psalm.phar --threads=1", - "psalm:update-baseline": "psalm.phar --threads=1 --update-baseline --set-baseline=tests/psalm-baseline.xml", + "psalm:update-baseline": "psalm.phar --threads=1 --update-baseline", "psalm:clear": "psalm.phar --clear-cache && psalm --clear-global-cache", "psalm:fix": "psalm.phar --alter --issues=InvalidReturnType,InvalidNullableReturnType,MissingParamType,InvalidFalsableReturnType" }, @@ -27,5 +27,10 @@ "platform": { "php": "7.4" } + }, + "autoload-dev": { + "psr-4": { + "OCP\\": "vendor/nextcloud/ocp/OCP" + } } } diff --git a/composer.lock b/composer.lock index 162a58e6..23cbc347 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "28fea95ed0d9f071ec2b7d513f71bc9d", + "content-hash": "50a63163e351c7178746514ee41773bb", "packages": [ { "name": "php-parallel-lint/php-parallel-lint", @@ -66,50 +66,6 @@ ], "packages-dev": [ { - "name": "christophwurst/nextcloud", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/ChristophWurst/nextcloud_composer.git", - "reference": "dca072ad12ea0ff201fa46da18f46dd1928eb139" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/ChristophWurst/nextcloud_composer/zipball/dca072ad12ea0ff201fa46da18f46dd1928eb139", - "reference": "dca072ad12ea0ff201fa46da18f46dd1928eb139", - "shasum": "" - }, - "require": { - "php": "^7.4 || ~8.0 || ~8.1", - "psr/container": "^1.0", - "psr/event-dispatcher": "^1.0", - "psr/log": "^1.1" - }, - "default-branch": true, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "24.0.0-dev" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "AGPL-3.0-or-later" - ], - "authors": [ - { - "name": "Christoph Wurst", - "email": "christoph@winzerhof-wurst.at" - } - ], - "description": "Composer package containing Nextcloud's public API (classes, interfaces)", - "support": { - "issues": "https://github.com/ChristophWurst/nextcloud_composer/issues", - "source": "https://github.com/ChristophWurst/nextcloud_composer/tree/master" - }, - "time": "2022-03-30T01:48:24+00:00" - }, - { "name": "composer/pcre", "version": "1.0.0", "source": { @@ -730,6 +686,49 @@ "time": "2021-11-10T08:44:10+00:00" }, { + "name": "nextcloud/ocp", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/nextcloud-deps/ocp.git", + "reference": "04ad54073af7a8c57ff147d33c3252832bba10f9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nextcloud-deps/ocp/zipball/04ad54073af7a8c57ff147d33c3252832bba10f9", + "reference": "04ad54073af7a8c57ff147d33c3252832bba10f9", + "shasum": "" + }, + "require": { + "php": "^7.4 || ~8.0 || ~8.1", + "psr/container": "^1.1.1", + "psr/event-dispatcher": "^1.0", + "psr/log": "^1.1" + }, + "default-branch": true, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "26.0.0-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "AGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Christoph Wurst", + "email": "christoph@winzerhof-wurst.at" + } + ], + "description": "Composer package containing Nextcloud's public API (classes, interfaces)", + "support": { + "source": "https://github.com/nextcloud-deps/ocp/tree/master" + }, + "time": "2022-10-02T00:58:49+00:00" + }, + { "name": "nikic/php-parser", "version": "v4.13.2", "source": { @@ -1682,20 +1681,20 @@ }, { "name": "psr/container", - "version": "1.1.1", + "version": "1.1.2", "source": { "type": "git", "url": "https://github.com/php-fig/container.git", - "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf" + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/8622567409010282b7aeebe4bb841fe98b58dcaf", - "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf", + "url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea", + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea", "shasum": "" }, "require": { - "php": ">=7.2.0" + "php": ">=7.4.0" }, "type": "library", "autoload": { @@ -1724,9 +1723,9 @@ ], "support": { "issues": "https://github.com/php-fig/container/issues", - "source": "https://github.com/php-fig/container/tree/1.1.1" + "source": "https://github.com/php-fig/container/tree/1.1.2" }, - "time": "2021-03-05T17:36:06+00:00" + "time": "2021-11-05T16:50:12+00:00" }, { "name": "psr/event-dispatcher", @@ -4739,7 +4738,7 @@ "aliases": [], "minimum-stability": "stable", "stability-flags": { - "christophwurst/nextcloud": 20 + "nextcloud/ocp": 20 }, "prefer-stable": false, "prefer-lowest": false, @@ -4748,5 +4747,5 @@ "platform-overrides": { "php": "7.4" }, - "plugin-api-version": "2.2.0" + "plugin-api-version": "2.3.0" } diff --git a/lib/Mount/GroupFolderStorage.php b/lib/Mount/GroupFolderStorage.php index de9c674b..901360ce 100644 --- a/lib/Mount/GroupFolderStorage.php +++ b/lib/Mount/GroupFolderStorage.php @@ -71,6 +71,7 @@ class GroupFolderStorage extends Quota { } public function getScanner($path = '', $storage = null) { + /** @var \OC\Files\Storage\Storage $storage */ if (!$storage) { $storage = $this; } diff --git a/tests/psalm-baseline.xml b/tests/psalm-baseline.xml index 770e1188..c23b79be 100644 --- a/tests/psalm-baseline.xml +++ b/tests/psalm-baseline.xml @@ -1,5 +1,21 @@ <?xml version="1.0" encoding="UTF-8"?> <files psalm-version="4.x-dev@"> + <file src="lib/ACL/ACLStorageWrapper.php"> + <InvalidNullableReturnType occurrences="2"> + <code>filemtime</code> + <code>hash</code> + </InvalidNullableReturnType> + <UndefinedClass occurrences="1"> + <code>IteratorDirectory</code> + </UndefinedClass> + <UndefinedInterfaceMethod occurrences="1"> + <code>getDirectoryContent</code> + </UndefinedInterfaceMethod> + <UndefinedMethod occurrences="2"> + <code>parent::getMetaData($path)</code> + <code>parent::writeStream($path, $stream, $size)</code> + </UndefinedMethod> + </file> <file src="lib/AppInfo/Application.php"> <UndefinedClass occurrences="1"> <code>BeforeTemplateRenderedEvent</code> @@ -16,6 +32,16 @@ <code>$this->__call(__FUNCTION__, func_get_args())</code> </InvalidReturnStatement> </file> + <file src="lib/Mount/RootPermissionsMask.php"> + <UndefinedMethod occurrences="1"> + <code>parent::getMetaData($path)</code> + </UndefinedMethod> + </file> + <file src="lib/Trash/GroupTrashItem.php"> + <UndefinedMethod occurrences="1"> + <code>parent::__construct($backend, $originalLocation, $deletedTime, $trashPath, $fileInfo, $user)</code> + </UndefinedMethod> + </file> <file src="lib/Versions/ExpireManager.php"> <TypeDoesNotContainType occurrences="2"> <code>self::MAX_VERSIONS_PER_INTERVAL[$interval]['intervalEndsAfter'] === -1</code> diff --git a/tests/stub.phpstub b/tests/stub.phpstub index f4882ce5..5ca31e86 100644 --- a/tests/stub.phpstub +++ b/tests/stub.phpstub @@ -414,7 +414,8 @@ namespace OC\Core\Command { } namespace OC\Files\ObjectStore { - class NoopScanner {} + use OC\Files\Cache\Scanner; + class NoopScanner extends Scanner {} } namespace Symfony\Component\Console\Helper { @@ -458,11 +459,13 @@ namespace Symfony\Component\Console\Output { namespace OC\Files\Cache { use OCP\Files\Cache\ICache; + use OCP\Files\Cache\IScanner; use OCP\Files\Cache\ICacheEntry; use OCP\Files\Search\ISearchQuery; use OCP\Files\Search\ISearchOperator; use OCP\Files\Search\ISearchQuery; use OCP\Files\IMimeTypeLoader; + use OCP\Files\Storage\IStorage; class Cache implements ICache { /** @@ -500,11 +503,17 @@ namespace OC\Files\Cache { public function getCacheEntryFromSearchResult(ICacheEntry $rawEntry): ?ICacheEntry {} public static function cacheEntryFromData($data, IMimeTypeLoader $mimetypeLoader): ICacheEntry {} } + + class Scanner implements IScanner { + public function __construct(IStorage $storage) {} + } } namespace OC\Files\Cache\Wrapper { use OC\Files\Cache\Cache; - class CacheWrapper extends Cache {} + class CacheWrapper extends Cache { + public function getCache(): Cache {} + } } namespace OC\Files { @@ -597,7 +606,7 @@ namespace OC\Files\Mount { class MountPoint implements IMountPoint { /** - * @var \OC\Files\Storage\Storage $storage + * @var \OCP\Files\Storage\IStorage $storage */ protected $storage = null; protected $class; @@ -616,7 +625,7 @@ namespace OC\Files\Mount { * @param int|null $mountId * @throws \Exception */ - public function __construct($storage, $mountpoint, $arguments = null, $loader = null, $mountOptions = null, $mountId = null) { + public function __construct($storage, $mountpoint, $arguments = null, $loader = null, $mountOptions = null, $mountId = null, string $mountProvider = null) { throw new \Exception('stub'); } @@ -715,19 +724,21 @@ namespace OC\Files\Mount { } } -namespace OC\Files\Storage\Wrapper{ - +namespace OC\Files\Storage { use OCP\Files\Cache\ICache; use OCP\Files\Cache\ICacheEntry; use OCP\Files\Search\ISearchQuery; + use OC\Files\Storage\Storage; use OCP\Files\Storage\IStorage; + use OCP\Files\Cache\IScanner; + + class Storage implements IStorage { + /** @var ?IScanner */ + public $scanner; - class Wrapper implements IStorage { public function __construct(array $parameters) { } - public function getWrapperStorage(): ?IStorage {} - public function getId() {} public function mkdir($path) {} @@ -901,6 +912,22 @@ namespace OC\Files\Storage\Wrapper{ public function getWatcher() { throw new \Exception('stub'); } + } +} + +namespace OC\Files\Storage\Wrapper{ + + use OCP\Files\Cache\ICache; + use OCP\Files\Cache\ICacheEntry; + use OCP\Files\Search\ISearchQuery; + use OC\Files\Storage\Storage; + use OCP\Files\Storage\IStorage; + use OCP\Files\Cache\IScanner; + + class Wrapper extends Storage { + protected Storage $storage; + + public function getWrapperStorage(): ?IStorage {} } class Jail extends Wrapper { @@ -919,3 +946,8 @@ namespace OC\Files\Storage\Wrapper{ namespace OCP\Files\Mount { interface ISystemMountPoint {} } + +namespace OC\Files\ObjectStore { + use OC\Files\Storage\Wrapper\Wrapper; + class ObjectStoreStorage extends Wrapper {} +} |