Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/groupfolders.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Schwan <carl@carlschwan.eu>2022-10-11 15:05:08 +0300
committerCarl Schwan <carl@carlschwan.eu>2022-10-11 16:29:29 +0300
commit01351ac141d27ce9434baed6a7ba2b03d4987fb8 (patch)
tree47671907183aafa00f263db624efed65770ef511
parent4729f390439392a22ea60316f70c8d4d0eb2d144 (diff)
Improve psalm
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
-rw-r--r--composer.json2
-rw-r--r--lib/Mount/GroupFolderStorage.php1
-rw-r--r--tests/psalm-baseline.xml26
-rw-r--r--tests/stub.phpstub50
4 files changed, 69 insertions, 10 deletions
diff --git a/composer.json b/composer.json
index 59a0ffce..1b1c0886 100644
--- a/composer.json
+++ b/composer.json
@@ -16,7 +16,7 @@
"cs:check": "php-cs-fixer fix --dry-run --diff",
"cs:fix": "php-cs-fixer fix",
"psalm": "psalm.phar --threads=1",
- "psalm:update-baseline": "psalm.phar --threads=1 --update-baseline --set-baseline=tests/psalm-baseline.xml",
+ "psalm:update-baseline": "psalm.phar --threads=1 --update-baseline",
"psalm:clear": "psalm.phar --clear-cache && psalm --clear-global-cache",
"psalm:fix": "psalm.phar --alter --issues=InvalidReturnType,InvalidNullableReturnType,MissingParamType,InvalidFalsableReturnType"
},
diff --git a/lib/Mount/GroupFolderStorage.php b/lib/Mount/GroupFolderStorage.php
index de9c674b..901360ce 100644
--- a/lib/Mount/GroupFolderStorage.php
+++ b/lib/Mount/GroupFolderStorage.php
@@ -71,6 +71,7 @@ class GroupFolderStorage extends Quota {
}
public function getScanner($path = '', $storage = null) {
+ /** @var \OC\Files\Storage\Storage $storage */
if (!$storage) {
$storage = $this;
}
diff --git a/tests/psalm-baseline.xml b/tests/psalm-baseline.xml
index 770e1188..c23b79be 100644
--- a/tests/psalm-baseline.xml
+++ b/tests/psalm-baseline.xml
@@ -1,5 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="4.x-dev@">
+ <file src="lib/ACL/ACLStorageWrapper.php">
+ <InvalidNullableReturnType occurrences="2">
+ <code>filemtime</code>
+ <code>hash</code>
+ </InvalidNullableReturnType>
+ <UndefinedClass occurrences="1">
+ <code>IteratorDirectory</code>
+ </UndefinedClass>
+ <UndefinedInterfaceMethod occurrences="1">
+ <code>getDirectoryContent</code>
+ </UndefinedInterfaceMethod>
+ <UndefinedMethod occurrences="2">
+ <code>parent::getMetaData($path)</code>
+ <code>parent::writeStream($path, $stream, $size)</code>
+ </UndefinedMethod>
+ </file>
<file src="lib/AppInfo/Application.php">
<UndefinedClass occurrences="1">
<code>BeforeTemplateRenderedEvent</code>
@@ -16,6 +32,16 @@
<code>$this-&gt;__call(__FUNCTION__, func_get_args())</code>
</InvalidReturnStatement>
</file>
+ <file src="lib/Mount/RootPermissionsMask.php">
+ <UndefinedMethod occurrences="1">
+ <code>parent::getMetaData($path)</code>
+ </UndefinedMethod>
+ </file>
+ <file src="lib/Trash/GroupTrashItem.php">
+ <UndefinedMethod occurrences="1">
+ <code>parent::__construct($backend, $originalLocation, $deletedTime, $trashPath, $fileInfo, $user)</code>
+ </UndefinedMethod>
+ </file>
<file src="lib/Versions/ExpireManager.php">
<TypeDoesNotContainType occurrences="2">
<code>self::MAX_VERSIONS_PER_INTERVAL[$interval]['intervalEndsAfter'] === -1</code>
diff --git a/tests/stub.phpstub b/tests/stub.phpstub
index f4882ce5..5ca31e86 100644
--- a/tests/stub.phpstub
+++ b/tests/stub.phpstub
@@ -414,7 +414,8 @@ namespace OC\Core\Command {
}
namespace OC\Files\ObjectStore {
- class NoopScanner {}
+ use OC\Files\Cache\Scanner;
+ class NoopScanner extends Scanner {}
}
namespace Symfony\Component\Console\Helper {
@@ -458,11 +459,13 @@ namespace Symfony\Component\Console\Output {
namespace OC\Files\Cache {
use OCP\Files\Cache\ICache;
+ use OCP\Files\Cache\IScanner;
use OCP\Files\Cache\ICacheEntry;
use OCP\Files\Search\ISearchQuery;
use OCP\Files\Search\ISearchOperator;
use OCP\Files\Search\ISearchQuery;
use OCP\Files\IMimeTypeLoader;
+ use OCP\Files\Storage\IStorage;
class Cache implements ICache {
/**
@@ -500,11 +503,17 @@ namespace OC\Files\Cache {
public function getCacheEntryFromSearchResult(ICacheEntry $rawEntry): ?ICacheEntry {}
public static function cacheEntryFromData($data, IMimeTypeLoader $mimetypeLoader): ICacheEntry {}
}
+
+ class Scanner implements IScanner {
+ public function __construct(IStorage $storage) {}
+ }
}
namespace OC\Files\Cache\Wrapper {
use OC\Files\Cache\Cache;
- class CacheWrapper extends Cache {}
+ class CacheWrapper extends Cache {
+ public function getCache(): Cache {}
+ }
}
namespace OC\Files {
@@ -597,7 +606,7 @@ namespace OC\Files\Mount {
class MountPoint implements IMountPoint {
/**
- * @var \OC\Files\Storage\Storage $storage
+ * @var \OCP\Files\Storage\IStorage $storage
*/
protected $storage = null;
protected $class;
@@ -616,7 +625,7 @@ namespace OC\Files\Mount {
* @param int|null $mountId
* @throws \Exception
*/
- public function __construct($storage, $mountpoint, $arguments = null, $loader = null, $mountOptions = null, $mountId = null) {
+ public function __construct($storage, $mountpoint, $arguments = null, $loader = null, $mountOptions = null, $mountId = null, string $mountProvider = null) {
throw new \Exception('stub');
}
@@ -715,19 +724,21 @@ namespace OC\Files\Mount {
}
}
-namespace OC\Files\Storage\Wrapper{
-
+namespace OC\Files\Storage {
use OCP\Files\Cache\ICache;
use OCP\Files\Cache\ICacheEntry;
use OCP\Files\Search\ISearchQuery;
+ use OC\Files\Storage\Storage;
use OCP\Files\Storage\IStorage;
+ use OCP\Files\Cache\IScanner;
+
+ class Storage implements IStorage {
+ /** @var ?IScanner */
+ public $scanner;
- class Wrapper implements IStorage {
public function __construct(array $parameters) {
}
- public function getWrapperStorage(): ?IStorage {}
-
public function getId() {}
public function mkdir($path) {}
@@ -901,6 +912,22 @@ namespace OC\Files\Storage\Wrapper{
public function getWatcher() {
throw new \Exception('stub');
}
+ }
+}
+
+namespace OC\Files\Storage\Wrapper{
+
+ use OCP\Files\Cache\ICache;
+ use OCP\Files\Cache\ICacheEntry;
+ use OCP\Files\Search\ISearchQuery;
+ use OC\Files\Storage\Storage;
+ use OCP\Files\Storage\IStorage;
+ use OCP\Files\Cache\IScanner;
+
+ class Wrapper extends Storage {
+ protected Storage $storage;
+
+ public function getWrapperStorage(): ?IStorage {}
}
class Jail extends Wrapper {
@@ -919,3 +946,8 @@ namespace OC\Files\Storage\Wrapper{
namespace OCP\Files\Mount {
interface ISystemMountPoint {}
}
+
+namespace OC\Files\ObjectStore {
+ use OC\Files\Storage\Wrapper\Wrapper;
+ class ObjectStoreStorage extends Wrapper {}
+}