fix(psalm): Fix some newly detected issues

Signed-off-by: provokateurin <kate@provokateurin.de>
pull/48790/head
provokateurin 12 months ago
parent 381077028a
commit e8426996f5
No known key found for this signature in database
  1. 6
      apps/dav/lib/Avatars/AvatarNode.php
  2. 4
      apps/dav/lib/CardDAV/Xml/Groups.php
  3. 4
      apps/dav/lib/Connector/Sabre/Directory.php
  4. 9
      apps/encryption/lib/Util.php
  5. 2
      apps/files_external/lib/Config/UserContext.php
  6. 4
      apps/user_ldap/lib/LDAPProvider.php
  7. 6
      build/psalm-baseline.xml
  8. 4
      lib/public/LDAP/ILDAPProvider.php

@ -69,10 +69,6 @@ class AvatarNode extends File {
}
public function getLastModified() {
$timestamp = $this->avatar->getFile($this->size)->getMTime();
if (!empty($timestamp)) {
return (int)$timestamp;
}
return $timestamp;
return $this->avatar->getFile($this->size)->getMTime();
}
}

@ -14,10 +14,10 @@ class Groups implements XmlSerializable {
public const NS_OWNCLOUD = 'http://owncloud.org/ns';
/**
* @param string $groups
* @param list<string> $groups
*/
public function __construct(
private $groups,
private array $groups,
) {
}

@ -363,10 +363,6 @@ class Directory extends Node implements \Sabre\DAV\ICollection, \Sabre\DAV\IQuot
throw new BadRequest('Incompatible node types');
}
if (!$this->fileView) {
throw new ServiceUnavailable('filesystem not setup');
}
$destinationPath = $this->getPath() . '/' . $targetName;

@ -10,6 +10,7 @@ namespace OCA\Encryption;
use OC\Files\Storage\Storage;
use OC\Files\View;
use OCA\Encryption\Crypto\Crypt;
use OCP\Files\Storage\IStorage;
use OCP\IConfig;
use OCP\IUser;
use OCP\IUserManager;
@ -128,13 +129,7 @@ class Util {
return $owner;
}
/**
* get storage of path
*
* @param string $path
* @return Storage|null
*/
public function getStorage($path) {
public function getStorage(string $path): ?IStorage {
return $this->files->getMount($path)->getStorage();
}

@ -37,7 +37,7 @@ class UserContext {
if ($this->userId !== null) {
return $this->userId;
}
if ($this->session && $this->session->getUser() !== null) {
if ($this->session->getUser() !== null) {
return $this->session->getUser()->getUID();
}
try {

@ -118,8 +118,8 @@ class LDAPProvider implements ILDAPProvider, IDeletionFlagSupport {
/**
* Sanitize a DN received from the LDAP server.
* @param array $dn the DN in question
* @return array the sanitized DN
* @param array|string $dn the DN in question
* @return array|string the sanitized DN
*/
public function sanitizeDN($dn) {
return $this->helper->sanitizeDN($dn);

@ -682,12 +682,6 @@
<code><![CDATA[new PrivateKeyMissingException('please try to log-out and log-in again', 0)]]></code>
</TooManyArguments>
</file>
<file src="apps/encryption/lib/Util.php">
<LessSpecificReturnStatement>
<code><![CDATA[$this->files->getMount($path)->getStorage()]]></code>
</LessSpecificReturnStatement>
<MoreSpecificReturnType/>
</file>
<file src="apps/federatedfilesharing/lib/Controller/RequestHandlerController.php">
<InvalidArgument>
<code><![CDATA[$id]]></code>

@ -46,8 +46,8 @@ interface ILDAPProvider {
/**
* Sanitize a DN received from the LDAP server.
* @param array $dn the DN in question
* @return array the sanitized DN
* @param array|string $dn the DN in question
* @return array|string the sanitized DN
* @since 11.0.0
*/
public function sanitizeDN($dn);

Loading…
Cancel
Save