Skip to content

Commit 47a5ea1

Browse files
committed
Fix a few psalm issues and moved back to psalm 4.8
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
1 parent 47c9c34 commit 47a5ea1

19 files changed

Lines changed: 270 additions & 1686 deletions

File tree

apps/encryption/lib/Crypto/Crypt.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ private function encrypt($plainContent, $iv, $passPhrase = '', $cipher = self::D
237237
$encryptedContent = openssl_encrypt($plainContent,
238238
$cipher,
239239
$passPhrase,
240-
false,
240+
0,
241241
$iv);
242242

243243
if (!$encryptedContent) {
@@ -617,7 +617,7 @@ private function decrypt($encryptedContent, $iv, $passPhrase = '', $cipher = sel
617617
$plainContent = openssl_decrypt($encryptedContent,
618618
$cipher,
619619
$passPhrase,
620-
false,
620+
0,
621621
$iv);
622622

623623
if ($plainContent) {

apps/encryption/lib/KeyManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ public function __construct(
159159
$this->config->setAppValue('encryption', 'masterKeyId', $this->masterKeyId);
160160
}
161161

162-
$this->keyId = $userSession && $userSession->isLoggedIn() ? $userSession->getUser()->getUID() : false;
162+
$this->keyId = $userSession->isLoggedIn() ? $userSession->getUser()->getUID() : false;
163163
$this->log = $log;
164164
}
165165

apps/encryption/lib/Migration/SetMasterKeyStatus.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ public function run(IOutput $output) {
6262

6363
// if no config for the master key is set we set it explicitly to '0' in
6464
// order not to break old installations because the default changed to '1'.
65-
$configAlreadySet = $this->config->getAppValue('encryption', 'useMasterKey', false);
66-
if ($configAlreadySet === false) {
65+
$configAlreadySet = $this->config->getAppValue('encryption', 'useMasterKey', 'not-set');
66+
if ($configAlreadySet === 'not-set') {
6767
$this->config->setAppValue('encryption', 'useMasterKey', '0');
6868
}
6969
}

apps/encryption/lib/Recovery.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public function __construct(IUserSession $userSession,
7676
IConfig $config,
7777
IFile $file,
7878
View $view) {
79-
$this->user = ($userSession && $userSession->isLoggedIn()) ? $userSession->getUser() : false;
79+
$this->user = ($userSession->isLoggedIn()) ? $userSession->getUser() : null;
8080
$this->crypt = $crypt;
8181
$this->keyManager = $keyManager;
8282
$this->config = $config;

apps/files_external/lib/Lib/Storage/FtpConnection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
* Low level wrapper around the ftp functions that smooths over some difference between servers
2828
*/
2929
class FtpConnection {
30-
/** @var resource */
30+
/** @var resource|\FTP\Connection */
3131
private $connection;
3232

3333
public function __construct(bool $secure, string $hostname, int $port, string $username, string $password) {

apps/settings/lib/SetupChecks/CheckUserCertificates.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,7 @@ class CheckUserCertificates {
3939

4040
public function __construct(IL10N $l10n, IConfig $config, IURLGenerator $urlGenerator) {
4141
$this->l10n = $l10n;
42-
$configValue = $config->getAppValue('files_external', 'user_certificate_scan', false);
43-
if (!is_string($configValue)) {
44-
$configValue = '';
45-
}
42+
$configValue = $config->getAppValue('files_external', 'user_certificate_scan', '');
4643
$this->configValue = $configValue;
4744
$this->urlGenerator = $urlGenerator;
4845
}

apps/user_ldap/lib/Access.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1753,7 +1753,7 @@ private function detectUuidAttribute($dn, $isUser = true, $force = false, array
17531753
}
17541754

17551755
$attribute = $this->connection->getFromCache($uuidAttr);
1756-
if (!$attribute === null) {
1756+
if ($attribute !== null) {
17571757
$this->connection->$uuidAttr = $attribute;
17581758
return true;
17591759
}

build/stubs/ftp.php

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
<?php
2+
3+
/** @generate-class-entries */
4+
5+
namespace FTP {
6+
7+
/**
8+
* @strict-properties
9+
* @not-serializable
10+
*/
11+
final class Connection
12+
{
13+
}
14+
15+
}
16+
17+
namespace {
18+
19+
function ftp_connect(string $hostname, int $port = 21, int $timeout = 90): FTP\Connection|resource|false {}
20+
21+
#ifdef HAVE_FTP_SSL
22+
function ftp_ssl_connect(string $hostname, int $port = 21, int $timeout = 90): FTP\Connection|resource|false {}
23+
#endif
24+
25+
function ftp_login(FTP\Connection|resource $ftp, string $username, string $password): bool {}
26+
function ftp_pwd(FTP\Connection|resource $ftp): string|false {}
27+
function ftp_cdup(FTP\Connection|resource $ftp): bool {}
28+
function ftp_chdir(FTP\Connection|resource $ftp, string $directory): bool {}
29+
function ftp_exec(FTP\Connection|resource $ftp, string $command): bool {}
30+
function ftp_raw(FTP\Connection|resource $ftp, string $command): ?array {}
31+
function ftp_mkdir(FTP\Connection|resource $ftp, string $directory): string|false {}
32+
function ftp_rmdir(FTP\Connection|resource $ftp, string $directory): bool {}
33+
function ftp_chmod(FTP\Connection|resource $ftp, int $permissions, string $filename): int|false {}
34+
35+
/** @param string $response */
36+
function ftp_alloc(FTP\Connection|resource $ftp, int $size, &$response = null): bool {}
37+
function ftp_nlist(FTP\Connection|resource $ftp, string $directory): array|false {}
38+
function ftp_rawlist(FTP\Connection|resource $ftp, string $directory, bool $recursive = false): array|false {}
39+
function ftp_mlsd(FTP\Connection|resource $ftp, string $directory): array|false {}
40+
function ftp_systype(FTP\Connection|resource $ftp): string|false {}
41+
42+
/** @param resource $stream */
43+
function ftp_fget(FTP\Connection|resource $ftp, $stream, string $remote_filename, int $mode = FTP_BINARY, int $offset = 0): bool {}
44+
45+
/** @param resource $stream */
46+
function ftp_nb_fget(FTP\Connection|resource $ftp, $stream, string $remote_filename, int $mode = FTP_BINARY, int $offset = 0): int {}
47+
function ftp_pasv(FTP\Connection|resource $ftp, bool $enable): bool {}
48+
function ftp_get(FTP\Connection|resource $ftp, string $local_filename, string $remote_filename, int $mode = FTP_BINARY, int $offset = 0): bool {}
49+
function ftp_nb_get(FTP\Connection|resource $ftp, string $local_filename, string $remote_filename, int $mode = FTP_BINARY, int $offset = 0): int {}
50+
function ftp_nb_continue(FTP\Connection|resource $ftp): int {}
51+
52+
/** @param resource $stream */
53+
function ftp_fput(FTP\Connection|resource $ftp, string $remote_filename, $stream, int $mode = FTP_BINARY, int $offset = 0): bool {}
54+
55+
/** @param resource $stream */
56+
function ftp_nb_fput(FTP\Connection|resource $ftp, string $remote_filename, $stream, int $mode = FTP_BINARY, int $offset = 0): int {}
57+
function ftp_put(FTP\Connection|resource $ftp, string $remote_filename, string $local_filename, int $mode = FTP_BINARY, int $offset = 0): bool {}
58+
function ftp_append(FTP\Connection|resource $ftp, string $remote_filename, string $local_filename, int $mode = FTP_BINARY): bool {}
59+
function ftp_nb_put(FTP\Connection|resource $ftp, string $remote_filename, string $local_filename, int $mode = FTP_BINARY, int $offset = 0): int|false {}
60+
function ftp_size(FTP\Connection|resource $ftp, string $filename): int {}
61+
function ftp_mdtm(FTP\Connection|resource $ftp, string $filename): int {}
62+
function ftp_rename(FTP\Connection|resource $ftp, string $from, string $to): bool {}
63+
function ftp_delete(FTP\Connection|resource $ftp, string $filename): bool {}
64+
function ftp_site(FTP\Connection|resource $ftp, string $command): bool {}
65+
function ftp_close(FTP\Connection|resource $ftp): bool {}
66+
67+
/** @alias ftp_close */
68+
function ftp_quit(FTP\Connection|resource $ftp): bool {}
69+
70+
/** @param int|bool $value */
71+
function ftp_set_option(FTP\Connection|resource $ftp, int $option, $value): bool {}
72+
function ftp_get_option(FTP\Connection|resource $ftp, int $option): int|bool {}
73+
74+
}

build/stubs/gd.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
<?php
22

3+
/**
4+
* @strict-properties
5+
* @not-serializable
6+
*/
7+
final class GdImage {}
8+
39
/**
410
* Retrieve information about the currently installed GD library
511
* @link https://php.net/manual/en/function.gd-info.php

0 commit comments

Comments
 (0)