Fix a few psalm issues and moved back to psalm/phar 4.18

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
This commit is contained in:
Carl Schwan 2022-01-06 16:57:32 +01:00
parent 47c9c34cca
commit aeecb72e96
No known key found for this signature in database
GPG Key ID: 06B35D38387B67BE
27 changed files with 507 additions and 1727 deletions

View File

@ -237,7 +237,7 @@ class Crypt {
$encryptedContent = openssl_encrypt($plainContent, $encryptedContent = openssl_encrypt($plainContent,
$cipher, $cipher,
$passPhrase, $passPhrase,
false, 0,
$iv); $iv);
if (!$encryptedContent) { if (!$encryptedContent) {
@ -617,7 +617,7 @@ class Crypt {
$plainContent = openssl_decrypt($encryptedContent, $plainContent = openssl_decrypt($encryptedContent,
$cipher, $cipher,
$passPhrase, $passPhrase,
false, 0,
$iv); $iv);
if ($plainContent) { if ($plainContent) {

View File

@ -159,7 +159,7 @@ class KeyManager {
$this->config->setAppValue('encryption', 'masterKeyId', $this->masterKeyId); $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; $this->log = $log;
} }

View File

@ -62,8 +62,8 @@ class SetMasterKeyStatus implements IRepairStep {
// if no config for the master key is set we set it explicitly to '0' in // 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'. // order not to break old installations because the default changed to '1'.
$configAlreadySet = $this->config->getAppValue('encryption', 'useMasterKey', false); $configAlreadySet = $this->config->getAppValue('encryption', 'useMasterKey', 'not-set');
if ($configAlreadySet === false) { if ($configAlreadySet === 'not-set') {
$this->config->setAppValue('encryption', 'useMasterKey', '0'); $this->config->setAppValue('encryption', 'useMasterKey', '0');
} }
} }

View File

@ -76,7 +76,7 @@ class Recovery {
IConfig $config, IConfig $config,
IFile $file, IFile $file,
View $view) { View $view) {
$this->user = ($userSession && $userSession->isLoggedIn()) ? $userSession->getUser() : false; $this->user = ($userSession->isLoggedIn()) ? $userSession->getUser() : null;
$this->crypt = $crypt; $this->crypt = $crypt;
$this->keyManager = $keyManager; $this->keyManager = $keyManager;
$this->config = $config; $this->config = $config;

View File

@ -27,7 +27,7 @@ namespace OCA\Files_External\Lib\Storage;
* Low level wrapper around the ftp functions that smooths over some difference between servers * Low level wrapper around the ftp functions that smooths over some difference between servers
*/ */
class FtpConnection { class FtpConnection {
/** @var resource */ /** @var resource|\FTP\Connection */
private $connection; private $connection;
public function __construct(bool $secure, string $hostname, int $port, string $username, string $password) { public function __construct(bool $secure, string $hostname, int $port, string $username, string $password) {

View File

@ -39,10 +39,7 @@ class CheckUserCertificates {
public function __construct(IL10N $l10n, IConfig $config, IURLGenerator $urlGenerator) { public function __construct(IL10N $l10n, IConfig $config, IURLGenerator $urlGenerator) {
$this->l10n = $l10n; $this->l10n = $l10n;
$configValue = $config->getAppValue('files_external', 'user_certificate_scan', false); $configValue = $config->getAppValue('files_external', 'user_certificate_scan', '');
if (!is_string($configValue)) {
$configValue = '';
}
$this->configValue = $configValue; $this->configValue = $configValue;
$this->urlGenerator = $urlGenerator; $this->urlGenerator = $urlGenerator;
} }

View File

@ -1753,7 +1753,7 @@ class Access extends LDAPUtility {
} }
$attribute = $this->connection->getFromCache($uuidAttr); $attribute = $this->connection->getFromCache($uuidAttr);
if (!$attribute === null) { if ($attribute !== null) {
$this->connection->$uuidAttr = $attribute; $this->connection->$uuidAttr = $attribute;
return true; return true;
} }

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?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"> <file src="lib/private/legacy/OC_Image.php">
<ImplementedReturnTypeMismatch occurrences="1"> <ImplementedReturnTypeMismatch occurrences="1">
<code>null|string</code> <code>null|string</code>
@ -220,7 +220,9 @@
<InvalidReturnType occurrences="1"> <InvalidReturnType occurrences="1">
<code>float</code> <code>float</code>
</InvalidReturnType> </InvalidReturnType>
<UndefinedClass occurrences="12"> <UndefinedClass occurrences="14">
<code>\OC</code>
<code>\OC</code>
<code>\OC</code> <code>\OC</code>
<code>\OC</code> <code>\OC</code>
<code>\OC</code> <code>\OC</code>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="4.17.0@6f4707aa41c9174353a6434bba3fc8840f981d9c"> <files psalm-version="4.18.1@dda05fa913f4dc6eb3386f2f7ce5a45d37a71bcb">
<file src="3rdparty/sabre/dav/lib/CalDAV/Calendar.php"> <file src="3rdparty/sabre/dav/lib/CalDAV/Calendar.php">
<MoreSpecificImplementedParamType occurrences="1"> <MoreSpecificImplementedParamType occurrences="1">
<code>$calendarData</code> <code>$calendarData</code>
@ -36,6 +36,11 @@
<code>array</code> <code>array</code>
</LessSpecificImplementedReturnType> </LessSpecificImplementedReturnType>
</file> </file>
<file src="apps/admin_audit/lib/AppInfo/Application.php">
<InvalidArgument occurrences="1">
<code>registerEventListener</code>
</InvalidArgument>
</file>
<file src="apps/cloud_federation_api/lib/Controller/RequestHandlerController.php"> <file src="apps/cloud_federation_api/lib/Controller/RequestHandlerController.php">
<InvalidScalarArgument occurrences="1"> <InvalidScalarArgument occurrences="1">
<code>$e-&gt;getCode()</code> <code>$e-&gt;getCode()</code>
@ -44,6 +49,12 @@
<code>!is_array($notification)</code> <code>!is_array($notification)</code>
</TypeDoesNotContainType> </TypeDoesNotContainType>
</file> </file>
<file src="apps/comments/lib/AppInfo/Application.php">
<InvalidArgument occurrences="2">
<code>registerEventListener</code>
<code>registerEventListener</code>
</InvalidArgument>
</file>
<file src="apps/comments/lib/Search/Result.php"> <file src="apps/comments/lib/Search/Result.php">
<InvalidScalarArgument occurrences="1"> <InvalidScalarArgument occurrences="1">
<code>(int) $comment-&gt;getId()</code> <code>(int) $comment-&gt;getId()</code>
@ -54,6 +65,11 @@
<code>\Sabre\Uri\split($this-&gt;principalUri)</code> <code>\Sabre\Uri\split($this-&gt;principalUri)</code>
</UndefinedFunction> </UndefinedFunction>
</file> </file>
<file src="apps/contactsinteraction/lib/AppInfo/Application.php">
<InvalidArgument occurrences="1">
<code>registerEventListener</code>
</InvalidArgument>
</file>
<file src="apps/dav/appinfo/v1/caldav.php"> <file src="apps/dav/appinfo/v1/caldav.php">
<TooManyArguments occurrences="1"> <TooManyArguments occurrences="1">
<code>new \Sabre\DAV\Auth\Plugin($authBackend, 'ownCloud')</code> <code>new \Sabre\DAV\Auth\Plugin($authBackend, 'ownCloud')</code>
@ -112,6 +128,36 @@
</MissingFile> </MissingFile>
</file> </file>
<file src="apps/dav/lib/AppInfo/Application.php"> <file src="apps/dav/lib/AppInfo/Application.php">
<InvalidArgument occurrences="28">
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
</InvalidArgument>
<UndefinedInterfaceMethod occurrences="1"> <UndefinedInterfaceMethod occurrences="1">
<code>getAppDataDir</code> <code>getAppDataDir</code>
</UndefinedInterfaceMethod> </UndefinedInterfaceMethod>
@ -314,6 +360,11 @@
<code>@var VEvent $vevent</code> <code>@var VEvent $vevent</code>
</PossiblyInvalidDocblockTag> </PossiblyInvalidDocblockTag>
</file> </file>
<file src="apps/dav/lib/CalDAV/Reminder/NotificationProviderManager.php">
<UndefinedConstant occurrences="1">
<code>$provider::NOTIFICATION_TYPE</code>
</UndefinedConstant>
</file>
<file src="apps/dav/lib/CalDAV/Reminder/Notifier.php"> <file src="apps/dav/lib/CalDAV/Reminder/Notifier.php">
<FalsableReturnStatement occurrences="4"> <FalsableReturnStatement occurrences="4">
<code>$this-&gt;l10n-&gt;l('date', $dt, ['width' =&gt; 'medium'])</code> <code>$this-&gt;l10n-&gt;l('date', $dt, ['width' =&gt; 'medium'])</code>
@ -1005,6 +1056,9 @@
<InvalidReturnType occurrences="1"> <InvalidReturnType occurrences="1">
<code>array</code> <code>array</code>
</InvalidReturnType> </InvalidReturnType>
<RedundantFunctionCall occurrences="1">
<code>array_values</code>
</RedundantFunctionCall>
</file> </file>
<file src="apps/dav/lib/Upload/UploadHome.php"> <file src="apps/dav/lib/Upload/UploadHome.php">
<UndefinedFunction occurrences="1"> <UndefinedFunction occurrences="1">
@ -1022,7 +1076,8 @@
</InvalidOperand> </InvalidOperand>
</file> </file>
<file src="apps/encryption/lib/Crypto/Crypt.php"> <file src="apps/encryption/lib/Crypto/Crypt.php">
<RedundantCondition occurrences="1"> <RedundantCondition occurrences="2">
<code>$userSession</code>
<code>$userSession</code> <code>$userSession</code>
</RedundantCondition> </RedundantCondition>
<TypeDoesNotContainType occurrences="2"> <TypeDoesNotContainType occurrences="2">
@ -1058,9 +1113,6 @@
<InvalidThrow occurrences="1"> <InvalidThrow occurrences="1">
<code>throw $exception;</code> <code>throw $exception;</code>
</InvalidThrow> </InvalidThrow>
<RedundantCondition occurrences="1">
<code>$userSession</code>
</RedundantCondition>
</file> </file>
<file src="apps/encryption/lib/Recovery.php"> <file src="apps/encryption/lib/Recovery.php">
<InvalidScalarArgument occurrences="3"> <InvalidScalarArgument occurrences="3">
@ -1068,9 +1120,6 @@
<code>0</code> <code>0</code>
<code>1</code> <code>1</code>
</InvalidScalarArgument> </InvalidScalarArgument>
<RedundantCondition occurrences="1">
<code>$userSession</code>
</RedundantCondition>
</file> </file>
<file src="apps/encryption/lib/Session.php"> <file src="apps/encryption/lib/Session.php">
<TooManyArguments occurrences="1"> <TooManyArguments occurrences="1">
@ -1078,10 +1127,16 @@
</TooManyArguments> </TooManyArguments>
</file> </file>
<file src="apps/encryption/lib/Util.php"> <file src="apps/encryption/lib/Util.php">
<RedundantCondition occurrences="1"> <RedundantCondition occurrences="2">
<code>$userSession</code>
<code>$userSession</code> <code>$userSession</code>
</RedundantCondition> </RedundantCondition>
</file> </file>
<file src="apps/federatedfilesharing/lib/AppInfo/Application.php">
<InvalidArgument occurrences="1">
<code>registerEventListener</code>
</InvalidArgument>
</file>
<file src="apps/federatedfilesharing/lib/Controller/RequestHandlerController.php"> <file src="apps/federatedfilesharing/lib/Controller/RequestHandlerController.php">
<InvalidScalarArgument occurrences="7"> <InvalidScalarArgument occurrences="7">
<code>$id</code> <code>$id</code>
@ -1136,6 +1191,11 @@
<code>null</code> <code>null</code>
</NullableReturnStatement> </NullableReturnStatement>
</file> </file>
<file src="apps/federation/lib/AppInfo/Application.php">
<InvalidArgument occurrences="1">
<code>registerEventListener</code>
</InvalidArgument>
</file>
<file src="apps/federation/lib/TrustedServers.php"> <file src="apps/federation/lib/TrustedServers.php">
<InvalidArgument occurrences="1"> <InvalidArgument occurrences="1">
<code>'OCP\Federation\TrustedServerEvent::remove'</code> <code>'OCP\Federation\TrustedServerEvent::remove'</code>
@ -1180,6 +1240,12 @@
<code>10 * 1024 * 1024</code> <code>10 * 1024 * 1024</code>
</InvalidScalarArgument> </InvalidScalarArgument>
</file> </file>
<file src="apps/files/lib/AppInfo/Application.php">
<InvalidArgument occurrences="2">
<code>registerEventListener</code>
<code>registerEventListener</code>
</InvalidArgument>
</file>
<file src="apps/files/lib/Command/Scan.php"> <file src="apps/files/lib/Command/Scan.php">
<NullArgument occurrences="1"> <NullArgument occurrences="1">
<code>null</code> <code>null</code>
@ -1269,6 +1335,12 @@
<code>$this</code> <code>$this</code>
</InvalidScope> </InvalidScope>
</file> </file>
<file src="apps/files_external/lib/AppInfo/Application.php">
<InvalidArgument occurrences="2">
<code>registerEventListener</code>
<code>registerEventListener</code>
</InvalidArgument>
</file>
<file src="apps/files_external/lib/Command/Delete.php"> <file src="apps/files_external/lib/Command/Delete.php">
<NullArgument occurrences="1"> <NullArgument occurrences="1">
<code>null</code> <code>null</code>
@ -1318,6 +1390,12 @@
<code>getUniqueStorages</code> <code>getUniqueStorages</code>
</UndefinedMethod> </UndefinedMethod>
</file> </file>
<file src="apps/files_external/lib/Lib/Auth/Password/LoginCredentials.php">
<InvalidArgument occurrences="2">
<code>addServiceListener</code>
<code>addServiceListener</code>
</InvalidArgument>
</file>
<file src="apps/files_external/lib/Lib/Backend/Backend.php"> <file src="apps/files_external/lib/Lib/Backend/Backend.php">
<InvalidReturnType occurrences="1"> <InvalidReturnType occurrences="1">
<code>self</code> <code>self</code>
@ -1506,6 +1584,16 @@
<code>$_</code> <code>$_</code>
</UndefinedVariable> </UndefinedVariable>
</file> </file>
<file src="apps/files_sharing/lib/AppInfo/Application.php">
<InvalidArgument occurrences="6">
<code>addServiceListener</code>
<code>addServiceListener</code>
<code>addServiceListener</code>
<code>addServiceListener</code>
<code>addServiceListener</code>
<code>addServiceListener</code>
</InvalidArgument>
</file>
<file src="apps/files_sharing/lib/Cache.php"> <file src="apps/files_sharing/lib/Cache.php">
<FalsableReturnStatement occurrences="1"> <FalsableReturnStatement occurrences="1">
<code>false</code> <code>false</code>
@ -1525,11 +1613,17 @@
</UndefinedInterfaceMethod> </UndefinedInterfaceMethod>
</file> </file>
<file src="apps/files_sharing/lib/Controller/ShareAPIController.php"> <file src="apps/files_sharing/lib/Controller/ShareAPIController.php">
<InvalidOperand occurrences="1">
<code>$permissions</code>
</InvalidOperand>
<InvalidScalarArgument occurrences="3"> <InvalidScalarArgument occurrences="3">
<code>$code</code> <code>$code</code>
<code>$code</code> <code>$code</code>
<code>Constants::PERMISSION_ALL</code> <code>Constants::PERMISSION_ALL</code>
</InvalidScalarArgument> </InvalidScalarArgument>
<RedundantCondition occurrences="1">
<code>$permissions &amp; Constants::PERMISSION_READ</code>
</RedundantCondition>
<UndefinedClass occurrences="2"> <UndefinedClass occurrences="2">
<code>\OCA\Circles\Api\v1\Circles</code> <code>\OCA\Circles\Api\v1\Circles</code>
<code>\OCA\Circles\Api\v1\Circles</code> <code>\OCA\Circles\Api\v1\Circles</code>
@ -1597,6 +1691,11 @@
<code>$exception-&gt;getMessage()</code> <code>$exception-&gt;getMessage()</code>
</InvalidArgument> </InvalidArgument>
</file> </file>
<file src="apps/files_sharing/lib/MountProvider.php">
<RedundantFunctionCall occurrences="1">
<code>array_values</code>
</RedundantFunctionCall>
</file>
<file src="apps/files_sharing/lib/ShareBackend/File.php"> <file src="apps/files_sharing/lib/ShareBackend/File.php">
<InvalidScalarArgument occurrences="2"> <InvalidScalarArgument occurrences="2">
<code>$itemSource</code> <code>$itemSource</code>
@ -1709,9 +1808,13 @@
</TooManyArguments> </TooManyArguments>
</file> </file>
<file src="apps/files_trashbin/lib/Trash/LegacyTrashBackend.php"> <file src="apps/files_trashbin/lib/Trash/LegacyTrashBackend.php">
<RedundantCondition occurrences="1"> <RedundantCondition occurrences="2">
<code>$trashFiles</code>
<code>$trashFiles</code> <code>$trashFiles</code>
</RedundantCondition> </RedundantCondition>
<TypeDoesNotContainType occurrences="1">
<code>null</code>
</TypeDoesNotContainType>
<UndefinedInterfaceMethod occurrences="2"> <UndefinedInterfaceMethod occurrences="2">
<code>$file</code> <code>$file</code>
<code>getById</code> <code>getById</code>
@ -1735,6 +1838,12 @@
<code>$this</code> <code>$this</code>
</InvalidScope> </InvalidScope>
</file> </file>
<file src="apps/files_versions/lib/AppInfo/Application.php">
<InvalidArgument occurrences="2">
<code>registerEventListener</code>
<code>registerEventListener</code>
</InvalidArgument>
</file>
<file src="apps/files_versions/lib/Sabre/RestoreFolder.php"> <file src="apps/files_versions/lib/Sabre/RestoreFolder.php">
<InvalidNullableReturnType occurrences="1"> <InvalidNullableReturnType occurrences="1">
<code>getChild</code> <code>getChild</code>
@ -1778,6 +1887,11 @@
<file src="apps/oauth2/lib/Db/ClientMapper.php"> <file src="apps/oauth2/lib/Db/ClientMapper.php">
<InvalidCatch occurrences="2"/> <InvalidCatch occurrences="2"/>
</file> </file>
<file src="apps/provisioning_api/lib/AppInfo/Application.php">
<InvalidArgument occurrences="1">
<code>registerEventListener</code>
</InvalidArgument>
</file>
<file src="apps/provisioning_api/lib/Controller/UsersController.php"> <file src="apps/provisioning_api/lib/Controller/UsersController.php">
<InvalidScalarArgument occurrences="1"> <InvalidScalarArgument occurrences="1">
<code>$quota</code> <code>$quota</code>
@ -1788,6 +1902,11 @@
</TypeDoesNotContainNull> </TypeDoesNotContainNull>
</file> </file>
<file src="apps/settings/lib/AppInfo/Application.php"> <file src="apps/settings/lib/AppInfo/Application.php">
<InvalidArgument occurrences="3">
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
</InvalidArgument>
<InvalidScalarArgument occurrences="1"> <InvalidScalarArgument occurrences="1">
<code>\OC_User::getUser()</code> <code>\OC_User::getUser()</code>
</InvalidScalarArgument> </InvalidScalarArgument>
@ -1829,6 +1948,11 @@
<code>isReady</code> <code>isReady</code>
</UndefinedInterfaceMethod> </UndefinedInterfaceMethod>
</file> </file>
<file src="apps/settings/lib/Settings/Admin/Server.php">
<InvalidArgument occurrences="1">
<code>false</code>
</InvalidArgument>
</file>
<file src="apps/settings/lib/Settings/Admin/Sharing.php"> <file src="apps/settings/lib/Settings/Admin/Sharing.php">
<InvalidScalarArgument occurrences="1"> <InvalidScalarArgument occurrences="1">
<code>Constants::PERMISSION_ALL</code> <code>Constants::PERMISSION_ALL</code>
@ -1865,6 +1989,11 @@
<code>$type</code> <code>$type</code>
</InvalidScalarArgument> </InvalidScalarArgument>
</file> </file>
<file src="apps/theming/lib/AppInfo/Application.php">
<InvalidArgument occurrences="1">
<code>registerEventListener</code>
</InvalidArgument>
</file>
<file src="apps/theming/lib/Controller/IconController.php"> <file src="apps/theming/lib/Controller/IconController.php">
<InvalidReturnStatement occurrences="1"> <InvalidReturnStatement occurrences="1">
<code>$response</code> <code>$response</code>
@ -1905,6 +2034,14 @@
<code>$folder !== null</code> <code>$folder !== null</code>
</RedundantCondition> </RedundantCondition>
</file> </file>
<file src="apps/twofactor_backupcodes/lib/AppInfo/Application.php">
<InvalidArgument occurrences="4">
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
</InvalidArgument>
</file>
<file src="apps/twofactor_backupcodes/lib/BackgroundJob/RememberBackupCodesJob.php"> <file src="apps/twofactor_backupcodes/lib/BackgroundJob/RememberBackupCodesJob.php">
<InvalidArgument occurrences="1"> <InvalidArgument occurrences="1">
<code>bool</code> <code>bool</code>
@ -1922,6 +2059,9 @@
</InvalidScalarArgument> </InvalidScalarArgument>
</file> </file>
<file src="apps/updatenotification/lib/Notification/BackgroundJob.php"> <file src="apps/updatenotification/lib/Notification/BackgroundJob.php">
<InvalidArgument occurrences="1">
<code>false</code>
</InvalidArgument>
<InvalidPropertyAssignmentValue occurrences="1"> <InvalidPropertyAssignmentValue occurrences="1">
<code>$this-&gt;users</code> <code>$this-&gt;users</code>
</InvalidPropertyAssignmentValue> </InvalidPropertyAssignmentValue>
@ -2122,7 +2262,6 @@
</InvalidPropertyAssignmentValue> </InvalidPropertyAssignmentValue>
<InvalidReturnType occurrences="1"> <InvalidReturnType occurrences="1">
<code>null</code> <code>null</code>
<code>null</code>
</InvalidReturnType> </InvalidReturnType>
<InvalidScalarArgument occurrences="3"> <InvalidScalarArgument occurrences="3">
<code>$this-&gt;getHomePath($ldapEntry[$attr][0])</code> <code>$this-&gt;getHomePath($ldapEntry[$attr][0])</code>
@ -2181,10 +2320,20 @@
</TypeDoesNotContainType> </TypeDoesNotContainType>
</file> </file>
<file src="apps/user_status/lib/AppInfo/Application.php"> <file src="apps/user_status/lib/AppInfo/Application.php">
<InvalidArgument occurrences="3">
<code>registerEventListener</code>
<code>registerEventListener</code>
<code>registerEventListener</code>
</InvalidArgument>
<UndefinedInterfaceMethod occurrences="1"> <UndefinedInterfaceMethod occurrences="1">
<code>registerProvider</code> <code>registerProvider</code>
</UndefinedInterfaceMethod> </UndefinedInterfaceMethod>
</file> </file>
<file src="apps/workflowengine/lib/AppInfo/Application.php">
<InvalidArgument occurrences="1">
<code>registerEventListener</code>
</InvalidArgument>
</file>
<file src="apps/workflowengine/lib/Check/AbstractStringCheck.php"> <file src="apps/workflowengine/lib/Check/AbstractStringCheck.php">
<NullArgument occurrences="1"> <NullArgument occurrences="1">
<code>null</code> <code>null</code>
@ -2279,6 +2428,19 @@
<code>isUserScopeEnabled</code> <code>isUserScopeEnabled</code>
</UndefinedInterfaceMethod> </UndefinedInterfaceMethod>
</file> </file>
<file src="core/Application.php">
<InvalidArgument occurrences="9">
<code>addServiceListener</code>
<code>addServiceListener</code>
<code>addServiceListener</code>
<code>addServiceListener</code>
<code>addServiceListener</code>
<code>addServiceListener</code>
<code>addServiceListener</code>
<code>addServiceListener</code>
<code>addServiceListener</code>
</InvalidArgument>
</file>
<file src="core/BackgroundJobs/BackgroundCleanupUpdaterBackupsJob.php"> <file src="core/BackgroundJobs/BackgroundCleanupUpdaterBackupsJob.php">
<ParamNameMismatch occurrences="1"> <ParamNameMismatch occurrences="1">
<code>$arguments</code> <code>$arguments</code>
@ -2294,14 +2456,6 @@
<code>$arguments</code> <code>$arguments</code>
</ParamNameMismatch> </ParamNameMismatch>
</file> </file>
<file src="core/Command/App/GetPath.php">
<ImplementedReturnTypeMismatch occurrences="1">
<code>null|int</code>
</ImplementedReturnTypeMismatch>
<MismatchingDocblockReturnType occurrences="1">
<code>null|int</code>
</MismatchingDocblockReturnType>
</file>
<file src="core/Command/App/Install.php"> <file src="core/Command/App/Install.php">
<TypeDoesNotContainType occurrences="1"> <TypeDoesNotContainType occurrences="1">
<code>$result === false</code> <code>$result === false</code>
@ -2312,14 +2466,6 @@
<code>array</code> <code>array</code>
</LessSpecificImplementedReturnType> </LessSpecificImplementedReturnType>
</file> </file>
<file src="core/Command/Config/App/GetConfig.php">
<ImplementedReturnTypeMismatch occurrences="1">
<code>null|int</code>
</ImplementedReturnTypeMismatch>
<MismatchingDocblockReturnType occurrences="1">
<code>null|int</code>
</MismatchingDocblockReturnType>
</file>
<file src="core/Command/Config/Import.php"> <file src="core/Command/Config/Import.php">
<InvalidScalarArgument occurrences="2"> <InvalidScalarArgument occurrences="2">
<code>0</code> <code>0</code>
@ -2334,14 +2480,6 @@
<code>getFilteredValues</code> <code>getFilteredValues</code>
</TooManyArguments> </TooManyArguments>
</file> </file>
<file src="core/Command/Config/System/GetConfig.php">
<ImplementedReturnTypeMismatch occurrences="1">
<code>null|int</code>
</ImplementedReturnTypeMismatch>
<MismatchingDocblockReturnType occurrences="1">
<code>null|int</code>
</MismatchingDocblockReturnType>
</file>
<file src="core/Command/Db/AddMissingColumns.php"> <file src="core/Command/Db/AddMissingColumns.php">
<InvalidArgument occurrences="1"> <InvalidArgument occurrences="1">
<code>IDBConnection::ADD_MISSING_COLUMNS_EVENT</code> <code>IDBConnection::ADD_MISSING_COLUMNS_EVENT</code>
@ -2497,13 +2635,19 @@
<code>$this</code> <code>$this</code>
</InvalidScope> </InvalidScope>
</file> </file>
<file src="core/templates/layout.guest.php">
<InvalidArgument occurrences="1">
<code>false</code>
</InvalidArgument>
</file>
<file src="core/templates/layout.public.php"> <file src="core/templates/layout.public.php">
<UndefinedInterfaceMethod occurrences="1"> <UndefinedInterfaceMethod occurrences="1">
<code>getIcon</code> <code>getIcon</code>
</UndefinedInterfaceMethod> </UndefinedInterfaceMethod>
</file> </file>
<file src="lib/autoloader.php"> <file src="lib/autoloader.php">
<RedundantCondition occurrences="1"> <RedundantCondition occurrences="2">
<code>$this-&gt;memoryCache</code>
<code>$this-&gt;memoryCache</code> <code>$this-&gt;memoryCache</code>
</RedundantCondition> </RedundantCondition>
</file> </file>
@ -2512,8 +2656,10 @@
<code>getAppsNeedingUpgrade</code> <code>getAppsNeedingUpgrade</code>
<code>getIncompatibleApps</code> <code>getIncompatibleApps</code>
</InternalMethod> </InternalMethod>
<InvalidArgument occurrences="1"> <InvalidArgument occurrences="3">
<code>$restrictions</code> <code>$restrictions</code>
<code>addServiceListener</code>
<code>addServiceListener</code>
</InvalidArgument> </InvalidArgument>
<RedundantCondition occurrences="1"> <RedundantCondition occurrences="1">
<code>((array)$request-&gt;getParam('appid')) !== ''</code> <code>((array)$request-&gt;getParam('appid')) !== ''</code>
@ -3337,7 +3483,8 @@
<NullableReturnStatement occurrences="1"> <NullableReturnStatement occurrences="1">
<code>null</code> <code>null</code>
</NullableReturnStatement> </NullableReturnStatement>
<RedundantCondition occurrences="1"> <RedundantCondition occurrences="2">
<code>$userObject</code>
<code>$userObject</code> <code>$userObject</code>
</RedundantCondition> </RedundantCondition>
<TooManyArguments occurrences="1"> <TooManyArguments occurrences="1">
@ -3523,6 +3670,9 @@
</MoreSpecificImplementedParamType> </MoreSpecificImplementedParamType>
</file> </file>
<file src="lib/private/Files/ObjectStore/ObjectStoreStorage.php"> <file src="lib/private/Files/ObjectStore/ObjectStoreStorage.php">
<InvalidScalarArgument occurrences="1">
<code>$source</code>
</InvalidScalarArgument>
<ParamNameMismatch occurrences="2"> <ParamNameMismatch occurrences="2">
<code>$source</code> <code>$source</code>
<code>$target</code> <code>$target</code>
@ -3726,6 +3876,11 @@
</InvalidReturnType> </InvalidReturnType>
</file> </file>
<file src="lib/private/Files/Storage/Wrapper/Encoding.php"> <file src="lib/private/Files/Storage/Wrapper/Encoding.php">
<InvalidScalarArgument occurrences="3">
<code>\Normalizer::FORM_C</code>
<code>\Normalizer::FORM_C</code>
<code>\Normalizer::FORM_D</code>
</InvalidScalarArgument>
<UndefinedInterfaceMethod occurrences="13"> <UndefinedInterfaceMethod occurrences="13">
<code>$this-&gt;namesCache</code> <code>$this-&gt;namesCache</code>
<code>$this-&gt;namesCache</code> <code>$this-&gt;namesCache</code>
@ -3816,6 +3971,11 @@
<code>stream_flush</code> <code>stream_flush</code>
</InvalidReturnType> </InvalidReturnType>
</file> </file>
<file src="lib/private/Files/Template/TemplateManager.php">
<RedundantCondition occurrences="1">
<code>!$isDefaultTemplates</code>
</RedundantCondition>
</file>
<file src="lib/private/Files/Type/Detection.php"> <file src="lib/private/Files/Type/Detection.php">
<ParamNameMismatch occurrences="1"> <ParamNameMismatch occurrences="1">
<code>$mimetype</code> <code>$mimetype</code>
@ -3865,9 +4025,11 @@
<code>null</code> <code>null</code>
<code>null</code> <code>null</code>
</NullableReturnStatement> </NullableReturnStatement>
<RedundantCondition occurrences="3"> <RedundantCondition occurrences="5">
<code>$data</code> <code>$result</code>
<code>$result &amp;&amp; in_array('delete', $hooks) and $result</code> <code>$result &amp;&amp; in_array('delete', $hooks) and $result</code>
<code>Constants::PERMISSION_READ</code>
<code>Constants::PERMISSION_READ</code>
<code>is_resource($source)</code> <code>is_resource($source)</code>
</RedundantCondition> </RedundantCondition>
<UndefinedDocblockClass occurrences="2"> <UndefinedDocblockClass occurrences="2">
@ -3906,7 +4068,10 @@
<MoreSpecificImplementedParamType occurrences="1"> <MoreSpecificImplementedParamType occurrences="1">
<code>$user</code> <code>$user</code>
</MoreSpecificImplementedParamType> </MoreSpecificImplementedParamType>
<RedundantCondition occurrences="3"> <RedundantCondition occurrences="6">
<code>$this-&gt;emitter</code>
<code>$this-&gt;emitter</code>
<code>$this-&gt;emitter</code>
<code>$this-&gt;emitter</code> <code>$this-&gt;emitter</code>
<code>$this-&gt;emitter</code> <code>$this-&gt;emitter</code>
<code>$this-&gt;emitter</code> <code>$this-&gt;emitter</code>
@ -3949,6 +4114,10 @@
<FalsableReturnStatement occurrences="1"> <FalsableReturnStatement occurrences="1">
<code>false</code> <code>false</code>
</FalsableReturnStatement> </FalsableReturnStatement>
<InvalidArgument occurrences="2">
<code>false</code>
<code>false</code>
</InvalidArgument>
<InvalidArrayOffset occurrences="2"> <InvalidArrayOffset occurrences="2">
<code>$app['path']</code> <code>$app['path']</code>
<code>$app['path']</code> <code>$app['path']</code>
@ -3956,9 +4125,6 @@
<NullArgument occurrences="1"> <NullArgument occurrences="1">
<code>null</code> <code>null</code>
</NullArgument> </NullArgument>
<RedundantCondition occurrences="1">
<code>$archive</code>
</RedundantCondition>
</file> </file>
<file src="lib/private/IntegrityCheck/Checker.php"> <file src="lib/private/IntegrityCheck/Checker.php">
<InvalidArrayAccess occurrences="3"> <InvalidArrayAccess occurrences="3">
@ -4030,7 +4196,8 @@
</InvalidPropertyAssignmentValue> </InvalidPropertyAssignmentValue>
</file> </file>
<file src="lib/private/Log.php"> <file src="lib/private/Log.php">
<RedundantCondition occurrences="1"> <RedundantCondition occurrences="2">
<code>$request</code>
<code>$request</code> <code>$request</code>
</RedundantCondition> </RedundantCondition>
</file> </file>
@ -4203,6 +4370,11 @@
<code>dispatch</code> <code>dispatch</code>
</TooManyArguments> </TooManyArguments>
</file> </file>
<file src="lib/private/Repair/Owncloud/CleanPreviews.php">
<InvalidArgument occurrences="1">
<code>false</code>
</InvalidArgument>
</file>
<file src="lib/private/Repair/Owncloud/CleanPreviewsBackgroundJob.php"> <file src="lib/private/Repair/Owncloud/CleanPreviewsBackgroundJob.php">
<ParamNameMismatch occurrences="1"> <ParamNameMismatch occurrences="1">
<code>$arguments</code> <code>$arguments</code>
@ -4212,6 +4384,9 @@
<ParamNameMismatch occurrences="1"> <ParamNameMismatch occurrences="1">
<code>$arguments</code> <code>$arguments</code>
</ParamNameMismatch> </ParamNameMismatch>
<TypeDoesNotContainType occurrences="1">
<code>$counter % 100 === 0</code>
</TypeDoesNotContainType>
</file> </file>
<file src="lib/private/Repair/RemoveLinkShares.php"> <file src="lib/private/Repair/RemoveLinkShares.php">
<ImplicitToStringCast occurrences="2"> <ImplicitToStringCast occurrences="2">
@ -4512,6 +4687,14 @@
<code>dispatch</code> <code>dispatch</code>
</TooManyArguments> </TooManyArguments>
</file> </file>
<file src="lib/private/TagManager.php">
<InvalidNullableReturnType occurrences="1">
<code>\OCP\ITags</code>
</InvalidNullableReturnType>
<NullableReturnStatement occurrences="1">
<code>null</code>
</NullableReturnStatement>
</file>
<file src="lib/private/Tags.php"> <file src="lib/private/Tags.php">
<InvalidArgument occurrences="1"> <InvalidArgument occurrences="1">
<code>[$this-&gt;user, $this-&gt;type, $chunk]</code> <code>[$this-&gt;user, $this-&gt;type, $chunk]</code>
@ -4543,6 +4726,9 @@
</NullArgument> </NullArgument>
</file> </file>
<file src="lib/private/Template/JSResourceLocator.php"> <file src="lib/private/Template/JSResourceLocator.php">
<InvalidArgument occurrences="1">
<code>false</code>
</InvalidArgument>
<InvalidOperand occurrences="6"> <InvalidOperand occurrences="6">
<code>$this-&gt;appendIfExist($this-&gt;serverroot, $script.'.js')</code> <code>$this-&gt;appendIfExist($this-&gt;serverroot, $script.'.js')</code>
<code>$this-&gt;appendIfExist($this-&gt;serverroot, $theme_dir.$script.'.js')</code> <code>$this-&gt;appendIfExist($this-&gt;serverroot, $theme_dir.$script.'.js')</code>
@ -4610,6 +4796,9 @@
<ImplementedReturnTypeMismatch occurrences="1"> <ImplementedReturnTypeMismatch occurrences="1">
<code>array|int</code> <code>array|int</code>
</ImplementedReturnTypeMismatch> </ImplementedReturnTypeMismatch>
<InvalidArgument occurrences="1">
<code>$callback</code>
</InvalidArgument>
<InvalidNullableReturnType occurrences="1"> <InvalidNullableReturnType occurrences="1">
<code>bool|IUser</code> <code>bool|IUser</code>
</InvalidNullableReturnType> </InvalidNullableReturnType>

74
build/stubs/ftp.php Normal file
View File

@ -0,0 +1,74 @@
<?php
/** @generate-class-entries */
namespace FTP {
/**
* @strict-properties
* @not-serializable
*/
final class Connection
{
}
}
namespace {
function ftp_connect(string $hostname, int $port = 21, int $timeout = 90): FTP\Connection|resource|false {}
#ifdef HAVE_FTP_SSL
function ftp_ssl_connect(string $hostname, int $port = 21, int $timeout = 90): FTP\Connection|resource|false {}
#endif
function ftp_login(FTP\Connection|resource $ftp, string $username, string $password): bool {}
function ftp_pwd(FTP\Connection|resource $ftp): string|false {}
function ftp_cdup(FTP\Connection|resource $ftp): bool {}
function ftp_chdir(FTP\Connection|resource $ftp, string $directory): bool {}
function ftp_exec(FTP\Connection|resource $ftp, string $command): bool {}
function ftp_raw(FTP\Connection|resource $ftp, string $command): ?array {}
function ftp_mkdir(FTP\Connection|resource $ftp, string $directory): string|false {}
function ftp_rmdir(FTP\Connection|resource $ftp, string $directory): bool {}
function ftp_chmod(FTP\Connection|resource $ftp, int $permissions, string $filename): int|false {}
/** @param string $response */
function ftp_alloc(FTP\Connection|resource $ftp, int $size, &$response = null): bool {}
function ftp_nlist(FTP\Connection|resource $ftp, string $directory): array|false {}
function ftp_rawlist(FTP\Connection|resource $ftp, string $directory, bool $recursive = false): array|false {}
function ftp_mlsd(FTP\Connection|resource $ftp, string $directory): array|false {}
function ftp_systype(FTP\Connection|resource $ftp): string|false {}
/** @param resource $stream */
function ftp_fget(FTP\Connection|resource $ftp, $stream, string $remote_filename, int $mode = FTP_BINARY, int $offset = 0): bool {}
/** @param resource $stream */
function ftp_nb_fget(FTP\Connection|resource $ftp, $stream, string $remote_filename, int $mode = FTP_BINARY, int $offset = 0): int {}
function ftp_pasv(FTP\Connection|resource $ftp, bool $enable): bool {}
function ftp_get(FTP\Connection|resource $ftp, string $local_filename, string $remote_filename, int $mode = FTP_BINARY, int $offset = 0): bool {}
function ftp_nb_get(FTP\Connection|resource $ftp, string $local_filename, string $remote_filename, int $mode = FTP_BINARY, int $offset = 0): int {}
function ftp_nb_continue(FTP\Connection|resource $ftp): int {}
/** @param resource $stream */
function ftp_fput(FTP\Connection|resource $ftp, string $remote_filename, $stream, int $mode = FTP_BINARY, int $offset = 0): bool {}
/** @param resource $stream */
function ftp_nb_fput(FTP\Connection|resource $ftp, string $remote_filename, $stream, int $mode = FTP_BINARY, int $offset = 0): int {}
function ftp_put(FTP\Connection|resource $ftp, string $remote_filename, string $local_filename, int $mode = FTP_BINARY, int $offset = 0): bool {}
function ftp_append(FTP\Connection|resource $ftp, string $remote_filename, string $local_filename, int $mode = FTP_BINARY): bool {}
function ftp_nb_put(FTP\Connection|resource $ftp, string $remote_filename, string $local_filename, int $mode = FTP_BINARY, int $offset = 0): int|false {}
function ftp_size(FTP\Connection|resource $ftp, string $filename): int {}
function ftp_mdtm(FTP\Connection|resource $ftp, string $filename): int {}
function ftp_rename(FTP\Connection|resource $ftp, string $from, string $to): bool {}
function ftp_delete(FTP\Connection|resource $ftp, string $filename): bool {}
function ftp_site(FTP\Connection|resource $ftp, string $command): bool {}
function ftp_close(FTP\Connection|resource $ftp): bool {}
/** @alias ftp_close */
function ftp_quit(FTP\Connection|resource $ftp): bool {}
/** @param int|bool $value */
function ftp_set_option(FTP\Connection|resource $ftp, int $option, $value): bool {}
function ftp_get_option(FTP\Connection|resource $ftp, int $option): int|bool {}
}

View File

@ -1,5 +1,11 @@
<?php <?php
/**
* @strict-properties
* @not-serializable
*/
final class GdImage {}
/** /**
* Retrieve information about the currently installed GD library * Retrieve information about the currently installed GD library
* @link https://php.net/manual/en/function.gd-info.php * @link https://php.net/manual/en/function.gd-info.php

File diff suppressed because it is too large Load Diff

50
build/stubs/pcntl.php Normal file
View File

@ -0,0 +1,50 @@
<?php
// Licensed under Apache-2.0
// Copied from https://github.com/JetBrains/phpstorm-stubs/blob/master/pcntl/pcntl.php
define('WNOHANG', 1);
define('WUNTRACED', 2);
define('WCONTINUED', 8);
define('SIG_IGN', 1);
define('SIG_DFL', 0);
define('SIG_ERR', -1);
define('SIGHUP', 1);
define('SIGINT', 2);
define('SIGQUIT', 3);
define('SIGILL', 4);
define('SIGTRAP', 5);
define('SIGABRT', 6);
define('SIGIOT', 6);
define('SIGBUS', 7);
define('SIGFPE', 8);
define('SIGKILL', 9);
define('SIGUSR1', 10);
define('SIGSEGV', 11);
define('SIGUSR2', 12);
define('SIGPIPE', 13);
define('SIGALRM', 14);
define('SIGTERM', 15);
define('SIGSTKFLT', 16);
define('SIGCLD', 17);
define('SIGCHLD', 17);
define('SIGCONT', 18);
define('SIGSTOP', 19);
define('SIGTSTP', 20);
define('SIGTTIN', 21);
define('SIGTTOU', 22);
define('SIGURG', 23);
define('SIGXCPU', 24);
define('SIGXFSZ', 25);
define('SIGVTALRM', 26);
define('SIGPROF', 27);
define('SIGWINCH', 28);
define('SIGPOLL', 29);
define('SIGIO', 29);
define('SIGPWR', 30);
define('SIGSYS', 31);
define('SIGBABY', 31);
define('PRIO_PGRP', 1);
define('PRIO_USER', 2);
define('PRIO_PROCESS', 0);

View File

@ -42,7 +42,7 @@
"cs:fix": "php-cs-fixer fix", "cs:fix": "php-cs-fixer fix",
"cs:check": "php-cs-fixer fix --dry-run --diff", "cs:check": "php-cs-fixer fix --dry-run --diff",
"lint": "find . -name \\*.php -not -path './lib/composer/*' -not -path './build/stubs/*' -print0 | xargs -0 -n1 php -l", "lint": "find . -name \\*.php -not -path './lib/composer/*' -not -path './build/stubs/*' -print0 | xargs -0 -n1 php -l",
"psalm": "psalm", "psalm": "psalm --threads=1",
"psalm:update-baseline": "psalm --update-baseline --set-baseline=build/psalm-baseline.xml" "psalm:update-baseline": "psalm --threads=1 --update-baseline --set-baseline=build/psalm-baseline.xml"
} }
} }

View File

@ -48,7 +48,7 @@ class GetPath extends Base {
* *
* @param InputInterface $input An InputInterface instance * @param InputInterface $input An InputInterface instance
* @param OutputInterface $output An OutputInterface instance * @param OutputInterface $output An OutputInterface instance
* @return null|int null or 0 if everything went fine, or an error code * @return int 0 if everything went fine, or an error code
*/ */
protected function execute(InputInterface $input, OutputInterface $output): int { protected function execute(InputInterface $input, OutputInterface $output): int {
$appName = $input->getArgument('app'); $appName = $input->getArgument('app');

View File

@ -69,7 +69,7 @@ class GetConfig extends Base {
* *
* @param InputInterface $input An InputInterface instance * @param InputInterface $input An InputInterface instance
* @param OutputInterface $output An OutputInterface instance * @param OutputInterface $output An OutputInterface instance
* @return null|int null or 0 if everything went fine, or an error code * @return int 0 if everything went fine, or an error code
*/ */
protected function execute(InputInterface $input, OutputInterface $output): int { protected function execute(InputInterface $input, OutputInterface $output): int {
$appName = $input->getArgument('app'); $appName = $input->getArgument('app');

View File

@ -65,9 +65,9 @@ class GetConfig extends Base {
* *
* @param InputInterface $input An InputInterface instance * @param InputInterface $input An InputInterface instance
* @param OutputInterface $output An OutputInterface instance * @param OutputInterface $output An OutputInterface instance
* @return null|int null or 0 if everything went fine, or an error code * @return int 0 if everything went fine, or an error code
*/ */
protected function execute(InputInterface $input, OutputInterface $output): int { protected function execute(InputInterface $input, OutputInterface $output) {
$configNames = $input->getArgument('name'); $configNames = $input->getArgument('name');
$configName = array_shift($configNames); $configName = array_shift($configNames);
$defaultValue = $input->getOption('default-value'); $defaultValue = $input->getOption('default-value');

View File

@ -5,7 +5,7 @@
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../../../', 'install_path' => __DIR__ . '/../../../',
'aliases' => array(), 'aliases' => array(),
'reference' => '63a9bc2aacf829563ac74abe29d4edf6ff31b8b1', 'reference' => '1225189f74d06606aafc4150d07584b90cea50dd',
'name' => '__root__', 'name' => '__root__',
'dev' => false, 'dev' => false,
), ),
@ -16,7 +16,7 @@
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../../../', 'install_path' => __DIR__ . '/../../../',
'aliases' => array(), 'aliases' => array(),
'reference' => '63a9bc2aacf829563ac74abe29d4edf6ff31b8b1', 'reference' => '1225189f74d06606aafc4150d07584b90cea50dd',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
), ),

View File

@ -131,7 +131,7 @@ class Manager implements IManager {
*/ */
public function searchCollections(IUser $user, string $filter, int $limit = 50, int $start = 0): array { public function searchCollections(IUser $user, string $filter, int $limit = 50, int $start = 0): array {
$query = $this->connection->getQueryBuilder(); $query = $this->connection->getQueryBuilder();
$userId = $user instanceof IUser ? $user->getUID() : ''; $userId = $user->getUID();
$query->select('c.*', 'a.access') $query->select('c.*', 'a.access')
->from(self::TABLE_COLLECTIONS, 'c') ->from(self::TABLE_COLLECTIONS, 'c')

View File

@ -1407,7 +1407,7 @@ class View {
} }
$info = new FileInfo($path, $storage, $internalPath, $data, $mount, $owner); $info = new FileInfo($path, $storage, $internalPath, $data, $mount, $owner);
if ($data and isset($data['fileid'])) { if (isset($data['fileid'])) {
if ($includeMountPoints and $data['mimetype'] === 'httpd/unix-directory') { if ($includeMountPoints and $data['mimetype'] === 'httpd/unix-directory') {
//add the sizes of other mount points to the folder //add the sizes of other mount points to the folder
$extOnly = ($includeMountPoints === 'ext'); $extOnly = ($includeMountPoints === 'ext');

View File

@ -308,91 +308,80 @@ class Installer {
$extractDir = $this->tempManager->getTemporaryFolder(); $extractDir = $this->tempManager->getTemporaryFolder();
$archive = new TAR($tempFile); $archive = new TAR($tempFile);
if ($archive) { if (!$archive->extract($extractDir)) {
if (!$archive->extract($extractDir)) { $errorMessage = 'Could not extract app ' . $appId;
$errorMessage = 'Could not extract app ' . $appId;
$archiveError = $archive->getError(); $archiveError = $archive->getError();
if ($archiveError instanceof \PEAR_Error) { if ($archiveError instanceof \PEAR_Error) {
$errorMessage .= ': ' . $archiveError->getMessage(); $errorMessage .= ': ' . $archiveError->getMessage();
}
throw new \Exception($errorMessage);
}
$allFiles = scandir($extractDir);
$folders = array_diff($allFiles, ['.', '..']);
$folders = array_values($folders);
if (count($folders) > 1) {
throw new \Exception(
sprintf(
'Extracted app %s has more than 1 folder',
$appId
)
);
} }
// Check if appinfo/info.xml has the same app ID as well throw new \Exception($errorMessage);
if ((PHP_VERSION_ID < 80000)) { }
$loadEntities = libxml_disable_entity_loader(false); $allFiles = scandir($extractDir);
$xml = simplexml_load_file($extractDir . '/' . $folders[0] . '/appinfo/info.xml'); $folders = array_diff($allFiles, ['.', '..']);
libxml_disable_entity_loader($loadEntities); $folders = array_values($folders);
} else {
$xml = simplexml_load_file($extractDir . '/' . $folders[0] . '/appinfo/info.xml');
}
if ((string)$xml->id !== $appId) {
throw new \Exception(
sprintf(
'App for id %s has a wrong app ID in info.xml: %s',
$appId,
(string)$xml->id
)
);
}
// Check if the version is lower than before if (count($folders) > 1) {
$currentVersion = OC_App::getAppVersion($appId);
$newVersion = (string)$xml->version;
if (version_compare($currentVersion, $newVersion) === 1) {
throw new \Exception(
sprintf(
'App for id %s has version %s and tried to update to lower version %s',
$appId,
$currentVersion,
$newVersion
)
);
}
$baseDir = OC_App::getInstallPath() . '/' . $appId;
// Remove old app with the ID if existent
OC_Helper::rmdirr($baseDir);
// Move to app folder
if (@mkdir($baseDir)) {
$extractDir .= '/' . $folders[0];
OC_Helper::copyr($extractDir, $baseDir);
}
OC_Helper::copyr($extractDir, $baseDir);
OC_Helper::rmdirr($extractDir);
return;
} else {
throw new \Exception( throw new \Exception(
sprintf( sprintf(
'Could not extract app with ID %s to %s', 'Extracted app %s has more than 1 folder',
$appId, $appId
$extractDir
) )
); );
} }
} else {
// Signature does not match // Check if appinfo/info.xml has the same app ID as well
throw new \Exception( if ((PHP_VERSION_ID < 80000)) {
sprintf( $loadEntities = libxml_disable_entity_loader(false);
'App with id %s has invalid signature', $xml = simplexml_load_file($extractDir . '/' . $folders[0] . '/appinfo/info.xml');
$appId libxml_disable_entity_loader($loadEntities);
) } else {
); $xml = simplexml_load_file($extractDir . '/' . $folders[0] . '/appinfo/info.xml');
}
if ((string)$xml->id !== $appId) {
throw new \Exception(
sprintf(
'App for id %s has a wrong app ID in info.xml: %s',
$appId,
(string)$xml->id
)
);
}
// Check if the version is lower than before
$currentVersion = OC_App::getAppVersion($appId);
$newVersion = (string)$xml->version;
if (version_compare($currentVersion, $newVersion) === 1) {
throw new \Exception(
sprintf(
'App for id %s has version %s and tried to update to lower version %s',
$appId,
$currentVersion,
$newVersion
)
);
}
$baseDir = OC_App::getInstallPath() . '/' . $appId;
// Remove old app with the ID if existent
OC_Helper::rmdirr($baseDir);
// Move to app folder
if (@mkdir($baseDir)) {
$extractDir .= '/' . $folders[0];
OC_Helper::copyr($extractDir, $baseDir);
}
OC_Helper::copyr($extractDir, $baseDir);
OC_Helper::rmdirr($extractDir);
return;
} }
// Signature does not match
throw new \Exception(
sprintf(
'App with id %s has invalid signature',
$appId
)
);
} }
} }

View File

@ -66,6 +66,7 @@ class Memcached extends Cache implements IMemcache {
//\Memcached::OPT_BINARY_PROTOCOL => true, //\Memcached::OPT_BINARY_PROTOCOL => true,
]; ];
// by default enable igbinary serializer if available // by default enable igbinary serializer if available
/** @psalm-suppress RedundantCondition */
if (\Memcached::HAVE_IGBINARY) { if (\Memcached::HAVE_IGBINARY) {
$defaultOptions[\Memcached::OPT_SERIALIZER] = $defaultOptions[\Memcached::OPT_SERIALIZER] =
\Memcached::SERIALIZER_IGBINARY; \Memcached::SERIALIZER_IGBINARY;

View File

@ -381,12 +381,12 @@ class Manager implements IManager {
throw new \InvalidArgumentException('The given notification has been processed'); throw new \InvalidArgumentException('The given notification has been processed');
} }
if (!($notification instanceof INotification) || !$notification->isValidParsed()) { if (!$notification->isValidParsed()) {
throw new \InvalidArgumentException('The given notification has not been handled'); throw new \InvalidArgumentException('The given notification has not been handled');
} }
} }
if (!($notification instanceof INotification) || !$notification->isValidParsed()) { if (!$notification->isValidParsed()) {
throw new \InvalidArgumentException('The given notification has not been handled'); throw new \InvalidArgumentException('The given notification has not been handled');
} }

View File

@ -16,6 +16,10 @@
<directory name="lib/composer/bin"/> <directory name="lib/composer/bin"/>
</ignoreFiles> </ignoreFiles>
</projectFiles> </projectFiles>
<stubs>
<file name="build/stubs/gd.php"/>
<file name="build/stubs/ldap.php"/>
</stubs>
<extraFiles> <extraFiles>
<directory name="3rdparty"/> <directory name="3rdparty"/>
</extraFiles> </extraFiles>

View File

@ -75,14 +75,14 @@
<file name="build/stubs/sftp.php"/> <file name="build/stubs/sftp.php"/>
<file name="build/stubs/ssh2.php"/> <file name="build/stubs/ssh2.php"/>
<file name="build/stubs/xsl.php"/> <file name="build/stubs/xsl.php"/>
<file name="build/stubs/ftp.php"/>
<file name="build/stubs/pcntl.php"/>
</stubs> </stubs>
<issueHandlers> <issueHandlers>
<UndefinedClass> <UndefinedClass>
<errorLevel type="suppress"> <errorLevel type="suppress">
<referencedClass name="OCA\GroupFolders\Mount\GroupFolderStorage"/> <referencedClass name="OCA\GroupFolders\Mount\GroupFolderStorage"/>
<referencedClass name="OCA\TwoFactorNextcloudNotification\Controller\APIController"/> <referencedClass name="OCA\TwoFactorNextcloudNotification\Controller\APIController"/>
<!-- Classes from PHP>=8 (needed to be able to use \GdImage::class) -->
<referencedClass name="GdImage" />
</errorLevel> </errorLevel>
</UndefinedClass> </UndefinedClass>
<UndefinedFunction> <UndefinedFunction>
@ -126,11 +126,6 @@
<!-- Helper classes for sharing API integration from other apps --> <!-- Helper classes for sharing API integration from other apps -->
<referencedClass name="OCA\Deck\Sharing\ShareAPIHelper" /> <referencedClass name="OCA\Deck\Sharing\ShareAPIHelper" />
<referencedClass name="OCA\Talk\Share\Helper\DeletedShareAPIController" /> <referencedClass name="OCA\Talk\Share\Helper\DeletedShareAPIController" />
<!-- Classes from PHP>=8 -->
<referencedClass name="GdImage" />
<referencedClass name="LDAP\Connection" />
<referencedClass name="LDAP\Result" />
<referencedClass name="LDAP\ResultEntry" />
</errorLevel> </errorLevel>
</UndefinedDocblockClass> </UndefinedDocblockClass>
</issueHandlers> </issueHandlers>

View File

@ -1,9 +1,11 @@
{ {
"require": { "require": {
"nikic/php-parser": "^4.13", "vimeo/psalm": "^4.18"
"vimeo/psalm": "^4.17"
}, },
"config": { "config": {
"platform": {
"php": "7.3"
},
"allow-plugins": { "allow-plugins": {
"composer/package-versions-deprecated": true "composer/package-versions-deprecated": true
} }

View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "a27ae1441b036754d39358d5dde4905b", "content-hash": "c3c578c654631288a179470ece96f0ba",
"packages": [ "packages": [
{ {
"name": "amphp/amp", "name": "amphp/amp",
@ -923,20 +923,20 @@
}, },
{ {
"name": "psr/container", "name": "psr/container",
"version": "1.1.2", "version": "1.1.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/php-fig/container.git", "url": "https://github.com/php-fig/container.git",
"reference": "513e0666f7216c7459170d56df27dfcefe1689ea" "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea", "url": "https://api.github.com/repos/php-fig/container/zipball/8622567409010282b7aeebe4bb841fe98b58dcaf",
"reference": "513e0666f7216c7459170d56df27dfcefe1689ea", "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=7.4.0" "php": ">=7.2.0"
}, },
"type": "library", "type": "library",
"autoload": { "autoload": {
@ -965,9 +965,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/php-fig/container/issues", "issues": "https://github.com/php-fig/container/issues",
"source": "https://github.com/php-fig/container/tree/1.1.2" "source": "https://github.com/php-fig/container/tree/1.1.1"
}, },
"time": "2021-11-05T16:50:12+00:00" "time": "2021-03-05T17:36:06+00:00"
}, },
{ {
"name": "psr/log", "name": "psr/log",
@ -1914,16 +1914,16 @@
}, },
{ {
"name": "vimeo/psalm", "name": "vimeo/psalm",
"version": "4.17.0", "version": "4.18.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/vimeo/psalm.git", "url": "https://github.com/vimeo/psalm.git",
"reference": "6f4707aa41c9174353a6434bba3fc8840f981d9c" "reference": "dda05fa913f4dc6eb3386f2f7ce5a45d37a71bcb"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/vimeo/psalm/zipball/6f4707aa41c9174353a6434bba3fc8840f981d9c", "url": "https://api.github.com/repos/vimeo/psalm/zipball/dda05fa913f4dc6eb3386f2f7ce5a45d37a71bcb",
"reference": "6f4707aa41c9174353a6434bba3fc8840f981d9c", "reference": "dda05fa913f4dc6eb3386f2f7ce5a45d37a71bcb",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2014,9 +2014,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/vimeo/psalm/issues", "issues": "https://github.com/vimeo/psalm/issues",
"source": "https://github.com/vimeo/psalm/tree/4.17.0" "source": "https://github.com/vimeo/psalm/tree/4.18.1"
}, },
"time": "2022-01-01T18:39:47+00:00" "time": "2022-01-08T21:21:26+00:00"
}, },
{ {
"name": "webmozart/assert", "name": "webmozart/assert",
@ -2136,5 +2136,8 @@
"prefer-lowest": false, "prefer-lowest": false,
"platform": [], "platform": [],
"platform-dev": [], "platform-dev": [],
"platform-overrides": {
"php": "7.3"
},
"plugin-api-version": "2.2.0" "plugin-api-version": "2.2.0"
} }