Skip to content

Commit

Permalink
fix(psalm): Fix some newly detected issues
Browse files Browse the repository at this point in the history
Signed-off-by: provokateurin <[email protected]>
  • Loading branch information
provokateurin committed Oct 21, 2024
1 parent 3810770 commit e842699
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 29 deletions.
6 changes: 1 addition & 5 deletions apps/dav/lib/Avatars/AvatarNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,6 @@ public function getETag() {
}

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();
}
}
4 changes: 2 additions & 2 deletions apps/dav/lib/CardDAV/Xml/Groups.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
) {
}

Expand Down
4 changes: 0 additions & 4 deletions apps/dav/lib/Connector/Sabre/Directory.php
Original file line number Diff line number Diff line change
Expand Up @@ -363,10 +363,6 @@ public function moveInto($targetName, $fullSourcePath, INode $sourceNode) {
throw new BadRequest('Incompatible node types');
}

if (!$this->fileView) {
throw new ServiceUnavailable('filesystem not setup');
}

$destinationPath = $this->getPath() . '/' . $targetName;


Expand Down
9 changes: 2 additions & 7 deletions apps/encryption/lib/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
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;
Expand Down Expand Up @@ -128,13 +129,7 @@ public function getOwner($path) {
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();
}

Expand Down
2 changes: 1 addition & 1 deletion apps/files_external/lib/Config/UserContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ protected function getUserId(): ?string {
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 {
Expand Down
4 changes: 2 additions & 2 deletions apps/user_ldap/lib/LDAPProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ public function DNasBaseParameter($dn) {

/**
* 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);
Expand Down
6 changes: 0 additions & 6 deletions build/psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
4 changes: 2 additions & 2 deletions lib/public/LDAP/ILDAPProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ public function DNasBaseParameter($dn);

/**
* 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);
Expand Down

0 comments on commit e842699

Please sign in to comment.