From ce7f135abb414f3d5fefb61eeb434f17a679eccc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Mon, 2 May 2022 14:01:01 +0200 Subject: [PATCH 1/3] Add psalm to CI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- .github/workflows/static-analysis.yml | 31 ++ composer.json | 4 +- composer.lock | 496 +++++++++++++++++++++++++- psalm.xml | 54 +++ tests/psalm-baseline.xml | 124 +++++++ 5 files changed, 705 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/static-analysis.yml create mode 100644 psalm.xml create mode 100644 tests/psalm-baseline.xml diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml new file mode 100644 index 00000000..2c1b13e3 --- /dev/null +++ b/.github/workflows/static-analysis.yml @@ -0,0 +1,31 @@ +name: Static analysis + +on: + pull_request: + push: + branches: + - master + - stable* + +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@2.18.1 + 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/composer.json b/composer.json index 3c26fe54..43905466 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,9 @@ "require-dev": { "phpunit/phpunit": "^9.5", "nextcloud/coding-standard": "^1.0", - "psalm/phar": "^4.22" + "psalm/phar": "^4.22", + "christophwurst/nextcloud": "dev-stable24", + "sabre/dav": "^4.3" }, "config": { "platform": { diff --git a/composer.lock b/composer.lock index 4545e9f5..a757b39e 100644 --- a/composer.lock +++ b/composer.lock @@ -4,9 +4,52 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "8384bb7fdaaa389c19d718807fa19e9c", + "content-hash": "0687c5d199fd54b42d6d5360200cb019", "packages": [], "packages-dev": [ + { + "name": "christophwurst/nextcloud", + "version": "dev-stable24", + "source": { + "type": "git", + "url": "https://github.com/ChristophWurst/nextcloud_composer.git", + "reference": "ba2c9237417a5bd42b938139b9b8e370ecac7c11" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ChristophWurst/nextcloud_composer/zipball/ba2c9237417a5bd42b938139b9b8e370ecac7c11", + "reference": "ba2c9237417a5bd42b938139b9b8e370ecac7c11", + "shasum": "" + }, + "require": { + "php": "^7.4 || ~8.0 || ~8.1", + "psr/container": "^1.0", + "psr/event-dispatcher": "^1.0", + "psr/log": "^1.1" + }, + "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/stable24" + }, + "time": "2022-04-27T07:26:56+00:00" + }, { "name": "composer/pcre", "version": "3.0.0", @@ -1731,6 +1774,451 @@ }, "time": "2021-05-03T11:20:27+00:00" }, + { + "name": "sabre/dav", + "version": "4.3.1", + "source": { + "type": "git", + "url": "https://github.com/sabre-io/dav.git", + "reference": "130abb7017f56e0d99b04eb94b041e000a8e9b39" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sabre-io/dav/zipball/130abb7017f56e0d99b04eb94b041e000a8e9b39", + "reference": "130abb7017f56e0d99b04eb94b041e000a8e9b39", + "shasum": "" + }, + "require": { + "ext-ctype": "*", + "ext-date": "*", + "ext-dom": "*", + "ext-iconv": "*", + "ext-json": "*", + "ext-mbstring": "*", + "ext-pcre": "*", + "ext-simplexml": "*", + "ext-spl": "*", + "lib-libxml": ">=2.7.0", + "php": "^7.1.0 || ^8.0", + "psr/log": "^1.0 || ^2.0 || ^3.0", + "sabre/event": "^5.0", + "sabre/http": "^5.0.5", + "sabre/uri": "^2.0", + "sabre/vobject": "^4.2.1", + "sabre/xml": "^2.0.1" + }, + "require-dev": { + "evert/phpdoc-md": "~0.1.0", + "friendsofphp/php-cs-fixer": "^2.17.1", + "monolog/monolog": "^1.18", + "phpstan/phpstan": "^0.12", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.0" + }, + "suggest": { + "ext-curl": "*", + "ext-imap": "*", + "ext-pdo": "*" + }, + "bin": [ + "bin/sabredav", + "bin/naturalselection" + ], + "type": "library", + "autoload": { + "psr-4": { + "Sabre\\DAV\\": "lib/DAV/", + "Sabre\\CalDAV\\": "lib/CalDAV/", + "Sabre\\DAVACL\\": "lib/DAVACL/", + "Sabre\\CardDAV\\": "lib/CardDAV/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Evert Pot", + "email": "me@evertpot.com", + "homepage": "http://evertpot.com/", + "role": "Developer" + } + ], + "description": "WebDAV Framework for PHP", + "homepage": "http://sabre.io/", + "keywords": [ + "CalDAV", + "CardDAV", + "WebDAV", + "framework", + "iCalendar" + ], + "support": { + "forum": "https://groups.google.com/group/sabredav-discuss", + "issues": "https://github.com/sabre-io/dav/issues", + "source": "https://github.com/fruux/sabre-dav" + }, + "time": "2022-01-20T13:59:29+00:00" + }, + { + "name": "sabre/event", + "version": "5.1.4", + "source": { + "type": "git", + "url": "https://github.com/sabre-io/event.git", + "reference": "d7da22897125d34d7eddf7977758191c06a74497" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sabre-io/event/zipball/d7da22897125d34d7eddf7977758191c06a74497", + "reference": "d7da22897125d34d7eddf7977758191c06a74497", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "~2.17.1", + "phpstan/phpstan": "^0.12", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.0" + }, + "type": "library", + "autoload": { + "files": [ + "lib/coroutine.php", + "lib/Loop/functions.php", + "lib/Promise/functions.php" + ], + "psr-4": { + "Sabre\\Event\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Evert Pot", + "email": "me@evertpot.com", + "homepage": "http://evertpot.com/", + "role": "Developer" + } + ], + "description": "sabre/event is a library for lightweight event-based programming", + "homepage": "http://sabre.io/event/", + "keywords": [ + "EventEmitter", + "async", + "coroutine", + "eventloop", + "events", + "hooks", + "plugin", + "promise", + "reactor", + "signal" + ], + "support": { + "forum": "https://groups.google.com/group/sabredav-discuss", + "issues": "https://github.com/sabre-io/event/issues", + "source": "https://github.com/fruux/sabre-event" + }, + "time": "2021-11-04T06:51:17+00:00" + }, + { + "name": "sabre/http", + "version": "5.1.3", + "source": { + "type": "git", + "url": "https://github.com/sabre-io/http.git", + "reference": "315f592adfcba8aeb73c2fd64285205747acbbd7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sabre-io/http/zipball/315f592adfcba8aeb73c2fd64285205747acbbd7", + "reference": "315f592adfcba8aeb73c2fd64285205747acbbd7", + "shasum": "" + }, + "require": { + "ext-ctype": "*", + "ext-curl": "*", + "ext-mbstring": "*", + "php": "^7.1 || ^8.0", + "sabre/event": ">=4.0 <6.0", + "sabre/uri": "^2.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "~2.17.1", + "phpstan/phpstan": "^0.12", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.0" + }, + "suggest": { + "ext-curl": " to make http requests with the Client class" + }, + "type": "library", + "autoload": { + "files": [ + "lib/functions.php" + ], + "psr-4": { + "Sabre\\HTTP\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Evert Pot", + "email": "me@evertpot.com", + "homepage": "http://evertpot.com/", + "role": "Developer" + } + ], + "description": "The sabre/http library provides utilities for dealing with http requests and responses. ", + "homepage": "https://github.com/fruux/sabre-http", + "keywords": [ + "http" + ], + "support": { + "forum": "https://groups.google.com/group/sabredav-discuss", + "issues": "https://github.com/sabre-io/http/issues", + "source": "https://github.com/fruux/sabre-http" + }, + "time": "2021-11-04T07:02:36+00:00" + }, + { + "name": "sabre/uri", + "version": "2.2.2", + "source": { + "type": "git", + "url": "https://github.com/sabre-io/uri.git", + "reference": "7cb0f489578afad5006e85cd60f18ff33f2d440d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sabre-io/uri/zipball/7cb0f489578afad5006e85cd60f18ff33f2d440d", + "reference": "7cb0f489578afad5006e85cd60f18ff33f2d440d", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "~2.17.1", + "phpstan/phpstan": "^0.12", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.0" + }, + "type": "library", + "autoload": { + "files": [ + "lib/functions.php" + ], + "psr-4": { + "Sabre\\Uri\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Evert Pot", + "email": "me@evertpot.com", + "homepage": "http://evertpot.com/", + "role": "Developer" + } + ], + "description": "Functions for making sense out of URIs.", + "homepage": "http://sabre.io/uri/", + "keywords": [ + "rfc3986", + "uri", + "url" + ], + "support": { + "forum": "https://groups.google.com/group/sabredav-discuss", + "issues": "https://github.com/sabre-io/uri/issues", + "source": "https://github.com/fruux/sabre-uri" + }, + "time": "2021-11-04T09:29:58+00:00" + }, + { + "name": "sabre/vobject", + "version": "4.4.1", + "source": { + "type": "git", + "url": "https://github.com/sabre-io/vobject.git", + "reference": "06feff370141fd3118609f808e86d9315864bf14" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sabre-io/vobject/zipball/06feff370141fd3118609f808e86d9315864bf14", + "reference": "06feff370141fd3118609f808e86d9315864bf14", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "php": "^7.1 || ^8.0", + "sabre/xml": "^2.1" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "~2.17.1", + "phpstan/phpstan": "^0.12", + "phpunit/php-invoker": "^2.0 || ^3.1", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.0" + }, + "suggest": { + "hoa/bench": "If you would like to run the benchmark scripts" + }, + "bin": [ + "bin/vobject", + "bin/generate_vcards" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Sabre\\VObject\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Evert Pot", + "email": "me@evertpot.com", + "homepage": "http://evertpot.com/", + "role": "Developer" + }, + { + "name": "Dominik Tobschall", + "email": "dominik@fruux.com", + "homepage": "http://tobschall.de/", + "role": "Developer" + }, + { + "name": "Ivan Enderlin", + "email": "ivan.enderlin@hoa-project.net", + "homepage": "http://mnt.io/", + "role": "Developer" + } + ], + "description": "The VObject library for PHP allows you to easily parse and manipulate iCalendar and vCard objects", + "homepage": "http://sabre.io/vobject/", + "keywords": [ + "availability", + "freebusy", + "iCalendar", + "ical", + "ics", + "jCal", + "jCard", + "recurrence", + "rfc2425", + "rfc2426", + "rfc2739", + "rfc4770", + "rfc5545", + "rfc5546", + "rfc6321", + "rfc6350", + "rfc6351", + "rfc6474", + "rfc6638", + "rfc6715", + "rfc6868", + "vCalendar", + "vCard", + "vcf", + "xCal", + "xCard" + ], + "support": { + "forum": "https://groups.google.com/group/sabredav-discuss", + "issues": "https://github.com/sabre-io/vobject/issues", + "source": "https://github.com/fruux/sabre-vobject" + }, + "time": "2021-12-07T09:45:33+00:00" + }, + { + "name": "sabre/xml", + "version": "2.2.5", + "source": { + "type": "git", + "url": "https://github.com/sabre-io/xml.git", + "reference": "a6af111850e7536d200d9637c34885cd3c77a86c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sabre-io/xml/zipball/a6af111850e7536d200d9637c34885cd3c77a86c", + "reference": "a6af111850e7536d200d9637c34885cd3c77a86c", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-xmlreader": "*", + "ext-xmlwriter": "*", + "lib-libxml": ">=2.6.20", + "php": "^7.1 || ^8.0", + "sabre/uri": ">=1.0,<3.0.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "~2.17.1", + "phpstan/phpstan": "^0.12", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.0" + }, + "type": "library", + "autoload": { + "files": [ + "lib/Deserializer/functions.php", + "lib/Serializer/functions.php" + ], + "psr-4": { + "Sabre\\Xml\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Evert Pot", + "email": "me@evertpot.com", + "homepage": "http://evertpot.com/", + "role": "Developer" + }, + { + "name": "Markus Staab", + "email": "markus.staab@redaxo.de", + "role": "Developer" + } + ], + "description": "sabre/xml is an XML library that you may not hate.", + "homepage": "https://sabre.io/xml/", + "keywords": [ + "XMLReader", + "XMLWriter", + "dom", + "xml" + ], + "support": { + "forum": "https://groups.google.com/group/sabredav-discuss", + "issues": "https://github.com/sabre-io/xml/issues", + "source": "https://github.com/fruux/sabre-xml" + }, + "time": "2021-11-04T06:37:27+00:00" + }, { "name": "sebastian/cli-parser", "version": "1.0.1", @@ -4196,7 +4684,9 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": { + "christophwurst/nextcloud": 20 + }, "prefer-stable": false, "prefer-lowest": false, "platform": { @@ -4206,5 +4696,5 @@ "platform-overrides": { "php": "7.4" }, - "plugin-api-version": "2.2.0" + "plugin-api-version": "2.3.0" } diff --git a/psalm.xml b/psalm.xml new file mode 100644 index 00000000..f31c58e9 --- /dev/null +++ b/psalm.xml @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/psalm-baseline.xml b/tests/psalm-baseline.xml new file mode 100644 index 00000000..167b3804 --- /dev/null +++ b/tests/psalm-baseline.xml @@ -0,0 +1,124 @@ + + + + + LoadAdditionalScriptsEvent + + + + + $this->server + + + $this->server + + + + + CachingTree + FakeLockerPlugin + ObjectTree + SabreNode + + + + + ExtendedQueryBuilder + + + + + $qb + $qb + $qb + $qb + $qb + $qb + $qb + $qb + CoreQueryBuilder + + + + + $qb + $qb + $qb + $qb + $qb + $qb + $qb + $qb + $qb + $qb + $qb + $qb + $qb + $qb + $qb + $qb + $qb + $qb + $qb + $qb + $qb + $qb + $qb + $qb + + + UniqueConstraintViolationException + + + + + CoreQueryBuilder + CoreQueryBuilder + CoreQueryBuilder + CoreQueryBuilder + CoreQueryBuilder + CoreQueryBuilder + + + + + LoadAdditionalScriptsEvent + + + + + $lock + $lock + + + + + $this->rootFolder + $this->rootFolder + $this->rootFolder + $this->rootFolder + IRootFolder + IRootFolder + + + + + $arr === null + $arr === null + $arr === null + $arr === null + $arr === null + $arr === null + $arr === null + + + + + string + string + + + string + + + From cd79320918ea2f41b3b7b9a0d6ed5cfaf4a80365 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Mon, 2 May 2022 14:02:22 +0200 Subject: [PATCH 2/3] Add php-cs-fixer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- .github/workflows/lint.yml | 43 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..0ad920a2 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,43 @@ +name: Lint + +on: + pull_request: + push: + branches: + - master + - stable* + +jobs: + php: + runs-on: ubuntu-latest + + strategy: + matrix: + php-versions: ['7.4', '8.0', '8.1'] + + name: php${{ matrix.php-versions }} lint + steps: + - uses: actions/checkout@v3 + - name: Set up php${{ matrix.php-versions }} + uses: shivammathur/setup-php@2.18.1 + with: + php-version: ${{ matrix.php-versions }} + coverage: none + - name: Lint + run: composer run lint + + php-cs-fixer: + name: php-cs check + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Set up php + uses: shivammathur/setup-php@2.18.1 + with: + php-version: 7.4 + coverage: none + - name: Install dependencies + run: composer i + - name: Run coding standards check + run: composer run cs:check From 3ba2c6650d7535f49705ebd9abf11c47520b1b0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Mon, 2 May 2022 14:03:06 +0200 Subject: [PATCH 3/3] Apply php-cs-fixer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- appinfo/routes.php | 4 +- lib/AppInfo/Application.php | 38 +++++++------------ lib/Capability.php | 2 - lib/Command/Lock.php | 8 ++-- lib/Cron/Unlock.php | 8 ++-- lib/DAV/LockPlugin.php | 3 -- lib/Db/CoreQueryBuilder.php | 8 ++-- lib/Db/CoreRequestBuilder.php | 14 +++---- lib/Db/LocksRequest.php | 9 ++--- lib/Db/LocksRequestBuilder.php | 10 ++--- lib/Exceptions/LockNotFoundException.php | 4 -- lib/Exceptions/NotFileException.php | 4 -- lib/Exceptions/SuccessException.php | 4 -- .../UnauthorizedUnlockException.php | 4 -- lib/Listeners/LoadAdditionalScripts.php | 4 -- lib/LockProvider.php | 2 - .../Version0001Date20191105000001.php | 16 ++++---- .../Version1000Date20220201111525.php | 1 - .../Version1000Date20220430180808.php | 2 +- lib/Model/FileLock.php | 22 +++++------ lib/Service/ConfigService.php | 11 ++---- lib/Service/FileService.php | 8 ++-- lib/Storage/LockWrapper.php | 4 -- lib/Tools/Db/ExtendedQueryBuilder.php | 6 --- lib/Tools/Db/IQueryRow.php | 3 -- .../Exceptions/ArrayNotFoundException.php | 4 -- lib/Tools/Exceptions/DateTimeException.php | 4 -- lib/Tools/Exceptions/InvalidItemException.php | 4 -- .../Exceptions/ItemNotFoundException.php | 3 -- .../Exceptions/MalformedArrayException.php | 4 -- lib/Tools/Exceptions/RowNotFoundException.php | 4 -- lib/Tools/Exceptions/UnknownTypeException.php | 4 -- lib/Tools/Traits/TArrayTools.php | 23 +++++------ lib/Tools/Traits/TLogger.php | 31 +++++++-------- lib/Tools/Traits/TSetup.php | 7 +--- lib/Tools/Traits/TStringTools.php | 5 +-- tests/Feature/LockFeatureTest.php | 1 - 37 files changed, 87 insertions(+), 206 deletions(-) diff --git a/appinfo/routes.php b/appinfo/routes.php index 1770ab1b..924f964e 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -1,4 +1,6 @@ - $storage, 'lock_manager' => $this->lockManager, @@ -152,9 +144,7 @@ public function addStorageWrapper() { 'lock_service' => $this->lockService ] ); - }, 10 + }, 10 ); } - } - diff --git a/lib/Capability.php b/lib/Capability.php index ccae5296..0db85b0b 100644 --- a/lib/Capability.php +++ b/lib/Capability.php @@ -5,7 +5,6 @@ use OCP\Capabilities\ICapability; class Capability implements ICapability { - public function getCapabilities() { return [ 'files' => [ @@ -13,5 +12,4 @@ public function getCapabilities() { ] ]; } - } diff --git a/lib/Command/Lock.php b/lib/Command/Lock.php index 868b2f21..84fa513e 100644 --- a/lib/Command/Lock.php +++ b/lib/Command/Lock.php @@ -1,4 +1,6 @@ -lockService->removeLocks($this->lockService->getDeprecatedLocks()); } - } - diff --git a/lib/DAV/LockPlugin.php b/lib/DAV/LockPlugin.php index de4db354..6e37d93d 100644 --- a/lib/DAV/LockPlugin.php +++ b/lib/DAV/LockPlugin.php @@ -18,9 +18,6 @@ use OCP\Files\Lock\OwnerLockedException; use OCP\IUserManager; use OCP\IUserSession; -use Sabre\DAV\Exception\BadRequest; -use Sabre\DAV\Exception\ConflictingLock; -use Sabre\DAV\Exception\Locked; use Sabre\DAV\Exception\LockTokenMatchesRequestUri; use Sabre\DAV\INode; use Sabre\DAV\Locks\Plugin as SabreLockPlugin; diff --git a/lib/Db/CoreQueryBuilder.php b/lib/Db/CoreQueryBuilder.php index c8985d16..f24aaf62 100644 --- a/lib/Db/CoreQueryBuilder.php +++ b/lib/Db/CoreQueryBuilder.php @@ -1,4 +1,6 @@ -limitArray('id', $ids); } - } - diff --git a/lib/Db/CoreRequestBuilder.php b/lib/Db/CoreRequestBuilder.php index 9a9cacb3..6c92e770 100644 --- a/lib/Db/CoreRequestBuilder.php +++ b/lib/Db/CoreRequestBuilder.php @@ -1,4 +1,6 @@ -uninstallAppTables(); - $this->removeFromJobs();; + $this->removeFromJobs(); + ; $this->removeFromMigrations(); } @@ -109,6 +109,4 @@ public function removeFromJobs() { $qb->where($qb->exprLimitToDBField('class', 'OCA\FilesLock\Cron\Unlock', true, true)); $qb->execute(); } - } - diff --git a/lib/Db/LocksRequest.php b/lib/Db/LocksRequest.php index 5510c6b4..5da7bba0 100644 --- a/lib/Db/LocksRequest.php +++ b/lib/Db/LocksRequest.php @@ -1,4 +1,6 @@ -getLocksFromRequest($qb); } - - } - diff --git a/lib/Db/LocksRequestBuilder.php b/lib/Db/LocksRequestBuilder.php index ede57da0..7bcecc6e 100644 --- a/lib/Db/LocksRequestBuilder.php +++ b/lib/Db/LocksRequestBuilder.php @@ -1,4 +1,6 @@ - true, 'unsigned' => true, 'notnull' => true, - 'length' => 11 + 'length' => 11 ] ); $table->addColumn( 'user_id', 'string', [ 'notnull' => true, - 'length' => 255, + 'length' => 255, ] ); $table->addColumn( @@ -96,14 +96,14 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt [ 'notnull' => true, 'unsigned' => true, - 'length' => 11, + 'length' => 11, ] ); $table->addColumn( 'token', 'string', [ 'notnull' => true, - 'length' => 63, + 'length' => 63, ] ); $table->addColumn( @@ -132,6 +132,4 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt */ public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options) { } - } - diff --git a/lib/Migration/Version1000Date20220201111525.php b/lib/Migration/Version1000Date20220201111525.php index 0eec3655..c8ada0b9 100644 --- a/lib/Migration/Version1000Date20220201111525.php +++ b/lib/Migration/Version1000Date20220201111525.php @@ -14,7 +14,6 @@ * Auto-generated migration step: Please modify to your needs! */ class Version1000Date20220201111525 extends SimpleMigrationStep { - public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/lib/Migration/Version1000Date20220430180808.php b/lib/Migration/Version1000Date20220430180808.php index 3414876e..373a9b4a 100644 --- a/lib/Migration/Version1000Date20220430180808.php +++ b/lib/Migration/Version1000Date20220430180808.php @@ -62,7 +62,7 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt 'owner', Types::STRING, [ 'notnull' => false, - 'length' => 255, + 'length' => 255, 'default' => '' ] ); diff --git a/lib/Model/FileLock.php b/lib/Model/FileLock.php index 414da98a..3e810c86 100644 --- a/lib/Model/FileLock.php +++ b/lib/Model/FileLock.php @@ -1,4 +1,6 @@ - $this->getId(), - 'uri' => $this->getUri(), - 'userId' => $this->getOwner(), + 'id' => $this->getId(), + 'uri' => $this->getUri(), + 'userId' => $this->getOwner(), 'displayName' => $this->getDisplayName(), - 'fileId' => $this->getFileId(), - 'token' => $this->getToken(), - 'eta' => $this->getETA(), + 'fileId' => $this->getFileId(), + 'token' => $this->getToken(), + 'eta' => $this->getETA(), 'creation' => $this->getCreatedAt(), - 'type' => $this->getType(), + 'type' => $this->getType(), ]; } @@ -346,4 +345,3 @@ public function __toString(): string { return $this->getToken(); } } - diff --git a/lib/Service/ConfigService.php b/lib/Service/ConfigService.php index 27f7646a..2072b6b3 100644 --- a/lib/Service/ConfigService.php +++ b/lib/Service/ConfigService.php @@ -1,4 +1,6 @@ - '0' @@ -130,5 +128,4 @@ public function deleteAppValue($key) { public function unsetAppConfig() { $this->config->deleteAppValues(Application::APP_ID); } - } diff --git a/lib/Service/FileService.php b/lib/Service/FileService.php index bb36a68f..4af5936c 100644 --- a/lib/Service/FileService.php +++ b/lib/Service/FileService.php @@ -1,4 +1,6 @@ -getArray($k, $arr, $default); $r = []; - list ($obj, $method) = $import; + list($obj, $method) = $import; foreach ($list as $item) { try { $o = new $obj(); @@ -449,7 +446,7 @@ protected function mustContains(array $keys, array $arr) { protected function cleanArray(array &$arr) { $arr = array_filter( $arr, - function($v) { + function ($v) { if (is_string($v)) { return ($v !== ''); } @@ -461,6 +458,4 @@ function($v) { } ); } - } - diff --git a/lib/Tools/Traits/TLogger.php b/lib/Tools/Traits/TLogger.php index 62ce98e5..f0bee232 100644 --- a/lib/Tools/Traits/TLogger.php +++ b/lib/Tools/Traits/TLogger.php @@ -1,4 +1,5 @@ $this->setup('app'), - 'exception' => $t + 'app' => $this->setup('app'), + 'exception' => $t ] ); } @@ -118,8 +115,8 @@ public function exception(Exception $e, $level = 3, array $serializable = []): v $level, $message, [ - 'app' => $this->setup('app'), - 'exception' => $e + 'app' => $this->setup('app'), + 'exception' => $e ] ); } @@ -201,6 +198,4 @@ public function logger(): LoggerInterface { return OC::$server->get(LoggerInterface::class); } } - } - diff --git a/lib/Tools/Traits/TSetup.php b/lib/Tools/Traits/TSetup.php index 54a12aad..e91ab7f1 100644 --- a/lib/Tools/Traits/TSetup.php +++ b/lib/Tools/Traits/TSetup.php @@ -1,4 +1,5 @@ getAppValue($app, $key, ''); } - } - diff --git a/lib/Tools/Traits/TStringTools.php b/lib/Tools/Traits/TStringTools.php index 2addd077..fc391861 100644 --- a/lib/Tools/Traits/TStringTools.php +++ b/lib/Tools/Traits/TStringTools.php @@ -1,4 +1,5 @@