Skip to content

Commit

Permalink
Fix a few psalm issues and moved back to psalm/phar 4.18
Browse files Browse the repository at this point in the history
Signed-off-by: Carl Schwan <[email protected]>
  • Loading branch information
CarlSchwan committed Jan 12, 2022
1 parent 47c9c34 commit aeecb72
Show file tree
Hide file tree
Showing 27 changed files with 504 additions and 1,724 deletions.
4 changes: 2 additions & 2 deletions apps/encryption/lib/Crypto/Crypt.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ private function encrypt($plainContent, $iv, $passPhrase = '', $cipher = self::D
$encryptedContent = openssl_encrypt($plainContent,
$cipher,
$passPhrase,
false,
0,
$iv);

if (!$encryptedContent) {
Expand Down Expand Up @@ -617,7 +617,7 @@ private function decrypt($encryptedContent, $iv, $passPhrase = '', $cipher = sel
$plainContent = openssl_decrypt($encryptedContent,
$cipher,
$passPhrase,
false,
0,
$iv);

if ($plainContent) {
Expand Down
2 changes: 1 addition & 1 deletion apps/encryption/lib/KeyManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public function __construct(
$this->config->setAppValue('encryption', 'masterKeyId', $this->masterKeyId);
}

$this->keyId = $userSession && $userSession->isLoggedIn() ? $userSession->getUser()->getUID() : false;
$this->keyId = $userSession->isLoggedIn() ? $userSession->getUser()->getUID() : false;
$this->log = $log;
}

Expand Down
4 changes: 2 additions & 2 deletions apps/encryption/lib/Migration/SetMasterKeyStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ public function run(IOutput $output) {

// if no config for the master key is set we set it explicitly to '0' in
// order not to break old installations because the default changed to '1'.
$configAlreadySet = $this->config->getAppValue('encryption', 'useMasterKey', false);
if ($configAlreadySet === false) {
$configAlreadySet = $this->config->getAppValue('encryption', 'useMasterKey', 'not-set');
if ($configAlreadySet === 'not-set') {
$this->config->setAppValue('encryption', 'useMasterKey', '0');
}
}
Expand Down
2 changes: 1 addition & 1 deletion apps/encryption/lib/Recovery.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function __construct(IUserSession $userSession,
IConfig $config,
IFile $file,
View $view) {
$this->user = ($userSession && $userSession->isLoggedIn()) ? $userSession->getUser() : false;
$this->user = ($userSession->isLoggedIn()) ? $userSession->getUser() : null;
$this->crypt = $crypt;
$this->keyManager = $keyManager;
$this->config = $config;
Expand Down
2 changes: 1 addition & 1 deletion apps/files_external/lib/Lib/Storage/FtpConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* Low level wrapper around the ftp functions that smooths over some difference between servers
*/
class FtpConnection {
/** @var resource */
/** @var resource|\FTP\Connection */
private $connection;

public function __construct(bool $secure, string $hostname, int $port, string $username, string $password) {
Expand Down
5 changes: 1 addition & 4 deletions apps/settings/lib/SetupChecks/CheckUserCertificates.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,7 @@ class CheckUserCertificates {

public function __construct(IL10N $l10n, IConfig $config, IURLGenerator $urlGenerator) {
$this->l10n = $l10n;
$configValue = $config->getAppValue('files_external', 'user_certificate_scan', false);
if (!is_string($configValue)) {
$configValue = '';
}
$configValue = $config->getAppValue('files_external', 'user_certificate_scan', '');
$this->configValue = $configValue;
$this->urlGenerator = $urlGenerator;
}
Expand Down
2 changes: 1 addition & 1 deletion apps/user_ldap/lib/Access.php
Original file line number Diff line number Diff line change
Expand Up @@ -1753,7 +1753,7 @@ private function detectUuidAttribute($dn, $isUser = true, $force = false, array
}

$attribute = $this->connection->getFromCache($uuidAttr);
if (!$attribute === null) {
if ($attribute !== null) {
$this->connection->$uuidAttr = $attribute;
return true;
}
Expand Down
6 changes: 4 additions & 2 deletions build/psalm-baseline-ocp.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="4.8.1@f73f2299dbc59a3e6c4d66cff4605176e728ee69">
<files psalm-version="4.18.1@dda05fa913f4dc6eb3386f2f7ce5a45d37a71bcb">
<file src="lib/private/legacy/OC_Image.php">
<ImplementedReturnTypeMismatch occurrences="1">
<code>null|string</code>
Expand Down Expand Up @@ -220,7 +220,9 @@
<InvalidReturnType occurrences="1">
<code>float</code>
</InvalidReturnType>
<UndefinedClass occurrences="12">
<UndefinedClass occurrences="14">
<code>\OC</code>
<code>\OC</code>
<code>\OC</code>
<code>\OC</code>
<code>\OC</code>
Expand Down
Loading

0 comments on commit aeecb72

Please sign in to comment.