From e5abdde6cc00bebf2a149ddb2c008002fb66525b Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Wed, 20 Apr 2022 15:47:32 +0200 Subject: [PATCH] Add static analysis Signed-off-by: Carl Schwan --- .github/workflows/static-analysis.yml | 26 + .gitignore | 2 +- .php_cs.dist => .php-cs-fixer.dist.php | 0 composer.json | 10 +- composer.lock | 1082 ++++++++++++++++----- lib/Circles/FileSharingBroadcaster.php | 5 +- lib/Command/CirclesMaintenance.php | 2 +- lib/Command/CirclesMemberships.php | 2 +- lib/Controller/AdminController.php | 34 +- lib/Controller/EventWrapperController.php | 2 +- lib/Controller/LocalController.php | 38 +- lib/Db/CircleProviderRequestBuilder.php | 2 +- lib/Db/MemberRequestBuilder.php | 2 +- lib/Db/ShareWrapperRequestBuilder.php | 6 +- lib/Model/ShareWrapper.php | 347 +------ lib/Tools/Model/SimpleDataStore.php | 13 +- psalm.xml | 39 + tests/psalm-baseline.xml | 916 +++++++++++++++++ tests/stub.phpstub | 1023 +++++++++++++++++++ 19 files changed, 2934 insertions(+), 617 deletions(-) create mode 100644 .github/workflows/static-analysis.yml rename .php_cs.dist => .php-cs-fixer.dist.php (100%) create mode 100644 psalm.xml create mode 100644 tests/psalm-baseline.xml create mode 100644 tests/stub.phpstub diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml new file mode 100644 index 00000000..8fa3c9ec --- /dev/null +++ b/.github/workflows/static-analysis.yml @@ -0,0 +1,26 @@ +name: Static analysis + +on: [pull_request] + +jobs: + static-psalm-analysis: + runs-on: ubuntu-latest + strategy: + matrix: + ocp-version: [ 'dev-master' ] + name: Nextcloud ${{ matrix.ocp-version }} + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Set up php + uses: shivammathur/setup-php@v2 + with: + php-version: 7.4 + tools: composer:v1 + coverage: none + - name: Install dependencies + run: composer i + - name: Install dependencies + run: composer require --dev christophwurst/nextcloud:${{ matrix.ocp-version }} + - name: Run coding standards check + run: composer run psalm diff --git a/.gitignore b/.gitignore index fe87a0e4..b926d971 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,4 @@ build/ .settings/ vendor/ -.php_cs.cache +.php-cs-fixer.cache diff --git a/.php_cs.dist b/.php-cs-fixer.dist.php similarity index 100% rename from .php_cs.dist rename to .php-cs-fixer.dist.php diff --git a/composer.json b/composer.json index 16f5aef1..db9128ab 100644 --- a/composer.json +++ b/composer.json @@ -25,10 +25,16 @@ "scripts": { "cs:check": "php-cs-fixer fix --dry-run --diff", "cs:fix": "php-cs-fixer fix", + "psalm": "psalm --threads=1 --update-baseline", + "psalm:update-baseline": "psalm --threads=1 --update-baseline", + "psalm:clear": "psalm --clear-cache && psalm --clear-global-cache", + "psalm:fix": "psalm --alter --issues=InvalidReturnType,InvalidNullableReturnType,MissingParamType,InvalidFalsableReturnType", "lint": "find . -name \\*.php -not -path './vendor/*' -print0 | xargs -0 -n1 php -l" }, "require-dev": { - "nextcloud/coding-standard": "^0.5.0", - "phpunit/phpunit": "^9.5" + "phpunit/phpunit": "^9.5", + "vimeo/psalm": "^4.22", + "christophwurst/nextcloud": "dev-master", + "nextcloud/coding-standard": "^1.0" } } diff --git a/composer.lock b/composer.lock index 5b4f10af..8ab9e6c9 100644 --- a/composer.lock +++ b/composer.lock @@ -4,9 +4,292 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "0a8df5b2ed4503b7107a5e84d632826e", + "content-hash": "77e116a2c846c4e9f1fc38400e07bbb5", "packages": [], "packages-dev": [ + { + "name": "amphp/amp", + "version": "v2.6.2", + "source": { + "type": "git", + "url": "https://github.com/amphp/amp.git", + "reference": "9d5100cebffa729aaffecd3ad25dc5aeea4f13bb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/amphp/amp/zipball/9d5100cebffa729aaffecd3ad25dc5aeea4f13bb", + "reference": "9d5100cebffa729aaffecd3ad25dc5aeea4f13bb", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "require-dev": { + "amphp/php-cs-fixer-config": "dev-master", + "amphp/phpunit-util": "^1", + "ext-json": "*", + "jetbrains/phpstorm-stubs": "^2019.3", + "phpunit/phpunit": "^7 | ^8 | ^9", + "psalm/phar": "^3.11@dev", + "react/promise": "^2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + } + }, + "autoload": { + "files": [ + "lib/functions.php", + "lib/Internal/functions.php" + ], + "psr-4": { + "Amp\\": "lib" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Daniel Lowrey", + "email": "rdlowrey@php.net" + }, + { + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" + }, + { + "name": "Bob Weinand", + "email": "bobwei9@hotmail.com" + }, + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + } + ], + "description": "A non-blocking concurrency framework for PHP applications.", + "homepage": "https://amphp.org/amp", + "keywords": [ + "async", + "asynchronous", + "awaitable", + "concurrency", + "event", + "event-loop", + "future", + "non-blocking", + "promise" + ], + "support": { + "irc": "irc://irc.freenode.org/amphp", + "issues": "https://github.com/amphp/amp/issues", + "source": "https://github.com/amphp/amp/tree/v2.6.2" + }, + "funding": [ + { + "url": "https://github.com/amphp", + "type": "github" + } + ], + "time": "2022-02-20T17:52:18+00:00" + }, + { + "name": "amphp/byte-stream", + "version": "v1.8.1", + "source": { + "type": "git", + "url": "https://github.com/amphp/byte-stream.git", + "reference": "acbd8002b3536485c997c4e019206b3f10ca15bd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/amphp/byte-stream/zipball/acbd8002b3536485c997c4e019206b3f10ca15bd", + "reference": "acbd8002b3536485c997c4e019206b3f10ca15bd", + "shasum": "" + }, + "require": { + "amphp/amp": "^2", + "php": ">=7.1" + }, + "require-dev": { + "amphp/php-cs-fixer-config": "dev-master", + "amphp/phpunit-util": "^1.4", + "friendsofphp/php-cs-fixer": "^2.3", + "jetbrains/phpstorm-stubs": "^2019.3", + "phpunit/phpunit": "^6 || ^7 || ^8", + "psalm/phar": "^3.11.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "files": [ + "lib/functions.php" + ], + "psr-4": { + "Amp\\ByteStream\\": "lib" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" + }, + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + } + ], + "description": "A stream abstraction to make working with non-blocking I/O simple.", + "homepage": "http://amphp.org/byte-stream", + "keywords": [ + "amp", + "amphp", + "async", + "io", + "non-blocking", + "stream" + ], + "support": { + "irc": "irc://irc.freenode.org/amphp", + "issues": "https://github.com/amphp/byte-stream/issues", + "source": "https://github.com/amphp/byte-stream/tree/v1.8.1" + }, + "funding": [ + { + "url": "https://github.com/amphp", + "type": "github" + } + ], + "time": "2021-03-30T17:13:30+00:00" + }, + { + "name": "christophwurst/nextcloud", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/ChristophWurst/nextcloud_composer.git", + "reference": "5e2c78469a4f669ed11016cf8a6668792efcbedf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ChristophWurst/nextcloud_composer/zipball/5e2c78469a4f669ed11016cf8a6668792efcbedf", + "reference": "5e2c78469a4f669ed11016cf8a6668792efcbedf", + "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-04-15T01:52:26+00:00" + }, + { + "name": "composer/package-versions-deprecated", + "version": "1.11.99.5", + "source": { + "type": "git", + "url": "https://github.com/composer/package-versions-deprecated.git", + "reference": "b4f54f74ef3453349c24a845d22392cd31e65f1d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/package-versions-deprecated/zipball/b4f54f74ef3453349c24a845d22392cd31e65f1d", + "reference": "b4f54f74ef3453349c24a845d22392cd31e65f1d", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.1.0 || ^2.0", + "php": "^7 || ^8" + }, + "replace": { + "ocramius/package-versions": "1.11.99" + }, + "require-dev": { + "composer/composer": "^1.9.3 || ^2.0@dev", + "ext-zip": "^1.13", + "phpunit/phpunit": "^6.5 || ^7" + }, + "type": "composer-plugin", + "extra": { + "class": "PackageVersions\\Installer", + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "PackageVersions\\": "src/PackageVersions" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be" + } + ], + "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)", + "support": { + "issues": "https://github.com/composer/package-versions-deprecated/issues", + "source": "https://github.com/composer/package-versions-deprecated/tree/1.11.99.5" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2022-01-17T14:14:24+00:00" + }, { "name": "composer/pcre", "version": "1.0.1", @@ -225,6 +508,43 @@ ], "time": "2022-02-24T20:20:32+00:00" }, + { + "name": "dnoegel/php-xdg-base-dir", + "version": "v0.1.1", + "source": { + "type": "git", + "url": "https://github.com/dnoegel/php-xdg-base-dir.git", + "reference": "8f8a6e48c5ecb0f991c2fdcf5f154a47d85f9ffd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/dnoegel/php-xdg-base-dir/zipball/8f8a6e48c5ecb0f991c2fdcf5f154a47d85f9ffd", + "reference": "8f8a6e48c5ecb0f991c2fdcf5f154a47d85f9ffd", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "require-dev": { + "phpunit/phpunit": "~7.0|~6.0|~5.0|~4.8.35" + }, + "type": "library", + "autoload": { + "psr-4": { + "XdgBaseDir\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "implementation of xdg base directory specification for php", + "support": { + "issues": "https://github.com/dnoegel/php-xdg-base-dir/issues", + "source": "https://github.com/dnoegel/php-xdg-base-dir/tree/v0.1.1" + }, + "time": "2019-12-04T15:06:13+00:00" + }, { "name": "doctrine/annotations", "version": "1.13.2", @@ -444,86 +764,167 @@ "time": "2022-02-28T11:07:21+00:00" }, { - "name": "friendsofphp/php-cs-fixer", - "version": "v2.19.3", + "name": "felixfbecker/advanced-json-rpc", + "version": "v3.2.1", "source": { "type": "git", - "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", - "reference": "75ac86f33fab4714ea5a39a396784d83ae3b5ed8" + "url": "https://github.com/felixfbecker/php-advanced-json-rpc.git", + "reference": "b5f37dbff9a8ad360ca341f3240dc1c168b45447" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/75ac86f33fab4714ea5a39a396784d83ae3b5ed8", - "reference": "75ac86f33fab4714ea5a39a396784d83ae3b5ed8", + "url": "https://api.github.com/repos/felixfbecker/php-advanced-json-rpc/zipball/b5f37dbff9a8ad360ca341f3240dc1c168b45447", + "reference": "b5f37dbff9a8ad360ca341f3240dc1c168b45447", "shasum": "" }, "require": { - "composer/semver": "^1.4 || ^2.0 || ^3.0", - "composer/xdebug-handler": "^1.2 || ^2.0", - "doctrine/annotations": "^1.2", - "ext-json": "*", - "ext-tokenizer": "*", - "php": "^5.6 || ^7.0 || ^8.0", - "php-cs-fixer/diff": "^1.3", - "symfony/console": "^3.4.43 || ^4.1.6 || ^5.0", - "symfony/event-dispatcher": "^3.0 || ^4.0 || ^5.0", - "symfony/filesystem": "^3.0 || ^4.0 || ^5.0", - "symfony/finder": "^3.0 || ^4.0 || ^5.0", - "symfony/options-resolver": "^3.0 || ^4.0 || ^5.0", - "symfony/polyfill-php70": "^1.0", - "symfony/polyfill-php72": "^1.4", - "symfony/process": "^3.0 || ^4.0 || ^5.0", - "symfony/stopwatch": "^3.0 || ^4.0 || ^5.0" + "netresearch/jsonmapper": "^1.0 || ^2.0 || ^3.0 || ^4.0", + "php": "^7.1 || ^8.0", + "phpdocumentor/reflection-docblock": "^4.3.4 || ^5.0.0" }, "require-dev": { - "justinrainbow/json-schema": "^5.0", - "keradus/cli-executor": "^1.4", - "mikey179/vfsstream": "^1.6", - "php-coveralls/php-coveralls": "^2.4.2", - "php-cs-fixer/accessible-object": "^1.0", + "phpunit/phpunit": "^7.0 || ^8.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "AdvancedJsonRpc\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "ISC" + ], + "authors": [ + { + "name": "Felix Becker", + "email": "felix.b@outlook.com" + } + ], + "description": "A more advanced JSONRPC implementation", + "support": { + "issues": "https://github.com/felixfbecker/php-advanced-json-rpc/issues", + "source": "https://github.com/felixfbecker/php-advanced-json-rpc/tree/v3.2.1" + }, + "time": "2021-06-11T22:34:44+00:00" + }, + { + "name": "felixfbecker/language-server-protocol", + "version": "v1.5.2", + "source": { + "type": "git", + "url": "https://github.com/felixfbecker/php-language-server-protocol.git", + "reference": "6e82196ffd7c62f7794d778ca52b69feec9f2842" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/felixfbecker/php-language-server-protocol/zipball/6e82196ffd7c62f7794d778ca52b69feec9f2842", + "reference": "6e82196ffd7c62f7794d778ca52b69feec9f2842", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "require-dev": { + "phpstan/phpstan": "*", + "squizlabs/php_codesniffer": "^3.1", + "vimeo/psalm": "^4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "LanguageServerProtocol\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "ISC" + ], + "authors": [ + { + "name": "Felix Becker", + "email": "felix.b@outlook.com" + } + ], + "description": "PHP classes for the Language Server Protocol", + "keywords": [ + "language", + "microsoft", + "php", + "server" + ], + "support": { + "issues": "https://github.com/felixfbecker/php-language-server-protocol/issues", + "source": "https://github.com/felixfbecker/php-language-server-protocol/tree/v1.5.2" + }, + "time": "2022-03-02T22:36:06+00:00" + }, + { + "name": "friendsofphp/php-cs-fixer", + "version": "v3.4.0", + "source": { + "type": "git", + "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", + "reference": "47177af1cfb9dab5d1cc4daf91b7179c2efe7fad" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/47177af1cfb9dab5d1cc4daf91b7179c2efe7fad", + "reference": "47177af1cfb9dab5d1cc4daf91b7179c2efe7fad", + "shasum": "" + }, + "require": { + "composer/semver": "^3.2", + "composer/xdebug-handler": "^2.0", + "doctrine/annotations": "^1.12", + "ext-json": "*", + "ext-tokenizer": "*", + "php": "^7.2.5 || ^8.0", + "php-cs-fixer/diff": "^2.0", + "symfony/console": "^4.4.20 || ^5.1.3 || ^6.0", + "symfony/event-dispatcher": "^4.4.20 || ^5.0 || ^6.0", + "symfony/filesystem": "^4.4.20 || ^5.0 || ^6.0", + "symfony/finder": "^4.4.20 || ^5.0 || ^6.0", + "symfony/options-resolver": "^4.4.20 || ^5.0 || ^6.0", + "symfony/polyfill-mbstring": "^1.23", + "symfony/polyfill-php80": "^1.23", + "symfony/polyfill-php81": "^1.23", + "symfony/process": "^4.4.20 || ^5.0 || ^6.0", + "symfony/stopwatch": "^4.4.20 || ^5.0 || ^6.0" + }, + "require-dev": { + "justinrainbow/json-schema": "^5.2", + "keradus/cli-executor": "^1.5", + "mikey179/vfsstream": "^1.6.8", + "php-coveralls/php-coveralls": "^2.5.2", + "php-cs-fixer/accessible-object": "^1.1", "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.2", "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.2.1", + "phpspec/prophecy": "^1.15", "phpspec/prophecy-phpunit": "^1.1 || ^2.0", - "phpunit/phpunit": "^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.13 || ^9.5", + "phpunit/phpunit": "^8.5.21 || ^9.5", "phpunitgoodpractices/polyfill": "^1.5", "phpunitgoodpractices/traits": "^1.9.1", - "sanmai/phpunit-legacy-adapter": "^6.4 || ^8.2.1", - "symfony/phpunit-bridge": "^5.2.1", - "symfony/yaml": "^3.0 || ^4.0 || ^5.0" + "symfony/phpunit-bridge": "^5.2.4 || ^6.0", + "symfony/yaml": "^4.4.20 || ^5.0 || ^6.0" }, "suggest": { "ext-dom": "For handling output formats in XML", - "ext-mbstring": "For handling non-UTF8 characters.", - "php-cs-fixer/phpunit-constraint-isidenticalstring": "For IsIdenticalString constraint.", - "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "For XmlMatchesXsd constraint.", - "symfony/polyfill-mbstring": "When enabling `ext-mbstring` is not possible." + "ext-mbstring": "For handling non-UTF8 characters." }, "bin": [ "php-cs-fixer" ], "type": "application", - "extra": { - "branch-alias": { - "dev-master": "2.19-dev" - } - }, "autoload": { "psr-4": { "PhpCsFixer\\": "src/" - }, - "classmap": [ - "tests/Test/AbstractFixerTestCase.php", - "tests/Test/AbstractIntegrationCaseFactory.php", - "tests/Test/AbstractIntegrationTestCase.php", - "tests/Test/Assert/AssertTokensTrait.php", - "tests/Test/IntegrationCase.php", - "tests/Test/IntegrationCaseFactory.php", - "tests/Test/IntegrationCaseFactoryInterface.php", - "tests/Test/InternalIntegrationCaseFactory.php", - "tests/Test/IsIdenticalConstraint.php", - "tests/Test/TokensWithObservedTransformers.php", - "tests/TestCase.php" - ] + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -542,7 +943,7 @@ "description": "A tool to automatically fix PHP code style", "support": { "issues": "https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues", - "source": "https://github.com/FriendsOfPHP/PHP-CS-Fixer/tree/v2.19.3" + "source": "https://github.com/FriendsOfPHP/PHP-CS-Fixer/tree/v3.4.0" }, "funding": [ { @@ -550,7 +951,7 @@ "type": "github" } ], - "time": "2021-11-15T17:17:55+00:00" + "time": "2021-12-11T16:25:08+00:00" }, { "name": "myclabs/deep-copy", @@ -612,22 +1013,73 @@ "time": "2022-03-03T13:19:32+00:00" }, { - "name": "nextcloud/coding-standard", - "version": "v0.5.0", + "name": "netresearch/jsonmapper", + "version": "v4.0.0", "source": { "type": "git", - "url": "https://github.com/nextcloud/coding-standard.git", - "reference": "742ed895ae76c10daf95e08488cfb3f554199f40" + "url": "https://github.com/cweiske/jsonmapper.git", + "reference": "8bbc021a8edb2e4a7ea2f8ad4fa9ec9dce2fcb8d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nextcloud/coding-standard/zipball/742ed895ae76c10daf95e08488cfb3f554199f40", - "reference": "742ed895ae76c10daf95e08488cfb3f554199f40", + "url": "https://api.github.com/repos/cweiske/jsonmapper/zipball/8bbc021a8edb2e4a7ea2f8ad4fa9ec9dce2fcb8d", + "reference": "8bbc021a8edb2e4a7ea2f8ad4fa9ec9dce2fcb8d", "shasum": "" }, "require": { - "friendsofphp/php-cs-fixer": "^2.17", - "php": "^7.2|^8.0" + "ext-json": "*", + "ext-pcre": "*", + "ext-reflection": "*", + "ext-spl": "*", + "php": ">=7.1" + }, + "require-dev": { + "phpunit/phpunit": "~7.5 || ~8.0 || ~9.0", + "squizlabs/php_codesniffer": "~3.5" + }, + "type": "library", + "autoload": { + "psr-0": { + "JsonMapper": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "OSL-3.0" + ], + "authors": [ + { + "name": "Christian Weiske", + "email": "cweiske@cweiske.de", + "homepage": "http://github.com/cweiske/jsonmapper/", + "role": "Developer" + } + ], + "description": "Map nested JSON structures onto PHP classes", + "support": { + "email": "cweiske@cweiske.de", + "issues": "https://github.com/cweiske/jsonmapper/issues", + "source": "https://github.com/cweiske/jsonmapper/tree/v4.0.0" + }, + "time": "2020-12-01T19:48:11+00:00" + }, + { + "name": "nextcloud/coding-standard", + "version": "v1.0.0", + "source": { + "type": "git", + "url": "https://github.com/nextcloud/coding-standard.git", + "reference": "f3d1f9375e89c605deb1734f59a9f51ecbe80578" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nextcloud/coding-standard/zipball/f3d1f9375e89c605deb1734f59a9f51ecbe80578", + "reference": "f3d1f9375e89c605deb1734f59a9f51ecbe80578", + "shasum": "" + }, + "require": { + "friendsofphp/php-cs-fixer": "^3.2", + "php": "^7.3|^8.0" }, "type": "library", "autoload": { @@ -648,9 +1100,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/v0.5.0" + "source": "https://github.com/nextcloud/coding-standard/tree/v1.0.0" }, - "time": "2021-01-11T14:15:58+00:00" + "time": "2021-11-10T08:44:10+00:00" }, { "name": "nikic/php-parser", @@ -708,6 +1160,59 @@ }, "time": "2021-11-30T19:35:32+00:00" }, + { + "name": "openlss/lib-array2xml", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/nullivex/lib-array2xml.git", + "reference": "a91f18a8dfc69ffabe5f9b068bc39bb202c81d90" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nullivex/lib-array2xml/zipball/a91f18a8dfc69ffabe5f9b068bc39bb202c81d90", + "reference": "a91f18a8dfc69ffabe5f9b068bc39bb202c81d90", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "type": "library", + "autoload": { + "psr-0": { + "LSS": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Bryan Tong", + "email": "bryan@nullivex.com", + "homepage": "https://www.nullivex.com" + }, + { + "name": "Tony Butler", + "email": "spudz76@gmail.com", + "homepage": "https://www.nullivex.com" + } + ], + "description": "Array2XML conversion library credit to lalit.org", + "homepage": "https://www.nullivex.com", + "keywords": [ + "array", + "array conversion", + "xml", + "xml conversion" + ], + "support": { + "issues": "https://github.com/nullivex/lib-array2xml/issues", + "source": "https://github.com/nullivex/lib-array2xml/tree/master" + }, + "time": "2019-03-29T20:06:56+00:00" + }, { "name": "phar-io/manifest", "version": "2.0.3", @@ -821,16 +1326,16 @@ }, { "name": "php-cs-fixer/diff", - "version": "v1.3.1", + "version": "v2.0.2", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/diff.git", - "reference": "dbd31aeb251639ac0b9e7e29405c1441907f5759" + "reference": "29dc0d507e838c4580d018bd8b5cb412474f7ec3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/diff/zipball/dbd31aeb251639ac0b9e7e29405c1441907f5759", - "reference": "dbd31aeb251639ac0b9e7e29405c1441907f5759", + "url": "https://api.github.com/repos/PHP-CS-Fixer/diff/zipball/29dc0d507e838c4580d018bd8b5cb412474f7ec3", + "reference": "29dc0d507e838c4580d018bd8b5cb412474f7ec3", "shasum": "" }, "require": { @@ -858,21 +1363,18 @@ { "name": "Kore Nordmann", "email": "mail@kore-nordmann.de" - }, - { - "name": "SpacePossum" } ], - "description": "sebastian/diff v2 backport support for PHP5.6", + "description": "sebastian/diff v3 backport support for PHP 5.6+", "homepage": "https://github.com/PHP-CS-Fixer", "keywords": [ "diff" ], "support": { "issues": "https://github.com/PHP-CS-Fixer/diff/issues", - "source": "https://github.com/PHP-CS-Fixer/diff/tree/v1.3.1" + "source": "https://github.com/PHP-CS-Fixer/diff/tree/v2.0.2" }, - "time": "2020-10-14T08:39:05+00:00" + "time": "2020-10-14T08:32:19+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -2936,16 +3438,16 @@ }, { "name": "symfony/event-dispatcher-contracts", - "version": "v2.5.0", + "version": "v2.5.1", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher-contracts.git", - "reference": "66bea3b09be61613cd3b4043a65a8ec48cfa6d2a" + "reference": "f98b54df6ad059855739db6fcbc2d36995283fe1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/66bea3b09be61613cd3b4043a65a8ec48cfa6d2a", - "reference": "66bea3b09be61613cd3b4043a65a8ec48cfa6d2a", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/f98b54df6ad059855739db6fcbc2d36995283fe1", + "reference": "f98b54df6ad059855739db6fcbc2d36995283fe1", "shasum": "" }, "require": { @@ -2995,7 +3497,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v2.5.0" + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v2.5.1" }, "funding": [ { @@ -3011,20 +3513,20 @@ "type": "tidelift" } ], - "time": "2021-07-12T14:48:14+00:00" + "time": "2022-01-02T09:53:40+00:00" }, { "name": "symfony/filesystem", - "version": "v5.4.6", + "version": "v5.4.7", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "d53a45039974952af7f7ebc461ccdd4295e29440" + "reference": "3a4442138d80c9f7b600fb297534ac718b61d37f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/d53a45039974952af7f7ebc461ccdd4295e29440", - "reference": "d53a45039974952af7f7ebc461ccdd4295e29440", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/3a4442138d80c9f7b600fb297534ac718b61d37f", + "reference": "3a4442138d80c9f7b600fb297534ac718b61d37f", "shasum": "" }, "require": { @@ -3059,7 +3561,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v5.4.6" + "source": "https://github.com/symfony/filesystem/tree/v5.4.7" }, "funding": [ { @@ -3075,7 +3577,7 @@ "type": "tidelift" } ], - "time": "2022-03-02T12:42:23+00:00" + "time": "2022-04-01T12:33:59+00:00" }, { "name": "symfony/finder", @@ -3539,150 +4041,6 @@ ], "time": "2021-11-30T18:21:41+00:00" }, - { - "name": "symfony/polyfill-php70", - "version": "v1.20.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php70.git", - "reference": "5f03a781d984aae42cebd18e7912fa80f02ee644" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/5f03a781d984aae42cebd18e7912fa80f02ee644", - "reference": "5f03a781d984aae42cebd18e7912fa80f02ee644", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "type": "metapackage", - "extra": { - "branch-alias": { - "dev-main": "1.20-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-php70/tree/v1.20.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2020-10-23T14:02:19+00:00" - }, - { - "name": "symfony/polyfill-php72", - "version": "v1.25.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "9a142215a36a3888e30d0a9eeea9766764e96976" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/9a142215a36a3888e30d0a9eeea9766764e96976", - "reference": "9a142215a36a3888e30d0a9eeea9766764e96976", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Php72\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-php72/tree/v1.25.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-05-27T09:17:38+00:00" - }, { "name": "symfony/polyfill-php73", "version": "v1.25.0", @@ -3846,17 +4204,96 @@ "time": "2022-03-04T08:16:47+00:00" }, { - "name": "symfony/process", - "version": "v5.4.5", + "name": "symfony/polyfill-php81", + "version": "v1.25.0", "source": { "type": "git", - "url": "https://github.com/symfony/process.git", - "reference": "95440409896f90a5f85db07a32b517ecec17fa4c" + "url": "https://github.com/symfony/polyfill-php81.git", + "reference": "5de4ba2d41b15f9bd0e19b2ab9674135813ec98f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/95440409896f90a5f85db07a32b517ecec17fa4c", - "reference": "95440409896f90a5f85db07a32b517ecec17fa4c", + "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/5de4ba2d41b15f9bd0e19b2ab9674135813ec98f", + "reference": "5de4ba2d41b15f9bd0e19b2ab9674135813ec98f", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php81\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php81/tree/v1.25.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-09-13T13:58:11+00:00" + }, + { + "name": "symfony/process", + "version": "v5.4.7", + "source": { + "type": "git", + "url": "https://github.com/symfony/process.git", + "reference": "38a44b2517b470a436e1c944bf9b9ba3961137fb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/process/zipball/38a44b2517b470a436e1c944bf9b9ba3961137fb", + "reference": "38a44b2517b470a436e1c944bf9b9ba3961137fb", "shasum": "" }, "require": { @@ -3889,7 +4326,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v5.4.5" + "source": "https://github.com/symfony/process/tree/v5.4.7" }, "funding": [ { @@ -3905,7 +4342,7 @@ "type": "tidelift" } ], - "time": "2022-01-30T18:16:22+00:00" + "time": "2022-03-18T16:18:52+00:00" }, { "name": "symfony/service-contracts", @@ -4188,6 +4625,112 @@ ], "time": "2021-07-28T10:34:58+00:00" }, + { + "name": "vimeo/psalm", + "version": "4.22.0", + "source": { + "type": "git", + "url": "https://github.com/vimeo/psalm.git", + "reference": "fc2c6ab4d5fa5d644d8617089f012f3bb84b8703" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/fc2c6ab4d5fa5d644d8617089f012f3bb84b8703", + "reference": "fc2c6ab4d5fa5d644d8617089f012f3bb84b8703", + "shasum": "" + }, + "require": { + "amphp/amp": "^2.4.2", + "amphp/byte-stream": "^1.5", + "composer/package-versions-deprecated": "^1.8.0", + "composer/semver": "^1.4 || ^2.0 || ^3.0", + "composer/xdebug-handler": "^1.1 || ^2.0 || ^3.0", + "dnoegel/php-xdg-base-dir": "^0.1.1", + "ext-ctype": "*", + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-simplexml": "*", + "ext-tokenizer": "*", + "felixfbecker/advanced-json-rpc": "^3.0.3", + "felixfbecker/language-server-protocol": "^1.5", + "netresearch/jsonmapper": "^1.0 || ^2.0 || ^3.0 || ^4.0", + "nikic/php-parser": "^4.13", + "openlss/lib-array2xml": "^1.0", + "php": "^7.1|^8", + "sebastian/diff": "^3.0 || ^4.0", + "symfony/console": "^3.4.17 || ^4.1.6 || ^5.0 || ^6.0", + "webmozart/path-util": "^2.3" + }, + "provide": { + "psalm/psalm": "self.version" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.2", + "brianium/paratest": "^4.0||^6.0", + "ext-curl": "*", + "php-parallel-lint/php-parallel-lint": "^1.2", + "phpdocumentor/reflection-docblock": "^5", + "phpmyadmin/sql-parser": "5.1.0||dev-master", + "phpspec/prophecy": ">=1.9.0", + "phpunit/phpunit": "^9.0", + "psalm/plugin-phpunit": "^0.16", + "slevomat/coding-standard": "^7.0", + "squizlabs/php_codesniffer": "^3.5", + "symfony/process": "^4.3 || ^5.0 || ^6.0", + "weirdan/prophecy-shim": "^1.0 || ^2.0" + }, + "suggest": { + "ext-curl": "In order to send data to shepherd", + "ext-igbinary": "^2.0.5 is required, used to serialize caching data" + }, + "bin": [ + "psalm", + "psalm-language-server", + "psalm-plugin", + "psalm-refactor", + "psalter" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.x-dev", + "dev-3.x": "3.x-dev", + "dev-2.x": "2.x-dev", + "dev-1.x": "1.x-dev" + } + }, + "autoload": { + "files": [ + "src/functions.php", + "src/spl_object_id.php" + ], + "psr-4": { + "Psalm\\": "src/Psalm/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Matthew Brown" + } + ], + "description": "A static analysis tool for finding errors in PHP applications", + "keywords": [ + "code", + "inspection", + "php" + ], + "support": { + "issues": "https://github.com/vimeo/psalm/issues", + "source": "https://github.com/vimeo/psalm/tree/4.22.0" + }, + "time": "2022-02-24T20:34:05+00:00" + }, { "name": "webmozart/assert", "version": "1.10.0", @@ -4245,11 +4788,64 @@ "source": "https://github.com/webmozarts/assert/tree/1.10.0" }, "time": "2021-03-09T10:59:23+00:00" + }, + { + "name": "webmozart/path-util", + "version": "2.3.0", + "source": { + "type": "git", + "url": "https://github.com/webmozart/path-util.git", + "reference": "d939f7edc24c9a1bb9c0dee5cb05d8e859490725" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozart/path-util/zipball/d939f7edc24c9a1bb9c0dee5cb05d8e859490725", + "reference": "d939f7edc24c9a1bb9c0dee5cb05d8e859490725", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "webmozart/assert": "~1.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.6", + "sebastian/version": "^1.0.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.3-dev" + } + }, + "autoload": { + "psr-4": { + "Webmozart\\PathUtil\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "A robust cross-platform utility for normalizing, comparing and modifying file paths.", + "support": { + "issues": "https://github.com/webmozart/path-util/issues", + "source": "https://github.com/webmozart/path-util/tree/2.3.0" + }, + "abandoned": "symfony/filesystem", + "time": "2015-12-17T08:42:14+00:00" } ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": { + "christophwurst/nextcloud": 20 + }, "prefer-stable": false, "prefer-lowest": false, "platform": [], @@ -4257,5 +4853,5 @@ "platform-overrides": { "php": "7.4" }, - "plugin-api-version": "2.0.0" + "plugin-api-version": "2.2.0" } diff --git a/lib/Circles/FileSharingBroadcaster.php b/lib/Circles/FileSharingBroadcaster.php index 316ab835..2a564319 100644 --- a/lib/Circles/FileSharingBroadcaster.php +++ b/lib/Circles/FileSharingBroadcaster.php @@ -453,9 +453,8 @@ class FileSharingBroadcaster implements IBroadcaster { $senderName = $this->l10n->t('%s on %s', [$author, $instanceName]); $message->setFrom([Util::getDefaultEmailAddress($instanceName) => $senderName]); - $message->setSubject($subject); - $message->setPlainBody($emailTemplate->renderText()); - $message->setHtmlBody($emailTemplate->renderHtml()); + $emailTemplate->setSubject($subject); + $message->useTemplate($emailTemplate); $message->setTo([$email]); $this->mailer->send($message); diff --git a/lib/Command/CirclesMaintenance.php b/lib/Command/CirclesMaintenance.php index f479b9be..fe42cf9a 100644 --- a/lib/Command/CirclesMaintenance.php +++ b/lib/Command/CirclesMaintenance.php @@ -109,7 +109,7 @@ class CirclesMaintenance extends Base { $level = (int)$input->getOption('level'); if ($reset || $uninstall) { - $action = strtolower(($uninstall) ? 'uninstall' : 'reset'); + $action = $uninstall ? 'uninstall' : 'reset'; $output->writeln(''); $output->writeln(''); diff --git a/lib/Command/CirclesMemberships.php b/lib/Command/CirclesMemberships.php index 415c88bb..92483209 100644 --- a/lib/Command/CirclesMemberships.php +++ b/lib/Command/CirclesMemberships.php @@ -204,7 +204,7 @@ class CirclesMemberships extends Base { } $type = Member::parseTypeString($input->getOption('type')); - $federatedUser = $this->federatedUserService->getFederatedUser($userId, (int)$type); + $federatedUser = $this->federatedUserService->getFederatedUser($userId, $type); // if ($this->input->getOption('reset')) { // $this->membershipsService->resetMemberships($federatedUser->getSingleId()); diff --git a/lib/Controller/AdminController.php b/lib/Controller/AdminController.php index 37d7d31a..2b7f6bb9 100644 --- a/lib/Controller/AdminController.php +++ b/lib/Controller/AdminController.php @@ -63,7 +63,7 @@ use OCP\IUserSession; * * @package OCA\Circles\Controller */ -class AdminController extends OcsController { +class AdminController extends OCSController { use TDeserialize; use TNCLogger; @@ -156,7 +156,7 @@ class AdminController extends OcsController { 'local' => $local ] ); - throw new OcsException($e->getMessage(), $e->getCode()); + throw new OCSException($e->getMessage(), (int)$e->getCode()); } } @@ -176,7 +176,7 @@ class AdminController extends OcsController { return new DataResponse($this->serializeArray($circle)); } catch (Exception $e) { $this->e($e, ['emulated' => $emulated, 'circleId' => $circleId]); - throw new OcsException($e->getMessage(), $e->getCode()); + throw new OCSException($e->getMessage(), (int)$e->getCode()); } } @@ -217,7 +217,7 @@ class AdminController extends OcsController { 'type' => $type ] ); - throw new OCSException($e->getMessage(), $e->getCode()); + throw new OCSException($e->getMessage(), (int)$e->getCode()); } } @@ -254,7 +254,7 @@ class AdminController extends OcsController { 'level' => $level ] ); - throw new OcsException($e->getMessage(), $e->getCode()); + throw new OCSException($e->getMessage(), (int)$e->getCode()); } } @@ -280,7 +280,7 @@ class AdminController extends OcsController { return new DataResponse($this->serializeArray($this->circleService->getCircles($probe))); } catch (Exception $e) { $this->e($e, ['emulated' => $emulated]); - throw new OCSException($e->getMessage(), $e->getCode()); + throw new OCSException($e->getMessage(), (int)$e->getCode()); } } @@ -302,7 +302,7 @@ class AdminController extends OcsController { return new DataResponse($this->serialize($this->circleService->getCircle($circleId, $probe))); } catch (Exception $e) { $this->e($e, ['emulated' => $emulated, 'circleId' => $circleId]); - throw new OcsException($e->getMessage(), $e->getCode()); + throw new OCSException($e->getMessage(), (int)$e->getCode()); } } @@ -322,7 +322,7 @@ class AdminController extends OcsController { return new DataResponse($this->serializeArray($result)); } catch (Exception $e) { $this->e($e, ['emulated' => $emulated, 'circleId' => $circleId]); - throw new OCSException($e->getMessage(), $e->getCode()); + throw new OCSException($e->getMessage(), (int)$e->getCode()); } } @@ -342,7 +342,7 @@ class AdminController extends OcsController { return new DataResponse($this->serializeArray($result)); } catch (Exception $e) { $this->e($e, ['emulated' => $emulated, 'circleId' => $circleId]); - throw new OCSException($e->getMessage(), $e->getCode()); + throw new OCSException($e->getMessage(), (int)$e->getCode()); } } @@ -368,7 +368,7 @@ class AdminController extends OcsController { return new DataResponse($this->serializeArray($result)); } catch (Exception $e) { $this->e($e, ['emulated' => $emulated, 'circleId' => $circleId, 'memberId' => $memberId]); - throw new OCSException($e->getMessage(), $e->getCode()); + throw new OCSException($e->getMessage(), (int)$e->getCode()); } } @@ -391,7 +391,7 @@ class AdminController extends OcsController { return new DataResponse($this->serializeArray($result)); } catch (Exception $e) { $this->e($e, ['emulated' => $emulated, 'circleId' => $circleId, 'memberId' => $memberId]); - throw new OCSException($e->getMessage(), $e->getCode()); + throw new OCSException($e->getMessage(), (int)$e->getCode()); } } @@ -410,7 +410,7 @@ class AdminController extends OcsController { return new DataResponse($this->serializeArray($this->memberService->getMembers($circleId))); } catch (Exception $e) { $this->e($e, ['emulated' => $emulated, 'circleId' => $circleId]); - throw new OCSException($e->getMessage(), $e->getCode()); + throw new OCSException($e->getMessage(), (int)$e->getCode()); } } @@ -432,7 +432,7 @@ class AdminController extends OcsController { return new DataResponse($this->serializeArray($outcome)); } catch (Exception $e) { $this->e($e, ['emulated' => $emulated, 'circleId' => $circleId, 'value' => $value]); - throw new OCSException($e->getMessage(), $e->getCode()); + throw new OCSException($e->getMessage(), (int)$e->getCode()); } } @@ -454,7 +454,7 @@ class AdminController extends OcsController { return new DataResponse($this->serializeArray($outcome)); } catch (Exception $e) { $this->e($e, ['emulated' => $emulated, 'circleId' => $circleId, 'value' => $value]); - throw new OCSException($e->getMessage(), $e->getCode()); + throw new OCSException($e->getMessage(), (int)$e->getCode()); } } @@ -477,7 +477,7 @@ class AdminController extends OcsController { return new DataResponse($this->serializeArray($outcome)); } catch (Exception $e) { $this->e($e, ['circleId' => $circleId, 'setting' => $setting, 'value' => $value]); - throw new OCSException($e->getMessage(), $e->getCode()); + throw new OCSException($e->getMessage(), (int)$e->getCode()); } } @@ -502,7 +502,7 @@ class AdminController extends OcsController { return new DataResponse($this->serializeArray($outcome)); } catch (Exception $e) { $this->e($e, ['emulated' => $emulated, 'circleId' => $circleId, 'value' => $value]); - throw new OCSException($e->getMessage(), $e->getCode()); + throw new OCSException($e->getMessage(), (int)$e->getCode()); } } @@ -523,7 +523,7 @@ class AdminController extends OcsController { return new DataResponse($this->serialize($membership)); } catch (Exception $e) { $this->e($e, ['emulated' => $emulated, 'circleId' => $circleId, 'singleId' => $singleId]); - throw new OCSException($e->getMessage(), $e->getCode()); + throw new OCSException($e->getMessage(), (int)$e->getCode()); } } diff --git a/lib/Controller/EventWrapperController.php b/lib/Controller/EventWrapperController.php index 0e09afe4..fd2ca5a8 100644 --- a/lib/Controller/EventWrapperController.php +++ b/lib/Controller/EventWrapperController.php @@ -118,7 +118,7 @@ class EventWrapperController extends Controller { public function asyncBroadcast(string $token): DataResponse { $wrappers = $this->remoteUpstreamService->getEventsByToken($token); if (empty($wrappers) && $token !== 'test-dummy-token') { - return new DataResponse(null, Http::STATUS_OK); + return new DataResponse([], Http::STATUS_OK); } // closing socket, keep current process running. diff --git a/lib/Controller/LocalController.php b/lib/Controller/LocalController.php index efa78363..8a3bf6db 100644 --- a/lib/Controller/LocalController.php +++ b/lib/Controller/LocalController.php @@ -61,7 +61,7 @@ use OCP\IUserSession; * * @package OCA\Circles\Controller */ -class LocalController extends OcsController { +class LocalController extends OCSController { use TDeserialize; use TNCLogger; @@ -145,7 +145,7 @@ class LocalController extends OcsController { return new DataResponse($this->serializeArray($circle)); } catch (Exception $e) { $this->e($e, ['name' => $name, 'members' => $personal, 'local' => $local]); - throw new OcsException($e->getMessage(), $e->getCode()); + throw new OCSException($e->getMessage(), (int)$e->getCode()); } } @@ -167,7 +167,7 @@ class LocalController extends OcsController { return new DataResponse($this->serializeArray($circle)); } catch (Exception $e) { $this->e($e, ['circleId' => $circleId]); - throw new OcsException($e->getMessage(), $e->getCode()); + throw new OCSException($e->getMessage(), (int)$e->getCode()); } } @@ -187,7 +187,7 @@ class LocalController extends OcsController { return new DataResponse($this->serializeArray($this->searchService->search($term))); } catch (Exception $e) { $this->e($e, ['term' => $term]); - throw new OcsException($e->getMessage(), $e->getCode()); + throw new OCSException($e->getMessage(), (int)$e->getCode()); } } @@ -210,7 +210,7 @@ class LocalController extends OcsController { return new DataResponse($this->serialize($this->circleService->getCircle($circleId, $probe))); } catch (Exception $e) { $this->e($e, ['circleId' => $circleId]); - throw new OcsException($e->getMessage(), $e->getCode()); + throw new OCSException($e->getMessage(), (int)$e->getCode()); } } @@ -245,7 +245,7 @@ class LocalController extends OcsController { return new DataResponse($this->serializeArray($result)); } catch (Exception $e) { $this->e($e, ['circleId' => $circleId, 'userId' => $userId, 'type' => $type]); - throw new OCSException($e->getMessage(), $e->getCode()); + throw new OCSException($e->getMessage(), (int)$e->getCode()); } } @@ -277,7 +277,7 @@ class LocalController extends OcsController { return new DataResponse($this->serializeArray($result)); } catch (Exception $e) { $this->e($e, ['circleId' => $circleId, 'members' => $members]); - throw new OCSException($e->getMessage(), $e->getCode()); + throw new OCSException($e->getMessage(), (int)$e->getCode()); } } @@ -299,7 +299,7 @@ class LocalController extends OcsController { return new DataResponse($this->serializeArray($result)); } catch (Exception $e) { $this->e($e, ['circleId' => $circleId]); - throw new OCSException($e->getMessage(), $e->getCode()); + throw new OCSException($e->getMessage(), (int)$e->getCode()); } } @@ -321,7 +321,7 @@ class LocalController extends OcsController { return new DataResponse($this->serializeArray($result)); } catch (Exception $e) { $this->e($e, ['circleId' => $circleId]); - throw new OCSException($e->getMessage(), $e->getCode()); + throw new OCSException($e->getMessage(), (int)$e->getCode()); } } @@ -352,7 +352,7 @@ class LocalController extends OcsController { return new DataResponse($this->serializeArray($result)); } catch (Exception $e) { $this->e($e, ['circleId' => $circleId, 'memberId' => $memberId, 'level' => $level]); - throw new OcsException($e->getMessage(), $e->getCode()); + throw new OCSException($e->getMessage(), (int)$e->getCode()); } } @@ -379,7 +379,7 @@ class LocalController extends OcsController { return new DataResponse($this->serializeArray($result)); } catch (Exception $e) { $this->e($e, ['circleId' => $circleId, 'memberId' => $memberId]); - throw new OCSException($e->getMessage(), $e->getCode()); + throw new OCSException($e->getMessage(), (int)$e->getCode()); } } @@ -403,7 +403,7 @@ class LocalController extends OcsController { return new DataResponse($this->serializeArray($result)); } catch (Exception $e) { $this->e($e, ['circleId' => $circleId, 'memberId' => $memberId]); - throw new OCSException($e->getMessage(), $e->getCode()); + throw new OCSException($e->getMessage(), (int)$e->getCode()); } } @@ -431,7 +431,7 @@ class LocalController extends OcsController { return new DataResponse($this->serializeArray($this->circleService->getCircles($probe))); } catch (Exception $e) { $this->e($e); - throw new OCSException($e->getMessage(), $e->getCode()); + throw new OCSException($e->getMessage(), (int)$e->getCode()); } } @@ -451,7 +451,7 @@ class LocalController extends OcsController { return new DataResponse($this->serializeArray($this->memberService->getMembers($circleId))); } catch (Exception $e) { $this->e($e, ['circleId' => $circleId]); - throw new OCSException($e->getMessage(), $e->getCode()); + throw new OCSException($e->getMessage(), (int)$e->getCode()); } } @@ -474,7 +474,7 @@ class LocalController extends OcsController { return new DataResponse($this->serializeArray($outcome)); } catch (Exception $e) { $this->e($e, ['circleId' => $circleId, 'value' => $value]); - throw new OCSException($e->getMessage(), $e->getCode()); + throw new OCSException($e->getMessage(), (int)$e->getCode()); } } @@ -497,7 +497,7 @@ class LocalController extends OcsController { return new DataResponse($this->serializeArray($outcome)); } catch (Exception $e) { $this->e($e, ['circleId' => $circleId, 'value' => $value]); - throw new OCSException($e->getMessage(), $e->getCode()); + throw new OCSException($e->getMessage(), (int)$e->getCode()); } } @@ -521,7 +521,7 @@ class LocalController extends OcsController { return new DataResponse($this->serializeArray($outcome)); } catch (Exception $e) { $this->e($e, ['circleId' => $circleId, 'setting' => $setting, 'value' => $value]); - throw new OCSException($e->getMessage(), $e->getCode()); + throw new OCSException($e->getMessage(), (int)$e->getCode()); } } @@ -544,7 +544,7 @@ class LocalController extends OcsController { return new DataResponse($this->serializeArray($outcome)); } catch (Exception $e) { $this->e($e, ['circleId' => $circleId, 'value' => $value]); - throw new OCSException($e->getMessage(), $e->getCode()); + throw new OCSException($e->getMessage(), (int)$e->getCode()); } } @@ -566,7 +566,7 @@ class LocalController extends OcsController { return new DataResponse($this->serialize($membership)); } catch (Exception $e) { $this->e($e, ['circleId' => $circleId, 'singleId' => $singleId]); - throw new OCSException($e->getMessage(), $e->getCode()); + throw new OCSException($e->getMessage(), (int)$e->getCode()); } } diff --git a/lib/Db/CircleProviderRequestBuilder.php b/lib/Db/CircleProviderRequestBuilder.php index b401151f..7f06e27a 100644 --- a/lib/Db/CircleProviderRequestBuilder.php +++ b/lib/Db/CircleProviderRequestBuilder.php @@ -410,7 +410,7 @@ class CircleProviderRequestBuilder extends DeprecatedRequestBuilder { ->setValue('password', $qb->createNamedParameter($password)) ->setValue('permissions', $qb->createNamedParameter($share->getPermissions())) ->setValue('token', $qb->createNamedParameter($share->getToken())) - ->setValue('stime', $qb->createFunction('UNIX_TIMESTAMP()')); + ->setValue('stime', (string)$qb->createFunction('UNIX_TIMESTAMP()')); return $qb; } diff --git a/lib/Db/MemberRequestBuilder.php b/lib/Db/MemberRequestBuilder.php index 6e87c0bb..9fa31f3c 100644 --- a/lib/Db/MemberRequestBuilder.php +++ b/lib/Db/MemberRequestBuilder.php @@ -130,7 +130,7 @@ class MemberRequestBuilder extends CoreRequestBuilder { * @param CoreQueryBuilder $qb * @param bool $asFederatedUser * - * @return Member|FederatedUser[] + * @return Member[]|FederatedUser[] */ public function getItemsFromRequest(CoreQueryBuilder $qb, bool $asFederatedUser = false): array { $object = Member::class; diff --git a/lib/Db/ShareWrapperRequestBuilder.php b/lib/Db/ShareWrapperRequestBuilder.php index 87762143..19f6efc4 100644 --- a/lib/Db/ShareWrapperRequestBuilder.php +++ b/lib/Db/ShareWrapperRequestBuilder.php @@ -32,7 +32,7 @@ declare(strict_types=1); namespace OCA\Circles\Db; use OCA\Circles\Tools\Exceptions\RowNotFoundException; -use OC\Share20\Share; +use OCP\Share\IShare; use OCA\Circles\Exceptions\ShareWrapperNotFoundException; use OCA\Circles\Model\ShareWrapper; @@ -74,7 +74,7 @@ class ShareWrapperRequestBuilder extends CoreRequestBuilder { protected function getShareSelectSql(string $alias = CoreQueryBuilder::SHARE): CoreQueryBuilder { $qb = $this->getQueryBuilder(); $qb->generateSelect(self::TABLE_SHARE, self::$outsideTables[self::TABLE_SHARE], $alias) - ->limitToShareType(Share::TYPE_CIRCLE); + ->limitToShareType(IShare::TYPE_CIRCLE); return $qb; } @@ -88,7 +88,7 @@ class ShareWrapperRequestBuilder extends CoreRequestBuilder { protected function getShareDeleteSql(): CoreQueryBuilder { $qb = $this->getQueryBuilder(); $qb->delete(self::TABLE_SHARE) - ->limitToShareType(Share::TYPE_CIRCLE); + ->limitToShareType(IShare::TYPE_CIRCLE); return $qb; } diff --git a/lib/Model/ShareWrapper.php b/lib/Model/ShareWrapper.php index 2a242f99..1e2d656d 100644 --- a/lib/Model/ShareWrapper.php +++ b/lib/Model/ShareWrapper.php @@ -37,6 +37,7 @@ use OCA\Circles\Tools\IDeserializable; use OCA\Circles\Tools\Traits\TDeserialize; use OCA\Circles\Tools\Traits\TArrayTools; use DateTime; +use DateTimeInterface; use JsonSerializable; use OC; use OC\Files\Cache\Cache; @@ -58,555 +59,285 @@ class ShareWrapper extends ManagedModel implements IDeserializable, IQueryRow, J use TArrayTools; use TDeserialize; + private string $id = ''; + private int $permissions = 0; + private string $itemType = ''; + private int $itemSource = 0; + private string $itemTarget = ''; + private int $fileSource = 0; + private string $fileTarget = ''; + private string $token = ''; + private int $status = 0; + private string $providerId = ''; + private DateTimeInterface $shareTime; + private string $sharedWith = ''; + private string $sharedBy = ''; + private string $shareOwner = ''; + private int $shareType = 0; + private ?Circle $circle = null; + private int $childId = 0; + private string $childFileTarget = ''; + private int $childPermissions = 0; + private ?FileCacheWrapper $fileCache = null; + private ?Member $initiator = null; + private ?Member $owner = null; + private ?ShareToken $shareToken = null; - /** @var string */ - private $id = ''; + public function __construct() { + $this->shareTime = new DateTime(); + } - /** @var int */ - private $permissions = 0; - - /** @var string */ - private $itemType = ''; - - /** @var int */ - private $itemSource = 0; - - /** @var string */ - private $itemTarget = ''; - - /** @var int */ - private $fileSource = 0; - - /** @var string */ - private $fileTarget = ''; - - /** @var string */ - private $token = ''; - - /** @var int */ - private $status = 0; - - /** @var string */ - private $providerId = ''; - - /** @var DateTime */ - private $shareTime = ''; - - /** @var string */ - private $sharedWith = ''; - - /** @var string */ - private $sharedBy = ''; - - /** @var string */ - private $shareOwner = ''; - - /** @var int */ - private $shareType = 0; - - /** @var Circle */ - private $circle; - - /** @var int */ - private $childId = 0; - - /** @var string */ - private $childFileTarget = ''; - - /** @var int */ - private $childPermissions = 0; - - /** @var FileCacheWrapper */ - private $fileCache; - - /** @var Member */ - private $initiator; - - /** @var Member */ - private $owner; - - /** @var ShareToken */ - private $shareToken; - - - /** - * @param string $id - * - * @return ShareWrapper - */ public function setId(string $id): self { $this->id = $id; return $this; } - /** - * @return string - */ public function getId(): string { return $this->id; } - - /** - * @param int $permissions - * - * @return ShareWrapper - */ public function setPermissions(int $permissions): self { $this->permissions = $permissions; return $this; } - /** - * @return int - */ public function getPermissions(): int { return $this->permissions; } - - /** - * @param string $itemType - * - * @return ShareWrapper - */ public function setItemType(string $itemType): self { $this->itemType = $itemType; return $this; } - /** - * @return string - */ public function getItemType(): string { return $this->itemType; } - - /** - * @param int $itemSource - * - * @return ShareWrapper - */ public function setItemSource(int $itemSource): self { $this->itemSource = $itemSource; return $this; } - /** - * @return int - */ public function getItemSource(): int { return $this->itemSource; } - - /** - * @param string $itemTarget - * - * @return ShareWrapper - */ public function setItemTarget(string $itemTarget): self { $this->itemTarget = $itemTarget; return $this; } - /** - * @return string - */ public function getItemTarget(): string { return $this->itemTarget; } - - /** - * @param int $fileSource - * - * @return ShareWrapper - */ public function setFileSource(int $fileSource): self { $this->fileSource = $fileSource; return $this; } - /** - * @return int - */ public function getFileSource(): int { return $this->fileSource; } - - /** - * @param string $fileTarget - * - * @return ShareWrapper - */ public function setFileTarget(string $fileTarget): self { $this->fileTarget = $fileTarget; return $this; } - /** - * @return string - */ public function getFileTarget(): string { return $this->fileTarget; } - - /** - * @param string $token - * - * @return ShareWrapper - */ public function setToken(string $token): self { $this->token = $token; return $this; } - /** - * @return string - */ public function getToken(): string { return $this->token; } - - /** - * @param int $status - * - * @return ShareWrapper - */ public function setStatus(int $status): self { $this->status = $status; return $this; } - /** - * @return int - */ public function getStatus(): int { return $this->status; } - - /** - * @param string $providerId - * - * @return $this - */ public function setProviderId(string $providerId): self { $this->providerId = $providerId; return $this; } - /** - * @return string - */ public function getProviderId(): string { return $this->providerId; } - - /** - * @param DateTime $shareTime - * - * @return ShareWrapper - */ - public function setShareTime(DateTime $shareTime): self { + public function setShareTime(DateTimeInterface $shareTime): self { $this->shareTime = $shareTime; return $this; } - /** - * @return DateTime - */ - public function getShareTime(): DateTime { + public function getShareTime(): DateTimeInterface { return $this->shareTime; } - - /** - * @param string $sharedWith - * - * @return ShareWrapper - */ public function setSharedWith(string $sharedWith): self { $this->sharedWith = $sharedWith; return $this; } - /** - * @return string - */ public function getSharedWith(): string { return $this->sharedWith; } - /** - * @param string $sharedBy - * - * @return ShareWrapper - */ public function setSharedBy(string $sharedBy): self { $this->sharedBy = $sharedBy; return $this; } - /** - * @return string - */ public function getSharedBy(): string { return $this->sharedBy; } - - /** - * @param string $shareOwner - * - * @return ShareWrapper - */ public function setShareOwner(string $shareOwner): self { $this->shareOwner = $shareOwner; return $this; } - /** - * @return string - */ public function getShareOwner(): string { return $this->shareOwner; } - - /** - * @param int $shareType - * - * @return ShareWrapper - */ public function setShareType(int $shareType): self { $this->shareType = $shareType; return $this; } - /** - * @return int - */ public function getShareType(): int { return $this->shareType; } - - /** - * @param Circle $circle - * - * @return ShareWrapper - */ public function setCircle(Circle $circle): self { $this->circle = $circle; return $this; } - /** - * @return Circle - */ public function getCircle(): Circle { return $this->circle; } - /** - * @return bool - */ public function hasCircle(): bool { return (!is_null($this->circle)); } - - /** - * @param int $childId - * - * @return ShareWrapper - */ public function setChildId(int $childId): self { $this->childId = $childId; return $this; } - /** - * @return int - */ public function getChildId(): int { return $this->childId; } - - /** - * @param string $childFileTarget - * - * @return ShareWrapper - */ public function setChildFileTarget(string $childFileTarget): self { $this->childFileTarget = $childFileTarget; return $this; } - /** - * @return string - */ public function getChildFileTarget(): string { return $this->childFileTarget; } - - /** - * @param int $childPermissions - * - * @return ShareWrapper - */ public function setChildPermissions(int $childPermissions): self { $this->childPermissions = $childPermissions; return $this; } - /** - * @return int - */ public function getChildPermissions(): int { return $this->childPermissions; } - - /** - * @param FileCacheWrapper $fileCache - * - * @return $this - */ public function setFileCache(FileCacheWrapper $fileCache): self { $this->fileCache = $fileCache; return $this; } - /** - * @return FileCacheWrapper - */ public function getFileCache(): FileCacheWrapper { return $this->fileCache; } - /** - * @return bool - */ public function hasFileCache(): bool { return (!is_null($this->fileCache)); } - - /** - * @param Member $initiator - * - * @return ShareWrapper - */ public function setInitiator(Member $initiator): self { $this->initiator = $initiator; return $this; } - /** - * @return Member - */ public function getInitiator(): Member { return $this->initiator; } - /** - * @return bool - */ public function hasInitiator(): bool { return (!is_null($this->initiator)); } - - /** - * @param Member $owner - * - * @return ShareWrapper - */ public function setOwner(Member $owner): self { $this->owner = $owner; return $this; } - /** - * @return Member - */ public function getOwner(): Member { return $this->owner; } - /** - * @return bool - */ public function hasOwner(): bool { return (!is_null($this->owner)); } - - /** - * @param ShareToken $shareToken - * - * @return ShareWrapper - */ public function setShareToken(ShareToken $shareToken): self { $this->shareToken = $shareToken; return $this; } - /** - * @return ShareToken - */ public function getShareToken(): ShareToken { return $this->shareToken; } - /** - * @return bool - */ public function hasShareToken(): bool { return !is_null($this->shareToken); } - /** - * @param IRootFolder $rootFolder - * @param IUserManager $userManager - * @param IURLGenerator $urlGenerator - * @param bool $nullOnMissingFileCache - * - * @return IShare * @throws IllegalIDChangeException */ public function getShare( @@ -656,12 +387,7 @@ class ShareWrapper extends ManagedModel implements IDeserializable, IQueryRow, J return $share; } - - /** - * @param IShare $share - * @param IURLGenerator $urlGenerator - */ - private function setShareDisplay(IShare $share, IURLGenerator $urlGenerator) { + private function setShareDisplay(IShare $share, IURLGenerator $urlGenerator): void { if (!$this->hasCircle()) { return; } @@ -711,8 +437,6 @@ class ShareWrapper extends ManagedModel implements IDeserializable, IQueryRow, J /** * @param array $data - * - * @return IDeserializable * @throws InvalidItemException */ public function import(array $data): IDeserializable { @@ -776,13 +500,6 @@ class ShareWrapper extends ManagedModel implements IDeserializable, IQueryRow, J return $this; } - - /** - * @param array $data - * @param string $prefix - * - * @return IQueryRow - */ public function importFromDatabase(array $data, string $prefix = ''): IQueryRow { $shareTime = new DateTime(); $shareTime->setTimestamp($this->getInt($prefix . 'stime', $data)); @@ -818,10 +535,6 @@ class ShareWrapper extends ManagedModel implements IDeserializable, IQueryRow, J return $this; } - - /** - * @return string[] - */ public function jsonSerialize(): array { $arr = [ 'id' => $this->getId(), diff --git a/lib/Tools/Model/SimpleDataStore.php b/lib/Tools/Model/SimpleDataStore.php index 5c9a237f..09e672d1 100644 --- a/lib/Tools/Model/SimpleDataStore.php +++ b/lib/Tools/Model/SimpleDataStore.php @@ -43,7 +43,7 @@ class SimpleDataStore implements JsonSerializable { use TArrayTools; - /** @var array|JsonSerializable */ + /** @var array */ private $data; @@ -60,11 +60,7 @@ class SimpleDataStore implements JsonSerializable { $this->data = $data; } - - /** - * @param array $default - */ - public function default(array $default = []) { + public function default(array $default = []): void { $this->data = array_merge($default, $this->data); } @@ -474,7 +470,10 @@ class SimpleDataStore implements JsonSerializable { * @return $this */ public function obj(JsonSerializable $obj): self { - $this->data = $obj; + $data = $obj->jsonSerialize(); + if (is_array($data)) { + $this->data = $data; + } return $this; } diff --git a/psalm.xml b/psalm.xml new file mode 100644 index 00000000..eac4c173 --- /dev/null +++ b/psalm.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/psalm-baseline.xml b/tests/psalm-baseline.xml new file mode 100644 index 00000000..99644a99 --- /dev/null +++ b/tests/psalm-baseline.xml @@ -0,0 +1,916 @@ + + + + + $lang + + + + + array<string,string|integer> + + + null + + + Circles::generateAbsoluteLink($circle->getUniqueId()) + + + + + $share->getId() + $share->getId() + + + !$sendPasswordByMail + $sendPasswordByMail + + + Notifications + Share + Share + + + $this->federationNotifications + Notifications + + + setSubject($subject) + + + getLazyRootFolder + setHtmlBody + setPlainBody + setSubject + + + + + IFederatedUser + + + $this->federatedUserService->getCurrentUser() + + + + + Share + + + + + AppConfig + + + + + setType + + + + + IInteractiveShellClient + + + + + null + + + $compareToInitiator !== null + $compareToOwner !== null + + + $owner === null + + + + + Share + + + + + retrieveJson + + + + + getInstance + getInstance + getInvitedBy + getOwner + getSingleId + getStatus + hasInvitedBy + + + + + int|void|null + + + CardDavBackend + + + $this->cardDavBackend + $this->cardDavBackend + CardDavBackend + + + + + ($e->getCode() > 0) ? $e->getCode() : $httpErrorCode + + + + + Connection + + + dropTable + hasTable + + + + + $circle->getType() + + + $circle->getUniqueId(true) + $circleUniqueId + $circleUniqueId + (string)$uniqueId + -1 + + + + + ICompositeExpression + string + string + + + + string + + + null + null + null + null + + + + + UniqueConstraintViolationException + + + + + FederatedLink + + + $linkUniqueId + $linkUniqueId + $status + (string)$uniqueId + + + null + + + $link === null + + + + + self::SHARE_TYPE + self::SHARE_TYPE + + + + + $this->getItemsFromRequest($qb) + $this->getItemsFromRequest($qb) + $this->getItemsFromRequest($qb) + $this->getItemsFromRequest($qb) + $this->getItemsFromRequest($qb, true) + + + FederatedUser[] + Member[] + Member[] + Member[] + Member[] + + + + + $id + + + $getData + + + + + $shareId + $shareId + + + UniqueConstraintViolationException + + + + + CircleEventService + + + $this->circleEventService + CircleEventService + + + + + $mustBeChecked + + + + + $mustBeChecked + + + + + $mustBeChecked + + + + + $mustBeChecked + + + + + $mustBeChecked + + + !$sendPasswordByMail + $sendPasswordByMail + + + Share + + + setHtmlBody + setPlainBody + setSubject + + + + + $mustBeChecked + + + + + MoveableMount + + + + + Mount + Mount + + + getCertificateManager + + + isLocalNonSSL + + + + + $mustBeChecked + + + + + $mustBeChecked + + + setHtmlBody + setPlainBody + setSubject + + + + + $circle->getType() + + + $mustBeChecked + + + + + $mustBeChecked + + + + + $mustBeChecked + + + + + $mustBeChecked + + + + + $mustBeChecked + + + + + $mustBeChecked + + + + + $urlGenerator + + + $info + + + $response + + + URLGenerator + + + + + Share + Share + + + Share::SHARE_TYPE_CIRCLE + + + + + Connection + + + $this->connection + Connection + + + + + Types + + + + + $this->type + + + string + + + $this->getUniqueId() + + + (array)self::CIRCLES_SETTINGS_DEFAULT + + + + + DeprecatedMember + + + $member->getType() + + + self::fromArray(json_decode($json, true)) + + + + + self + + + + + $this->get('addressBookId', $data) + + + + + NCSignatory + + + + + $circleUniqueId + + + $this->circleUniqueId + + + string + + + $this->circleUniqueId + + + + + $arr + + + string[] + + + self + + + Circle|null + + + + + + string[] + + + + + setBasedOn + setDisplayName + setInstance + setSingleId + setUserId + setUserType + + + + + $inheritedBy + + + $arr + + + string[] + + + self + + + + + $this + + + + + Circle + FileCacheWrapper + Member + Member + ShareToken + + + $this->circle + $this->fileCache + $this->initiator + $this->owner + $this->shareToken + + + Share + + + + + $this->get('share_id', $data, '') + + + + + null + + + null + null + + + + + MoveableMount + + + + + CircleMount + + + ExternalStorage + + + + + false + + + $result + + + search + + + Contacts + + + $search + + + + + array + + + + + $result + + + array + + + $search + + + + + $result + + + search + + + LocalGroups + + + $search + + + + + $result + + + LocalUsers + + + $search + + + + + CircleProbe|null + + + + + $type + + + DeprecatedCircle + + + null|DeprecatedMember + + + $type === '' + $type === '' + + + DeprecatedCircle + Member + Member + + + isFederatedCirclesAllowed + + + + + OC::$WEBROOT + + + + + is_null($contactId) + + + ContactsManager + + + + + $existing + + + DeprecatedCircle[] + + + $bookId + $bookId + $bookId + + + CardDavBackend + + + $this->cardDavBackend + $this->cardDavBackend + $this->cardDavBackend + $this->cardDavBackend + $this->cardDavBackend + CardDavBackend + + + + + $context + new GenericEvent(null, $arguments) + + + + + gObj + + + + + FederatedUser + + + + + asyncBroadcast + checkEvent + checkEvent + checkEvent + getGlobalScaleEvent + getGlobalScaleEvent + getGlobalScaleEvent + + + + + $wrapper + + + $this->eventWrapperRequest->getByToken($token) + + + GSWrapper[] + + + configureRequest + + + asyncBroadcast + getGlobalScaleEvent + getGlobalScaleEvent + getInstances + getInstances + getKey + + + + + Signer + + + Signer + + + + + $members + + + DeprecatedMember[] + + + $circle->getType() + + + (int)$level + + + isInvitationSkipped + + + + + if (!in_array($member->getCircleId(), $knownIds)) { + + + + + ContactsManager + + + + + string + + + is_array($contact) + + + $cManager + $cManager + + + + + is_null($object) + + + $signed === null + + + + + setHtmlBody + setPlainBody + setSubject + + + + + federatedEventService + federatedEventService + + + + + TimeFactory + + + $this->timeFactory + TimeFactory + + + + + $shareId + + + IShare + IShare + IShare + IShare + IShare + + + iterable + + + array + + + $wrappedShare->getShare($this->rootFolder, $this->userManager, $this->urlGenerator) + $wrappedShare->getShare($this->rootFolder, $this->userManager, $this->urlGenerator) + $wrappedShare->getShare($this->rootFolder, $this->userManager, $this->urlGenerator) + $wrappedShare->getShare($this->rootFolder, $this->userManager, $this->urlGenerator) + $wrappedShare->getShare($this->rootFolder, $this->userManager, $this->urlGenerator) + + + $shareId + + + !is_null($node) + + + 0 + + + + + IShare[]|null + Share + Share[] + Share[] + + + $shares + $this->createShareChild($userId, $share) + $this->createShareObject($data) + $this->getShareById($share->getId()) + + + IShare + Share + Share[] + + + $id + $share->getId() + $share->getId() + $share->getId() + $share->getId() + $share->getSharedWith() + + + \OCP\Share + \OCP\Share + + + $reShares + $shareId + $userId + $userId + + + (int)$id + + + + $arr === null + + + InvalidShare + Share + + + Share + Share[] + Share[] + + + + + + $varr[0] !== null + + + + + BadResponseException + BadResponseException + BadResponseException|null + + + BadResponseException + private $exception = null; + + + + + $item + + + + + getArray + + + + + isset($this->logger) + + + HintException + + + + + $e + + + ClientException + + + + + getOpenSSLAlgo + + + + + $s[$e] + + + diff --git a/tests/stub.phpstub b/tests/stub.phpstub new file mode 100644 index 00000000..291a8440 --- /dev/null +++ b/tests/stub.phpstub @@ -0,0 +1,1023 @@ + + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ + +namespace OCA\Files_Trashbin\Trash { + use OCP\Files\Node; + use OCP\Files\Storage\IStorage; + use OCP\IUser; + use OCP\Files\FileInfo; + + interface ITrashManager { + public function pauseTrash(); + + public function resumeTrash(); + } + + interface ITrashBackend { + /** + * @return ITrashItem[] + */ + public function listTrashRoot(IUser $user): array; + + /** + * @return ITrashItem[] + */ + public function listTrashFolder(ITrashItem $folder): array; + + /** + * @param ITrashItem $item + */ + public function restoreItem(ITrashItem $item); + + public function removeItem(ITrashItem $item); + + public function moveToTrash(IStorage $storage, string $internalPath): bool; + + /** + * @return Node|null + */ + public function getTrashNodeById(IUser $user, int $fileId); + } + + interface ITrashItem extends FileInfo { + public function getTrashBackend(): ITrashBackend; + + public function getOriginalLocation(): string; + + public function getDeletedTime(): int; + + public function getTrashPath(): string; + + public function isRootItem(): bool; + + public function getUser(): IUser; + + public function getTitle(): string; + } + + class TrashItem implements ITrashItem { + public function getTrashBackend(): ITrashBackend { + throw new \Exception('stub'); + } + + public function getOriginalLocation(): string { + throw new \Exception('stub'); + } + + public function getDeletedTime(): int { + throw new \Exception('stub'); + } + + public function getTrashPath(): string { + throw new \Exception('stub'); + } + + public function isRootItem(): bool { + throw new \Exception('stub'); + } + + public function getUser(): IUser { + throw new \Exception('stub'); + } + + public function getEtag() { + } + + public function getId() { + } + + public function getSize($includeMounts = true) { + throw new \Exception('stub'); + } + + public function getMtime() { + throw new \Exception('stub'); + } + + public function getName() { + throw new \Exception('stub'); + } + + public function getInternalPath() { + throw new \Exception('stub'); + } + + public function getPath() { + throw new \Exception('stub'); + } + + public function getMimetype() { + throw new \Exception('stub'); + } + + public function getMimePart() { + throw new \Exception('stub'); + } + + public function getStorage() { + throw new \Exception('stub'); + } + + public function isEncrypted() { + throw new \Exception('stub'); + } + + public function getPermissions() { + throw new \Exception('stub'); + } + + public function getType() { + throw new \Exception('stub'); + } + + public function isReadable() { + throw new \Exception('stub'); + } + + public function isUpdateable() { + throw new \Exception('stub'); + } + + public function isCreatable() { + throw new \Exception('stub'); + } + + public function isDeletable() { + throw new \Exception('stub'); + } + + public function isShareable() { + throw new \Exception('stub'); + } + + public function isShared() { + throw new \Exception('stub'); + } + + public function isMounted() { + throw new \Exception('stub'); + } + + public function getMountPoint() { + throw new \Exception('stub'); + } + + public function getOwner() { + throw new \Exception('stub'); + } + + public function getChecksum() { + throw new \Exception('stub'); + } + + public function getExtension(): string { + throw new \Exception('stub'); + } + + public function getTitle(): string { + throw new \Exception('stub'); + } + + public function getCreationTime(): int { + throw new \Exception('stub'); + } + + public function getUploadTime(): int { + throw new \Exception('stub'); + } + } +} + +namespace OCA\Files_Trashbin { + class Expiration { + + public const DEFAULT_RETENTION_OBLIGATION = 30; + public const NO_OBLIGATION = -1; + + public function setRetentionObligation(string $obligation) {} + + /** @return bool */ + public function isEnabled() {} + + /** + * @param int $timestamp + * @param bool $quotaExceeded + * @return bool + */ + public function isExpired($timestamp, $quotaExceeded = false) {} + } +} + + +namespace OCA\Files_Versions\Versions { + use OCP\Files\File; + use OCP\Files\FileInfo; + use OCP\Files\NotFoundException; + use OCP\Files\Storage\IStorage; + use OCP\IUser; + + interface IVersionBackend { + public function useBackendForStorage(IStorage $storage): bool; + + /** + * @return IVersion[] + */ + public function getVersionsForFile(IUser $user, FileInfo $file): array; + + public function createVersion(IUser $user, FileInfo $file); + + public function rollback(IVersion $version); + + /** + * @return resource|false + * @throws NotFoundException + */ + public function read(IVersion $version); + + /** + * @param int|string $revision + */ + public function getVersionFile(IUser $user, FileInfo $sourceFile, $revision): ?File; + } + + interface IVersion { + public function getBackend(): IVersionBackend; + + public function getSourceFile(): FileInfo; + + /** + * @return int|string + */ + public function getRevisionId(); + + public function getTimestamp(): int; + + public function getSize(): int; + + public function getSourceFileName(): string; + + public function getMimeType(): string; + + public function getVersionPath(): string; + + public function getUser(): IUser; + } + + class Version implements IVersion { + public function __construct( + int $timestamp, + $revisionId, + string $name, + int $size, + string $mimetype, + string $path, + FileInfo $sourceFileInfo, + IVersionBackend $backend, + IUser $user + ) { + } + + public function getBackend(): IVersionBackend { + throw new \Exception('stub'); + } + + public function getSourceFile(): FileInfo { + throw new \Exception('stub'); + } + + public function getRevisionId() { + throw new \Exception('stub'); + } + + public function getTimestamp(): int { + throw new \Exception('stub'); + } + + public function getSize(): int { + throw new \Exception('stub'); + } + + public function getSourceFileName(): string { + throw new \Exception('stub'); + } + + public function getMimeType(): string { + throw new \Exception('stub'); + } + + public function getVersionPath(): string { + throw new \Exception('stub'); + } + + public function getUser(): IUser { + throw new \Exception('stub'); + } + } +} + +namespace OCA\Files_Versions { + class Expiration { + // how long do we keep files a version if no other value is defined in the config file (unit: days) + public const NO_OBLIGATION = -1; + /** @return bool */ + public function isEnabled() {} + + public function shouldAutoExpire() { } + + /** + * @param int $timestamp + * @param bool $quotaExceeded + * @return bool + */ + public function isExpired($timestamp, $quotaExceeded = false) {} + + /** @return int */ + public function getMaxAgeAsTimestamp() {} + } +} + +namespace { + + use OCP\IServerContainer; + + class OC { + static $CLI = false; + /** @var IServerContainer */ + static $server; + } +} + +namespace OC\Files\Node { + use OCP\Files\FileInfo; + abstract class Node implements \OCP\Files\Node { + /** @return FileInfo|\ArrayAccess */ + public function getFileInfo() {} + + /** @return \OCP\Files\Mount\IMountPoint */ + public function getMountPoint() {} + } +} + +namespace OC\Hooks { + class Emitter { + public function emit(string $class, string $value, array $option) {} + /** Closure $closure */ + public function listen(string $class, string $value, $closure) {} + } + class BasicEmitter extends Emitter { + } +} + +namespace OC\Cache { + class CappedMemoryCache { + public function get($key) {} + public function set($key, $value, $ttl = '') {} + } +} + +namespace OC\Core\Command { + use Symfony\Component\Console\Input\InputInterface; + use Symfony\Component\Console\Output\OutputInterface; + class Base { + public const OUTPUT_FORMAT_PLAIN = 'plain'; + public const OUTPUT_FORMAT_JSON = 'json'; + public const OUTPUT_FORMAT_JSON_PRETTY = 'json_pretty'; + + public function __construct() {} + protected function configure() {} + public function run(InputInterface $input, OutputInterface $output) {} + public function setName(string $name) {} + public function getHelper(string $name) {} + protected function writeArrayInOutputFormat(InputInterface $input, OutputInterface $output, $items, $prefix = ' - ') { + } + } +} + +namespace OC\Files\ObjectStore { + class NoopScanner {} +} + +namespace Symfony\Component\Console\Helper { + use Symfony\Component\Console\Output\OutputInterface; + class Table { + public function __construct(OutputInterface $text) {} + public function setHeaders(array $header) {} + public function setRows(array $rows) {} + public function render() {} + public function appendRow(array $row) {} + } +} + +namespace Symfony\Component\Console\Input { + class InputInterface { + public function getOption(string $key) {} + public function getArgument(string $key) {} + } + class InputArgument { + const REQUIRED = 0; + const OPTIONAL = 1; + const IS_ARRAY = 1; + } + class InputOption { + const VALUE_NONE = 1; + const VALUE_REQUIRED = 1; + const VALUE_OPTIONAL = 1; + } +} + +namespace Symfony\Component\Console\Question { + class ConfirmationQuestion { + public function __construct(string $text, bool $default, string $accept = 'y') {} + } +} + +namespace Symfony\Component\Console\Output { + class OutputInterface { + public const VERBOSITY_VERBOSE = 1; + public function writeln(string $text, int $flat = 0) {} + public function write(string $text, int $flat = 0) {} + } +} + +namespace OC\User { + class NoUserException extends \Exception {} +} + +namespace OC\DB { + use OCP\IDBConnection; + class ConnectionAdapter {} + + class SchemaWrapper { + public function __construct(IDBConnection $connection) {} + + public function performDropTableCalls(); + } +} + +namespace OC { + class SystemConfig {} +} + +namespace Doctrine\DBAL\Query { + class QueryBuilder { + public const SELECT = 'select'; + } +} + +namespace OC\DB\QueryBuilder { + use OCP\DB\IResult; + use OCP\DB\QueryBuilder\ICompositeExpression; + use OCP\DB\QueryBuilder\ILiteral; + use OCP\DB\QueryBuilder\IParameter; + use OCP\DB\QueryBuilder\IQueryBuilder; + use OCP\DB\QueryBuilder\IQueryFunction; + use Psr\Log\LoggerInterface; + + class QueryBuilder implements IQueryBuilder { + public function __construct(ConnectionAdapter $connection, SystemConfig $systemConfig, LoggerInterface $logger) { + } + public function automaticTablePrefix($enabled) { } + public function expr() { } + public function func() { } + public function getType() { } + public function getConnection() { } + public function getState() { } + public function execute() { } + public function executeQuery(): IResult { } + public function executeUpdate(): int { } + public function executeStatement(): int { } + public function getSQL() { } + public function setParameter($key, $value, $type = null) { } + public function setParameters(array $params, array $types = []) { } + public function getParameters() { } + public function getParameter($key) { } + public function getParameterTypes() { } + public function getParameterType($key) { } + public function setFirstResult($firstResult) { } + public function getFirstResult() { } + public function setMaxResults($maxResults) { } + public function getMaxResults() { } + public function select(...$selects) { } + public function selectAlias($select, $alias) { } + public function selectDistinct($select) { } + public function addSelect(...$selects) { } + public function delete($delete = null, $alias = null) { } + public function update($update = null, $alias = null) { } + public function insert($insert = null) { } + public function from($from, $alias = null) { } + public function join($fromAlias, $join, $alias, $condition = null) { } + public function innerJoin($fromAlias, $join, $alias, $condition = null) { } + public function leftJoin($fromAlias, $join, $alias, $condition = null) { } + public function rightJoin($fromAlias, $join, $alias, $condition = null) { } + public function set($key, $value) { } + public function where(...$predicates) { } + public function andWhere(...$where) { } + public function orWhere(...$where) { } + public function groupBy(...$groupBys) { } + public function addGroupBy(...$groupBys) { } + public function setValue($column, $value) { } + public function values(array $values) { } + public function having(...$having) { } + public function andHaving(...$having) { } + public function orHaving(...$having) { } + public function orderBy($sort, $order = null) { } + public function addOrderBy($sort, $order = null) { } + public function getQueryPart($queryPartName) { } + public function getQueryParts() { } + public function resetQueryParts($queryPartNames = null) { } + public function resetQueryPart($queryPartName) { } + public function createNamedParameter($value, $type = IQueryBuilder::PARAM_STR, $placeHolder = null) { } + public function createPositionalParameter($value, $type = IQueryBuilder::PARAM_STR) { } + public function createParameter($name) { } + public function createFunction($call) { } + public function getLastInsertId(): int { } + public function getTableName($table) { } + protected function prefixTableName($table) { } + public function getColumnName($column, $tableAlias = '') { } + public function quoteAlias($alias) { } + } +} + +namespace OC\Files\Cache { + use OCP\Files\Cache\ICache; + use OCP\Files\Cache\ICacheEntry; + use OCP\Files\Search\ISearchQuery; + use OCP\Files\Search\ISearchOperator; + use OCP\Files\Search\ISearchQuery; + use OCP\Files\IMimeTypeLoader; + + class Cache implements ICache { + /** + * @param \OCP\Files\Cache\ICache $cache + */ + public function __construct($cache) { + $this->cache = $cache; + } + public function getNumericStorageId() { } + public function get() { } + public function getIncomplete() {} + public function getPathById($id) {} + public function getAll() {} + public function get($file) {} + public function getFolderContents($folder) {} + public function getFolderContentsById($fileId) {} + public function put($file, array $data) {} + public function insert($file, array $data) {} + public function update($id, array $data) {} + public function getId($file) {} + public function getParentId($file) {} + public function inCache($file) {} + public function remove($file) {} + public function move($source, $target) {} + public function moveFromCache(ICache $sourceCache, $sourcePath, $targetPath) {} + public function clear() {} + public function getStatus($file) {} + public function search($pattern) {} + public function searchByMime($mimetype) {} + public function searchQuery(ISearchQuery $query) {} + public function correctFolderSize($path, $data = null, $isBackgroundScan = false) {} + public function copyFromCache(ICache $sourceCache, ICacheEntry $sourceEntry, string $targetPath): int {} + public function normalize($path) {} + public function getQueryFilterForStorage(): ISearchOperator {} + public function getCacheEntryFromSearchResult(ICacheEntry $rawEntry): ?ICacheEntry {} + public static function cacheEntryFromData($data, IMimeTypeLoader $mimetypeLoader): ICacheEntry {} + } +} + +namespace OC\Files\Cache\Wrapper { + use OC\Files\Cache\Cache; + class CacheWrapper extends Cache {} +} + +namespace OC\Files { + use OCP\Files\Cache\ICacheEntry; + use OCP\Files\Mount\IMountPoint; + use OCP\IUser; + + class Filesystem { + public static function addStorageWrapper(string $wrapperName, callable $wrapper, int $priority = 50) { + } + } + + class FileInfo implements \OCP\Files\FileInfo { + /** + * @param string|boolean $path + * @param \OCP\Files\Storage\IStorage $storage + * @param string $internalPath + * @param array|ICacheEntry $data + * @param \OCP\Files\Mount\IMountPoint $mount + * @param \OCP\IUser|null $owner + */ + public function __construct($path, $storage, $internalPath, $data, $mount, $owner = null) {} + } + class View { + public function __construct(string $path) {} + public function unlink($path) {} + } +} + +namespace OC\User { + use OCP\UserInterface; + use OCP\IUser; + use Symfony\Component\EventDispatcher\EventDispatcherInterface; + class User implements IUser { + public function __construct(string $uid, ?UserInterface $backend, EventDispatcherInterface $dispatcher, $emitter = null, IConfig $config = null, $urlGenerator = null) {} + } +} + +namespace OCA\DAV\Upload { + + use Sabre\DAV\File; + + abstract class FutureFile extends File {} +} + +namespace OCA\DAV\Connector\Sabre { + + class Node { + public function getFileInfo(): \OCP\Files\FileInfo {} + } +} + +namespace OC\BackgroundJob { + + use OCP\BackgroundJob\IJob; + use OCP\BackgroundJob\IJobList; + use OCP\ILogger; + + abstract class TimedJob implements IJob { + public function execute(IJobList $jobList, ILogger $logger = null) { + } + + abstract protected function run($argument); + + public function setId(int $id) { + } + + public function setLastRun(int $lastRun) { + } + + public function setArgument($argument) { + } + + public function getId() { + } + + public function getLastRun() { + } + + public function getArgument() { + } + } +} + +namespace OC\Files\Mount { + use OC\Files\Filesystem; + use OC\Files\Storage\Storage; + use OC\Files\Storage\StorageFactory; + use OCP\Files\Mount\IMountPoint; + + class MountPoint implements IMountPoint { + /** + * @var \OC\Files\Storage\Storage $storage + */ + protected $storage = null; + protected $class; + protected $storageId; + protected $rootId = null; + + /** @var int|null */ + protected $mountId; + + /** + * @param string|\OCP\Files\Storage\IStorage $storage + * @param string $mountpoint + * @param array $arguments (optional) configuration for the storage backend + * @param \OCP\Files\Storage\IStorageFactory $loader + * @param array $mountOptions mount specific options + * @param int|null $mountId + * @throws \Exception + */ + public function __construct($storage, $mountpoint, $arguments = null, $loader = null, $mountOptions = null, $mountId = null) { + throw new \Exception('stub'); + } + + /** + * get complete path to the mount point, relative to data/ + * + * @return string + */ + public function getMountPoint() { + throw new \Exception('stub'); + } + + /** + * Sets the mount point path, relative to data/ + * + * @param string $mountPoint new mount point + */ + public function setMountPoint($mountPoint) { + throw new \Exception('stub'); + } + + /** + * @return \OCP\Files\Storage\IStorage + */ + public function getStorage() { + throw new \Exception('stub'); + } + + /** + * @return string + */ + public function getStorageId() { + throw new \Exception('stub'); + } + + /** + * @return int + */ + public function getNumericStorageId() { + throw new \Exception('stub'); + } + + /** + * @param string $path + * @return string + */ + public function getInternalPath($path) { + throw new \Exception('stub'); + } + + /** + * @param callable $wrapper + */ + public function wrapStorage($wrapper) { + throw new \Exception('stub'); + } + + /** + * Get a mount option + * + * @param string $name Name of the mount option to get + * @param mixed $default Default value for the mount option + * @return mixed + */ + public function getOption($name, $default) { + throw new \Exception('stub'); + } + + /** + * Get all options for the mount + * + * @return array + */ + public function getOptions() { + throw new \Exception('stub'); + } + + /** + * @return int + */ + public function getStorageRootId() { + throw new \Exception('stub'); + } + + public function getMountId() { + throw new \Exception('stub'); + } + + public function getMountType() { + throw new \Exception('stub'); + } + + public function getMountProvider(): string { + 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 OCP\Files\Storage\IStorage; + + class Wrapper implements IStorage { + public function __construct(array $parameters) { + } + + public function getWrapperStorage(): ?IStorage {} + + public function getId() {} + + public function mkdir($path) {} + + public function rmdir($path) {} + + public function opendir($path) { + throw new \Exception('stub'); + } + + public function is_dir($path) { + throw new \Exception('stub'); + } + + public function is_file($path) { + throw new \Exception('stub'); + } + + public function stat($path) { + throw new \Exception('stub'); + } + + public function filetype($path) { + throw new \Exception('stub'); + } + + public function filesize($path) { + throw new \Exception('stub'); + } + + public function isCreatable($path) { + throw new \Exception('stub'); + } + + public function isReadable($path) { + throw new \Exception('stub'); + } + + public function isUpdatable($path) { + throw new \Exception('stub'); + } + + public function isDeletable($path) { + throw new \Exception('stub'); + } + + public function isSharable($path) { + throw new \Exception('stub'); + } + + public function getPermissions($path) { + throw new \Exception('stub'); + } + + public function file_exists($path) { + throw new \Exception('stub'); + } + + public function filemtime($path) { + throw new \Exception('stub'); + } + + public function file_get_contents($path) { + throw new \Exception('stub'); + } + + public function file_put_contents($path, $data) { + throw new \Exception('stub'); + } + + public function unlink($path) { + throw new \Exception('stub'); + } + + public function rename($path1, $path2) { + throw new \Exception('stub'); + } + + public function copy($path1, $path2) { + throw new \Exception('stub'); + } + + public function fopen($path, $mode) { + throw new \Exception('stub'); + } + + public function getMimeType($path) { + throw new \Exception('stub'); + } + + public function hash($type, $path, $raw = false) { + throw new \Exception('stub'); + } + + public function free_space($path) { + throw new \Exception('stub'); + } + + public function touch($path, $mtime = null) { + throw new \Exception('stub'); + } + + public function getLocalFile($path) { + throw new \Exception('stub'); + } + + public function hasUpdated($path, $time) { + throw new \Exception('stub'); + } + + public function getETag($path) { + throw new \Exception('stub'); + } + + public function isLocal() { + throw new \Exception('stub'); + } + + public function instanceOfStorage($class) { + throw new \Exception('stub'); + } + + public function getDirectDownload($path) { + throw new \Exception('stub'); + } + + public function verifyPath($path, $fileName) { + throw new \Exception('stub'); + } + + public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath) { + throw new \Exception('stub'); + } + + public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath) { + throw new \Exception('stub'); + } + + public function test() { + throw new \Exception('stub'); + } + + public function getAvailability() { + throw new \Exception('stub'); + } + + public function setAvailability($isAvailable) { + throw new \Exception('stub'); + } + + public function getOwner($path) { + throw new \Exception('stub'); + } + + public function getCache() { + throw new \Exception('stub'); + } + + public function getPropagator() { + throw new \Exception('stub'); + } + + public function getScanner() { + throw new \Exception('stub'); + } + + public function getUpdater() { + throw new \Exception('stub'); + } + + public function getWatcher() { + throw new \Exception('stub'); + } + } + + class Jail extends Wrapper { + public function getUnjailedPath(string $path): string {} + } + + class Quota extends Wrapper { + public function getQuota() {} + } + + class PermissionsMask extends Wrapper { + public function getQuota() {} + } +} + +namespace OC\AppFramework\Middleware\Security\Exceptions { + class NotLoggedInException extends \Exception {} +}