Fix various other small psalm issues

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
pull/34628/head
Carl Schwan 2 years ago
parent 0a2a4d8687
commit 54031e370a

@ -109,7 +109,7 @@ class Cache extends CacheJail {
if (isset($this->numericId)) {
return $this->numericId;
} else {
return false;
return -1;
}
}

@ -32,12 +32,9 @@ use OCP\Share\IManager;
class ShareRecipientSorter implements ISorter {
/** @var IManager */
private $shareManager;
/** @var Folder */
private $rootFolder;
/** @var IUserSession */
private $userSession;
private IManager $shareManager;
private IRootFolder $rootFolder;
private IUserSession $userSession;
public function __construct(IManager $shareManager, IRootFolder $rootFolder, IUserSession $userSession) {
$this->shareManager = $shareManager;
@ -45,7 +42,7 @@ class ShareRecipientSorter implements ISorter {
$this->userSession = $userSession;
}
public function getId() {
public function getId(): string {
return 'share-recipients';
}

@ -429,7 +429,7 @@ class ShareController extends AuthPublicShareController {
*/
$freeSpace = $share->getNode()->getStorage()->free_space($share->getNode()->getInternalPath());
if ($freeSpace < \OCP\Files\FileInfo::SPACE_UNLIMITED) {
$freeSpace = max($freeSpace, 0);
$freeSpace = (int)max($freeSpace, 0);
} else {
$freeSpace = (INF > 0) ? INF: PHP_INT_MAX; // work around https://bugs.php.net/bug.php?id=69188
}

@ -447,14 +447,11 @@ class Manager {
return $result;
}
/**
* @param int $remoteShare
*/
public function processNotification($remoteShare) {
public function processNotification(int $remoteShare): void {
$filter = $this->notificationManager->createNotification();
$filter->setApp('files_sharing')
->setUser($this->uid)
->setObject('remote_share', (int) $remoteShare);
->setObject('remote_share', (string)$remoteShare);
$this->notificationManager->markProcessed($filter);
}

@ -61,11 +61,8 @@ class Mount extends MountPoint implements MoveableMount {
/**
* Remove the mount points
*
* @return mixed
* @return bool
*/
public function removeMount() {
public function removeMount(): bool {
return $this->manager->removeShare($this->mountPoint);
}

@ -837,7 +837,6 @@
</RedundantCondition>
<TypeDoesNotContainType occurrences="2">
<code>get_class($res) === 'OpenSSLAsymmetricKey'</code>
<code>is_object($res)</code>
</TypeDoesNotContainType>
</file>
<file src="apps/encryption/lib/Crypto/EncryptAll.php">
@ -1294,36 +1293,7 @@
<code>addServiceListener</code>
</InvalidArgument>
</file>
<file src="apps/files_sharing/lib/Cache.php">
<FalsableReturnStatement occurrences="1">
<code>false</code>
</FalsableReturnStatement>
<NullArgument occurrences="1">
<code>null</code>
</NullArgument>
</file>
<file src="apps/files_sharing/lib/Capabilities.php">
<InvalidScalarArgument occurrences="1">
<code>Constants::PERMISSION_ALL</code>
</InvalidScalarArgument>
</file>
<file src="apps/files_sharing/lib/Collaboration/ShareRecipientSorter.php">
<UndefinedInterfaceMethod occurrences="1">
<code>getUserFolder</code>
</UndefinedInterfaceMethod>
</file>
<file src="apps/files_sharing/lib/Controller/ShareAPIController.php">
<InvalidOperand occurrences="1">
<code>$permissions</code>
</InvalidOperand>
<InvalidScalarArgument occurrences="3">
<code>$code</code>
<code>$code</code>
<code>Constants::PERMISSION_ALL</code>
</InvalidScalarArgument>
<RedundantCondition occurrences="1">
<code>$permissions &amp; Constants::PERMISSION_READ</code>
</RedundantCondition>
<UndefinedClass occurrences="2">
<code>\OCA\Circles\Api\v1\Circles</code>
<code>\OCA\Circles\Api\v1\Circles</code>
@ -1339,8 +1309,7 @@
<InvalidArgument occurrences="1">
<code>$files_list</code>
</InvalidArgument>
<InvalidScalarArgument occurrences="3">
<code>$freeSpace</code>
<InvalidScalarArgument occurrences="1">
<code>$maxUploadFilesize</code>
<code>$maxUploadFilesize</code>
</InvalidScalarArgument>
@ -1348,39 +1317,11 @@
<code>null</code>
</NullArgument>
</file>
<file src="apps/files_sharing/lib/Controller/ShareInfoController.php">
<NullArgument occurrences="1">
<code>$password</code>
</NullArgument>
</file>
<file src="apps/files_sharing/lib/External/Cache.php">
<ParamNameMismatch occurrences="1">
<code>$id</code>
</ParamNameMismatch>
</file>
<file src="apps/files_sharing/lib/External/Manager.php">
<InvalidScalarArgument occurrences="1">
<code>(int) $remoteShare</code>
</InvalidScalarArgument>
</file>
<file src="apps/files_sharing/lib/External/Mount.php">
<InvalidDocblock occurrences="1">
<code>public function removeMount() {</code>
</InvalidDocblock>
</file>
<file src="apps/files_sharing/lib/External/Scanner.php">
<MoreSpecificImplementedParamType occurrences="1">
<code>$cacheData</code>
</MoreSpecificImplementedParamType>
</file>
<file src="apps/files_sharing/lib/External/Storage.php">
<InvalidReturnStatement occurrences="1">
<code>$this-&gt;getPermissions($path) &amp; Constants::PERMISSION_SHARE</code>
</InvalidReturnStatement>
<InvalidReturnType occurrences="1">
<code>isSharable</code>
</InvalidReturnType>
</file>
<file src="apps/files_sharing/lib/Listener/LegacyBeforeTemplateRenderedListener.php">
<InvalidArgument occurrences="1">
<code>$legacyEvent</code>

@ -46,7 +46,7 @@ class CacheJail extends CacheWrapper {
protected $unjailedRoot;
/**
* @param \OCP\Files\Cache\ICache $cache
* @param ?\OCP\Files\Cache\ICache $cache
* @param string $root
*/
public function __construct($cache, $root) {

@ -92,7 +92,7 @@ class Base {
/**
* Assign variables
* @param string $key key
* @param array|bool|integer|string|Throwable $value value
* @param float|array|bool|integer|string|Throwable $value value
* @return bool
*
* This function assigns a variable. It can be accessed via $_[$key] in

Loading…
Cancel
Save