aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorVincent Petry <vincent@nextcloud.com>2021-11-23 15:41:20 +0100
committerGitHub <noreply@github.com>2021-11-23 15:41:20 +0100
commitfd487c1a43874bf7eaeebe2ff822e18978b6d1e1 (patch)
treea69c74aa76577beac40700eaf47d28b5e8bd1af9 /lib
parent20dd46fcaed56b7df151fe1a5273cdadc22a583e (diff)
parent18a91f02fadf108bfa1a60f258ebacd2f802224b (diff)
downloadnextcloud-server-fd487c1a43874bf7eaeebe2ff822e18978b6d1e1.tar.gz
nextcloud-server-fd487c1a43874bf7eaeebe2ff822e18978b6d1e1.zip
Merge pull request #29432 from nextcloud/fix/support-php-8.1
Support PHP 8.1 - First batch
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Accounts/Account.php3
-rw-r--r--lib/private/Accounts/AccountProperty.php2
-rw-r--r--lib/private/Accounts/AccountPropertyCollection.php2
-rw-r--r--lib/private/AppFramework/Http/Request.php5
-rw-r--r--lib/private/AppFramework/Utility/SimpleContainer.php8
-rw-r--r--lib/private/Authentication/Token/DefaultToken.php2
-rw-r--r--lib/private/Authentication/Token/PublicKeyToken.php2
-rw-r--r--lib/private/Cache/CappedMemoryCache.php10
-rw-r--r--lib/private/Collaboration/Collaborators/UserPlugin.php2
-rw-r--r--lib/private/Contacts/ContactsMenu/Actions/LinkAction.php5
-rw-r--r--lib/private/DB/QueryBuilder/ExpressionBuilder/ExpressionBuilder.php4
-rw-r--r--lib/private/EventDispatcher/GenericEventWrapper.php14
-rw-r--r--lib/private/Files/Cache/CacheEntry.php10
-rw-r--r--lib/private/Files/FileInfo.php10
-rw-r--r--lib/private/Files/ObjectStore/S3Signature.php4
-rw-r--r--lib/private/Files/ObjectStore/Swift.php6
-rw-r--r--lib/private/FullTextSearch/Model/IndexDocument.php4
-rw-r--r--lib/private/FullTextSearch/Model/SearchRequestSimpleQuery.php3
-rw-r--r--lib/private/IntegrityCheck/Iterator/ExcludeFileByNameFilterIterator.php5
-rw-r--r--lib/private/IntegrityCheck/Iterator/ExcludeFoldersByPathFilterIterator.php5
-rw-r--r--lib/private/L10N/L10NString.php6
-rw-r--r--lib/private/L10N/LanguageIterator.php4
-rw-r--r--lib/private/Log/LogDetails.php2
-rw-r--r--lib/private/Memcache/Cache.php10
-rw-r--r--lib/private/Session/CryptoSessionData.php5
-rw-r--r--lib/private/Session/Session.php5
-rw-r--r--lib/private/Setup.php2
-rw-r--r--lib/private/Share20/DefaultShareProvider.php2
-rw-r--r--lib/private/User/Database.php9
-rw-r--r--lib/public/AppFramework/Services/InitialStateProvider.php2
-rw-r--r--lib/public/DB/QueryBuilder/IExpressionBuilder.php4
-rw-r--r--lib/public/Dashboard/Model/WidgetSetting.php4
-rw-r--r--lib/public/Dashboard/Model/WidgetSetup.php4
-rw-r--r--lib/public/Dashboard/Model/WidgetTemplate.php4
-rw-r--r--lib/public/DirectEditing/ATemplate.php3
-rw-r--r--lib/public/EventDispatcher/GenericEvent.php2
-rw-r--r--lib/public/Files/Template/Template.php2
-rw-r--r--lib/public/Files/Template/TemplateFileCreator.php2
-rw-r--r--lib/public/L10N/ILanguageIterator.php2
39 files changed, 95 insertions, 85 deletions
diff --git a/lib/private/Accounts/Account.php b/lib/private/Accounts/Account.php
index 1e4189f2b35..540d15cd4b9 100644
--- a/lib/private/Accounts/Account.php
+++ b/lib/private/Accounts/Account.php
@@ -104,7 +104,8 @@ class Account implements IAccount {
return $result;
}
- public function jsonSerialize() {
+ /** @return IAccountPropertyCollection[]|IAccountProperty[] */
+ public function jsonSerialize(): array {
return $this->properties;
}
diff --git a/lib/private/Accounts/AccountProperty.php b/lib/private/Accounts/AccountProperty.php
index 0e6356e9e92..4b7f2b0c04c 100644
--- a/lib/private/Accounts/AccountProperty.php
+++ b/lib/private/Accounts/AccountProperty.php
@@ -54,7 +54,7 @@ class AccountProperty implements IAccountProperty {
$this->verificationData = $verificationData;
}
- public function jsonSerialize() {
+ public function jsonSerialize(): array {
return [
'name' => $this->getName(),
'value' => $this->getValue(),
diff --git a/lib/private/Accounts/AccountPropertyCollection.php b/lib/private/Accounts/AccountPropertyCollection.php
index 3aed76d8746..091c5734218 100644
--- a/lib/private/Accounts/AccountPropertyCollection.php
+++ b/lib/private/Accounts/AccountPropertyCollection.php
@@ -102,7 +102,7 @@ class AccountPropertyCollection implements IAccountPropertyCollection {
return $this;
}
- public function jsonSerialize() {
+ public function jsonSerialize(): array {
return [$this->collectionName => $this->properties];
}
diff --git a/lib/private/AppFramework/Http/Request.php b/lib/private/AppFramework/Http/Request.php
index a95fd208155..c67500bcaa4 100644
--- a/lib/private/AppFramework/Http/Request.php
+++ b/lib/private/AppFramework/Http/Request.php
@@ -199,6 +199,7 @@ class Request implements \ArrayAccess, \Countable, IRequest {
* @param string $offset
* @return mixed
*/
+ #[\ReturnTypeWillChange]
public function offsetGet($offset) {
return isset($this->items['parameters'][$offset])
? $this->items['parameters'][$offset]
@@ -210,7 +211,7 @@ class Request implements \ArrayAccess, \Countable, IRequest {
* @param string $offset
* @param mixed $value
*/
- public function offsetSet($offset, $value) {
+ public function offsetSet($offset, $value): void {
throw new \RuntimeException('You cannot change the contents of the request object');
}
@@ -218,7 +219,7 @@ class Request implements \ArrayAccess, \Countable, IRequest {
* @see offsetExists
* @param string $offset
*/
- public function offsetUnset($offset) {
+ public function offsetUnset($offset): void {
throw new \RuntimeException('You cannot change the contents of the request object');
}
diff --git a/lib/private/AppFramework/Utility/SimpleContainer.php b/lib/private/AppFramework/Utility/SimpleContainer.php
index c38dbadf0a9..598c66b6aba 100644
--- a/lib/private/AppFramework/Utility/SimpleContainer.php
+++ b/lib/private/AppFramework/Utility/SimpleContainer.php
@@ -197,13 +197,15 @@ class SimpleContainer implements ArrayAccess, ContainerInterface, IContainer {
/**
* @deprecated 20.0.0 use \Psr\Container\ContainerInterface::has
*/
- public function offsetExists($id) {
+ public function offsetExists($id): bool {
return $this->container->offsetExists($id);
}
/**
* @deprecated 20.0.0 use \Psr\Container\ContainerInterface::get
+ * @return mixed
*/
+ #[\ReturnTypeWillChange]
public function offsetGet($id) {
return $this->container->offsetGet($id);
}
@@ -211,14 +213,14 @@ class SimpleContainer implements ArrayAccess, ContainerInterface, IContainer {
/**
* @deprecated 20.0.0 use \OCP\IContainer::registerService
*/
- public function offsetSet($id, $service) {
+ public function offsetSet($id, $service): void {
$this->container->offsetSet($id, $service);
}
/**
* @deprecated 20.0.0
*/
- public function offsetUnset($offset) {
+ public function offsetUnset($offset): void {
$this->container->offsetUnset($offset);
}
}
diff --git a/lib/private/Authentication/Token/DefaultToken.php b/lib/private/Authentication/Token/DefaultToken.php
index 5a008586a90..b649fdbb6af 100644
--- a/lib/private/Authentication/Token/DefaultToken.php
+++ b/lib/private/Authentication/Token/DefaultToken.php
@@ -121,7 +121,7 @@ class DefaultToken extends Entity implements INamedToken {
return parent::getPassword();
}
- public function jsonSerialize() {
+ public function jsonSerialize(): array {
return [
'id' => $this->id,
'name' => $this->name,
diff --git a/lib/private/Authentication/Token/PublicKeyToken.php b/lib/private/Authentication/Token/PublicKeyToken.php
index 3351c767ce3..d060fe14103 100644
--- a/lib/private/Authentication/Token/PublicKeyToken.php
+++ b/lib/private/Authentication/Token/PublicKeyToken.php
@@ -138,7 +138,7 @@ class PublicKeyToken extends Entity implements INamedToken, IWipeableToken {
return parent::getPassword();
}
- public function jsonSerialize() {
+ public function jsonSerialize(): array {
return [
'id' => $this->id,
'name' => $this->name,
diff --git a/lib/private/Cache/CappedMemoryCache.php b/lib/private/Cache/CappedMemoryCache.php
index 408c3935ffb..584a53f0ff2 100644
--- a/lib/private/Cache/CappedMemoryCache.php
+++ b/lib/private/Cache/CappedMemoryCache.php
@@ -63,19 +63,23 @@ class CappedMemoryCache implements ICache, \ArrayAccess {
return true;
}
- public function offsetExists($offset) {
+ public function offsetExists($offset): bool {
return $this->hasKey($offset);
}
+ /**
+ * @return mixed
+ */
+ #[\ReturnTypeWillChange]
public function &offsetGet($offset) {
return $this->cache[$offset];
}
- public function offsetSet($offset, $value) {
+ public function offsetSet($offset, $value): void {
$this->set($offset, $value);
}
- public function offsetUnset($offset) {
+ public function offsetUnset($offset): void {
$this->remove($offset);
}
diff --git a/lib/private/Collaboration/Collaborators/UserPlugin.php b/lib/private/Collaboration/Collaborators/UserPlugin.php
index 9ed94082f0d..1c00bb26c94 100644
--- a/lib/private/Collaboration/Collaborators/UserPlugin.php
+++ b/lib/private/Collaboration/Collaborators/UserPlugin.php
@@ -178,7 +178,7 @@ class UserPlugin implements ISearchPlugin {
$this->shareeEnumerationFullMatch &&
$lowerSearch !== '' && (strtolower($uid) === $lowerSearch ||
strtolower($userDisplayName) === $lowerSearch ||
- strtolower($userEmail) === $lowerSearch)
+ strtolower($userEmail ?? '') === $lowerSearch)
) {
if (strtolower($uid) === $lowerSearch) {
$foundUserById = true;
diff --git a/lib/private/Contacts/ContactsMenu/Actions/LinkAction.php b/lib/private/Contacts/ContactsMenu/Actions/LinkAction.php
index 5acafed2fda..3f917854aac 100644
--- a/lib/private/Contacts/ContactsMenu/Actions/LinkAction.php
+++ b/lib/private/Contacts/ContactsMenu/Actions/LinkAction.php
@@ -106,10 +106,7 @@ class LinkAction implements ILinkAction {
return $this->appId;
}
- /**
- * @return array
- */
- public function jsonSerialize() {
+ public function jsonSerialize(): array {
return [
'title' => $this->name,
'icon' => $this->icon,
diff --git a/lib/private/DB/QueryBuilder/ExpressionBuilder/ExpressionBuilder.php b/lib/private/DB/QueryBuilder/ExpressionBuilder/ExpressionBuilder.php
index c35afd0870b..77a4a02128a 100644
--- a/lib/private/DB/QueryBuilder/ExpressionBuilder/ExpressionBuilder.php
+++ b/lib/private/DB/QueryBuilder/ExpressionBuilder/ExpressionBuilder.php
@@ -414,11 +414,11 @@ class ExpressionBuilder implements IExpressionBuilder {
* Quotes a given input parameter.
*
* @param mixed $input The parameter to be quoted.
- * @param mixed|null $type One of the IQueryBuilder::PARAM_* constants
+ * @param int $type One of the IQueryBuilder::PARAM_* constants
*
* @return ILiteral
*/
- public function literal($input, $type = null): ILiteral {
+ public function literal($input, $type = IQueryBuilder::PARAM_STR): ILiteral {
return new Literal($this->expressionBuilder->literal($input, $type));
}
diff --git a/lib/private/EventDispatcher/GenericEventWrapper.php b/lib/private/EventDispatcher/GenericEventWrapper.php
index 55e23d2ff7f..3574bc8bb83 100644
--- a/lib/private/EventDispatcher/GenericEventWrapper.php
+++ b/lib/private/EventDispatcher/GenericEventWrapper.php
@@ -100,19 +100,23 @@ class GenericEventWrapper extends GenericEvent {
return $this->event->hasArgument($key);
}
+ /**
+ * @return mixed
+ */
+ #[\ReturnTypeWillChange]
public function offsetGet($key) {
return $this->event->offsetGet($key);
}
- public function offsetSet($key, $value) {
- return $this->event->offsetSet($key, $value);
+ public function offsetSet($key, $value): void {
+ $this->event->offsetSet($key, $value);
}
- public function offsetUnset($key) {
- return $this->event->offsetUnset($key);
+ public function offsetUnset($key): void {
+ $this->event->offsetUnset($key);
}
- public function offsetExists($key) {
+ public function offsetExists($key): bool {
return $this->event->offsetExists($key);
}
diff --git a/lib/private/Files/Cache/CacheEntry.php b/lib/private/Files/Cache/CacheEntry.php
index 156f075c2d0..12f0273fb6e 100644
--- a/lib/private/Files/Cache/CacheEntry.php
+++ b/lib/private/Files/Cache/CacheEntry.php
@@ -37,18 +37,22 @@ class CacheEntry implements ICacheEntry {
$this->data = $data;
}
- public function offsetSet($offset, $value) {
+ public function offsetSet($offset, $value): void {
$this->data[$offset] = $value;
}
- public function offsetExists($offset) {
+ public function offsetExists($offset): bool {
return isset($this->data[$offset]);
}
- public function offsetUnset($offset) {
+ public function offsetUnset($offset): void {
unset($this->data[$offset]);
}
+ /**
+ * @return mixed
+ */
+ #[\ReturnTypeWillChange]
public function offsetGet($offset) {
if (isset($this->data[$offset])) {
return $this->data[$offset];
diff --git a/lib/private/Files/FileInfo.php b/lib/private/Files/FileInfo.php
index 8a8de6e4c19..2f361fc051d 100644
--- a/lib/private/Files/FileInfo.php
+++ b/lib/private/Files/FileInfo.php
@@ -104,18 +104,22 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess {
$this->rawSize = $this->data['size'] ?? 0;
}
- public function offsetSet($offset, $value) {
+ public function offsetSet($offset, $value): void {
$this->data[$offset] = $value;
}
- public function offsetExists($offset) {
+ public function offsetExists($offset): bool {
return isset($this->data[$offset]);
}
- public function offsetUnset($offset) {
+ public function offsetUnset($offset): void {
unset($this->data[$offset]);
}
+ /**
+ * @return mixed
+ */
+ #[\ReturnTypeWillChange]
public function offsetGet($offset) {
if ($offset === 'type') {
return $this->getType();
diff --git a/lib/private/Files/ObjectStore/S3Signature.php b/lib/private/Files/ObjectStore/S3Signature.php
index 1e5ef697835..64b994bac22 100644
--- a/lib/private/Files/ObjectStore/S3Signature.php
+++ b/lib/private/Files/ObjectStore/S3Signature.php
@@ -137,7 +137,7 @@ class S3Signature implements SignatureInterface {
$modify['set_headers']['X-Amz-Security-Token'] = $token;
}
- return Psr7\modify_request($request, $modify);
+ return Psr7\Utils::modifyRequest($request, $modify);
}
private function signString($string, CredentialsInterface $credentials) {
@@ -201,7 +201,7 @@ class S3Signature implements SignatureInterface {
$query = $request->getUri()->getQuery();
if ($query) {
- $params = Psr7\parse_query($query);
+ $params = Psr7\Query::parse($query);
$first = true;
foreach ($this->signableQueryString as $key) {
if (array_key_exists($key, $params)) {
diff --git a/lib/private/Files/ObjectStore/Swift.php b/lib/private/Files/ObjectStore/Swift.php
index 3607eff5b29..a3c8d92f3d2 100644
--- a/lib/private/Files/ObjectStore/Swift.php
+++ b/lib/private/Files/ObjectStore/Swift.php
@@ -27,7 +27,7 @@ namespace OC\Files\ObjectStore;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\BadResponseException;
-use function GuzzleHttp\Psr7\stream_for;
+use GuzzleHttp\Psr7\Utils;
use Icewind\Streams\RetryWrapper;
use OCP\Files\NotFoundException;
use OCP\Files\ObjectStore\IObjectStore;
@@ -81,13 +81,13 @@ class Swift implements IObjectStore {
if (filesize($tmpFile) < SWIFT_SEGMENT_SIZE) {
$this->getContainer()->createObject([
'name' => $urn,
- 'stream' => stream_for($handle),
+ 'stream' => Utils::streamFor($handle),
'contentType' => $mimetype,
]);
} else {
$this->getContainer()->createLargeObject([
'name' => $urn,
- 'stream' => stream_for($handle),
+ 'stream' => Utils::streamFor($handle),
'segmentSize' => SWIFT_SEGMENT_SIZE,
'contentType' => $mimetype,
]);
diff --git a/lib/private/FullTextSearch/Model/IndexDocument.php b/lib/private/FullTextSearch/Model/IndexDocument.php
index a1648ab6e2a..3078f12c465 100644
--- a/lib/private/FullTextSearch/Model/IndexDocument.php
+++ b/lib/private/FullTextSearch/Model/IndexDocument.php
@@ -963,10 +963,8 @@ class IndexDocument implements IIndexDocument, JsonSerializable {
/**
* @since 15.0.0
- *
- * @return array
*/
- public function jsonSerialize() {
+ public function jsonSerialize(): array {
return [
'id' => $this->getId(),
'providerId' => $this->getProviderId(),
diff --git a/lib/private/FullTextSearch/Model/SearchRequestSimpleQuery.php b/lib/private/FullTextSearch/Model/SearchRequestSimpleQuery.php
index 9c9ac71efa9..d6bfe6d9102 100644
--- a/lib/private/FullTextSearch/Model/SearchRequestSimpleQuery.php
+++ b/lib/private/FullTextSearch/Model/SearchRequestSimpleQuery.php
@@ -168,10 +168,9 @@ final class SearchRequestSimpleQuery implements ISearchRequestSimpleQuery, JsonS
/**
- * @return array|mixed
* @since 17.0.0
*/
- public function jsonSerialize() {
+ public function jsonSerialize(): array {
return [
'type' => $this->getType(),
'field' => $this->getField(),
diff --git a/lib/private/IntegrityCheck/Iterator/ExcludeFileByNameFilterIterator.php b/lib/private/IntegrityCheck/Iterator/ExcludeFileByNameFilterIterator.php
index aea1ad6c3e9..6d26a40aef4 100644
--- a/lib/private/IntegrityCheck/Iterator/ExcludeFileByNameFilterIterator.php
+++ b/lib/private/IntegrityCheck/Iterator/ExcludeFileByNameFilterIterator.php
@@ -59,10 +59,7 @@ class ExcludeFileByNameFilterIterator extends \RecursiveFilterIterator {
'/^\.webapp-nextcloud-(\d+\.){2}(\d+)(-r\d+)?$/', // Gentoo/Funtoo & derivatives use a tool known as webapp-config to manage wep-apps.
];
- /**
- * @return bool
- */
- public function accept() {
+ public function accept(): bool {
/** @var \SplFileInfo $current */
$current = $this->current();
diff --git a/lib/private/IntegrityCheck/Iterator/ExcludeFoldersByPathFilterIterator.php b/lib/private/IntegrityCheck/Iterator/ExcludeFoldersByPathFilterIterator.php
index fcdd3e3067c..120791f5b03 100644
--- a/lib/private/IntegrityCheck/Iterator/ExcludeFoldersByPathFilterIterator.php
+++ b/lib/private/IntegrityCheck/Iterator/ExcludeFoldersByPathFilterIterator.php
@@ -59,10 +59,7 @@ class ExcludeFoldersByPathFilterIterator extends \RecursiveFilterIterator {
$this->excludedFolders = array_merge($excludedFolders, $appFolders);
}
- /**
- * @return bool
- */
- public function accept() {
+ public function accept(): bool {
return !\in_array(
$this->current()->getPathName(),
$this->excludedFolders,
diff --git a/lib/private/L10N/L10NString.php b/lib/private/L10N/L10NString.php
index 33ccc4b1409..de4bc38d744 100644
--- a/lib/private/L10N/L10NString.php
+++ b/lib/private/L10N/L10NString.php
@@ -82,11 +82,7 @@ class L10NString implements \JsonSerializable {
return vsprintf($text, $this->parameters);
}
-
- /**
- * @return string
- */
- public function jsonSerialize() {
+ public function jsonSerialize(): string {
return $this->__toString();
}
}
diff --git a/lib/private/L10N/LanguageIterator.php b/lib/private/L10N/LanguageIterator.php
index c48a27fb6ce..4a76667caf2 100644
--- a/lib/private/L10N/LanguageIterator.php
+++ b/lib/private/L10N/LanguageIterator.php
@@ -45,7 +45,7 @@ class LanguageIterator implements ILanguageIterator {
/**
* Rewind the Iterator to the first element
*/
- public function rewind() {
+ public function rewind(): void {
$this->i = 0;
}
@@ -112,7 +112,7 @@ class LanguageIterator implements ILanguageIterator {
*
* @since 14.0.0
*/
- public function next() {
+ public function next(): void {
++$this->i;
}
diff --git a/lib/private/Log/LogDetails.php b/lib/private/Log/LogDetails.php
index 87ce0396594..3353ea3f4cc 100644
--- a/lib/private/Log/LogDetails.php
+++ b/lib/private/Log/LogDetails.php
@@ -46,7 +46,7 @@ abstract class LogDetails {
}
$time = \DateTime::createFromFormat("U.u", number_format(microtime(true), 4, ".", ""));
if ($time === false) {
- $time = new \DateTime(null, $timezone);
+ $time = new \DateTime('now', $timezone);
} else {
// apply timezone if $time is created from UNIX timestamp
$time->setTimezone($timezone);
diff --git a/lib/private/Memcache/Cache.php b/lib/private/Memcache/Cache.php
index 95213c16849..1d54a705098 100644
--- a/lib/private/Memcache/Cache.php
+++ b/lib/private/Memcache/Cache.php
@@ -78,19 +78,23 @@ abstract class Cache implements \ArrayAccess, \OCP\ICache {
//implement the ArrayAccess interface
- public function offsetExists($offset) {
+ public function offsetExists($offset): bool {
return $this->hasKey($offset);
}
- public function offsetSet($offset, $value) {
+ public function offsetSet($offset, $value): void {
$this->set($offset, $value);
}
+ /**
+ * @return mixed
+ */
+ #[\ReturnTypeWillChange]
public function offsetGet($offset) {
return $this->get($offset);
}
- public function offsetUnset($offset) {
+ public function offsetUnset($offset): void {
$this->remove($offset);
}
}
diff --git a/lib/private/Session/CryptoSessionData.php b/lib/private/Session/CryptoSessionData.php
index 94ad8f90dcf..2e3bd46da5b 100644
--- a/lib/private/Session/CryptoSessionData.php
+++ b/lib/private/Session/CryptoSessionData.php
@@ -195,6 +195,7 @@ class CryptoSessionData implements \ArrayAccess, ISession {
* @param mixed $offset
* @return mixed
*/
+ #[\ReturnTypeWillChange]
public function offsetGet($offset) {
return $this->get($offset);
}
@@ -203,14 +204,14 @@ class CryptoSessionData implements \ArrayAccess, ISession {
* @param mixed $offset
* @param mixed $value
*/
- public function offsetSet($offset, $value) {
+ public function offsetSet($offset, $value): void {
$this->set($offset, $value);
}
/**
* @param mixed $offset
*/
- public function offsetUnset($offset) {
+ public function offsetUnset($offset): void {
$this->remove($offset);
}
}
diff --git a/lib/private/Session/Session.php b/lib/private/Session/Session.php
index b9497983fbb..affba322bec 100644
--- a/lib/private/Session/Session.php
+++ b/lib/private/Session/Session.php
@@ -55,6 +55,7 @@ abstract class Session implements \ArrayAccess, ISession {
* @param mixed $offset
* @return mixed
*/
+ #[\ReturnTypeWillChange]
public function offsetGet($offset) {
return $this->get($offset);
}
@@ -63,14 +64,14 @@ abstract class Session implements \ArrayAccess, ISession {
* @param mixed $offset
* @param mixed $value
*/
- public function offsetSet($offset, $value) {
+ public function offsetSet($offset, $value): void {
$this->set($offset, $value);
}
/**
* @param mixed $offset
*/
- public function offsetUnset($offset) {
+ public function offsetUnset($offset): void {
$this->remove($offset);
}
diff --git a/lib/private/Setup.php b/lib/private/Setup.php
index f1ad04671f9..589bbb273c0 100644
--- a/lib/private/Setup.php
+++ b/lib/private/Setup.php
@@ -480,7 +480,7 @@ class Setup {
if (!filter_var($webRoot, FILTER_VALIDATE_URL)) {
throw new InvalidArgumentException('invalid value for overwrite.cli.url');
}
- $webRoot = rtrim(parse_url($webRoot, PHP_URL_PATH), '/');
+ $webRoot = rtrim((parse_url($webRoot, PHP_URL_PATH) ?? ''), '/');
} else {
$webRoot = !empty(\OC::$WEBROOT) ? \OC::$WEBROOT : '/';
}
diff --git a/lib/private/Share20/DefaultShareProvider.php b/lib/private/Share20/DefaultShareProvider.php
index 85655c4e379..a6a8bdb9698 100644
--- a/lib/private/Share20/DefaultShareProvider.php
+++ b/lib/private/Share20/DefaultShareProvider.php
@@ -1363,7 +1363,7 @@ class DefaultShareProvider implements IShareProvider {
$best = [];
$bestDepth = 0;
foreach ($shares as $id => $share) {
- $depth = substr_count($share['file_target'], '/');
+ $depth = substr_count(($share['file_target'] ?? ''), '/');
if (empty($best) || $depth < $bestDepth) {
$bestDepth = $depth;
$best = [
diff --git a/lib/private/User/Database.php b/lib/private/User/Database.php
index 5dfc74163a7..81094d4d8af 100644
--- a/lib/private/User/Database.php
+++ b/lib/private/User/Database.php
@@ -386,13 +386,14 @@ class Database extends ABackend implements
$row = $result->fetch();
$result->closeCursor();
- $this->cache[$uid] = false;
-
// "uid" is primary key, so there can only be a single result
if ($row !== false) {
- $this->cache[$uid]['uid'] = (string)$row['uid'];
- $this->cache[$uid]['displayname'] = (string)$row['displayname'];
+ $this->cache[$uid] = [
+ 'uid' => (string)$row['uid'],
+ 'displayname' => (string)$row['displayname'],
+ ];
} else {
+ $this->cache[$uid] = false;
return false;
}
}
diff --git a/lib/public/AppFramework/Services/InitialStateProvider.php b/lib/public/AppFramework/Services/InitialStateProvider.php
index c317fad3f5d..dbc48653792 100644
--- a/lib/public/AppFramework/Services/InitialStateProvider.php
+++ b/lib/public/AppFramework/Services/InitialStateProvider.php
@@ -42,7 +42,9 @@ abstract class InitialStateProvider implements \JsonSerializable {
/**
* @since 21.0.0
+ * @return mixed
*/
+ #[\ReturnTypeWillChange]
final public function jsonSerialize() {
return $this->getData();
}
diff --git a/lib/public/DB/QueryBuilder/IExpressionBuilder.php b/lib/public/DB/QueryBuilder/IExpressionBuilder.php
index 77701240d51..4758fd06208 100644
--- a/lib/public/DB/QueryBuilder/IExpressionBuilder.php
+++ b/lib/public/DB/QueryBuilder/IExpressionBuilder.php
@@ -418,7 +418,7 @@ interface IExpressionBuilder {
* Quotes a given input parameter.
*
* @param mixed $input The parameter to be quoted.
- * @param mixed|null $type One of the IQueryBuilder::PARAM_* constants
+ * @param int $type One of the IQueryBuilder::PARAM_* constants
*
* @return ILiteral
* @since 8.2.0
@@ -426,7 +426,7 @@ interface IExpressionBuilder {
* @psalm-taint-sink sql $input
* @psalm-taint-sink sql $type
*/
- public function literal($input, $type = null): ILiteral;
+ public function literal($input, $type = IQueryBuilder::PARAM_STR): ILiteral;
/**
* Returns a IQueryFunction that casts the column to the given type
diff --git a/lib/public/Dashboard/Model/WidgetSetting.php b/lib/public/Dashboard/Model/WidgetSetting.php
index c456c63f4f5..fce59a4350b 100644
--- a/lib/public/Dashboard/Model/WidgetSetting.php
+++ b/lib/public/Dashboard/Model/WidgetSetting.php
@@ -230,10 +230,8 @@ final class WidgetSetting implements JsonSerializable {
/**
* @since 15.0.0
* @deprecated 20.0.0
- *
- * @return array
*/
- public function jsonSerialize() {
+ public function jsonSerialize(): array {
return [
'name' => $this->getName(),
'title' => $this->getTitle(),
diff --git a/lib/public/Dashboard/Model/WidgetSetup.php b/lib/public/Dashboard/Model/WidgetSetup.php
index 1cc8d9ff561..f3e09dcc71b 100644
--- a/lib/public/Dashboard/Model/WidgetSetup.php
+++ b/lib/public/Dashboard/Model/WidgetSetup.php
@@ -261,10 +261,8 @@ final class WidgetSetup implements JsonSerializable {
/**
* @since 15.0.0
* @deprecated 20.0.0
- *
- * @return array
*/
- public function jsonSerialize() {
+ public function jsonSerialize(): array {
return [
'size' => $this->getSizes(),
'menu' => $this->getMenuEntries(),
diff --git a/lib/public/Dashboard/Model/WidgetTemplate.php b/lib/public/Dashboard/Model/WidgetTemplate.php
index e6f9742fed7..3521960c303 100644
--- a/lib/public/Dashboard/Model/WidgetTemplate.php
+++ b/lib/public/Dashboard/Model/WidgetTemplate.php
@@ -312,10 +312,8 @@ final class WidgetTemplate implements JsonSerializable {
/**
* @since 15.0.0
* @deprecated 20.0.0
- *
- * @return array
*/
- public function jsonSerialize() {
+ public function jsonSerialize(): array {
return [
'icon' => $this->getIcon(),
'css' => $this->getCss(),
diff --git a/lib/public/DirectEditing/ATemplate.php b/lib/public/DirectEditing/ATemplate.php
index c38fc898dab..53aff0d40ff 100644
--- a/lib/public/DirectEditing/ATemplate.php
+++ b/lib/public/DirectEditing/ATemplate.php
@@ -57,9 +57,8 @@ abstract class ATemplate implements JsonSerializable {
/**
* @since 18.0.0
- * @return array|mixed
*/
- public function jsonSerialize() {
+ public function jsonSerialize(): array {
return [
'id' => $this->getId(),
'title' => $this->getTitle(),
diff --git a/lib/public/EventDispatcher/GenericEvent.php b/lib/public/EventDispatcher/GenericEvent.php
index e78ae1827a1..1ba1cc6da14 100644
--- a/lib/public/EventDispatcher/GenericEvent.php
+++ b/lib/public/EventDispatcher/GenericEvent.php
@@ -156,7 +156,9 @@ class GenericEvent extends Event implements ArrayAccess, IteratorAggregate {
* @link https://php.net/manual/en/arrayaccess.offsetget.php
* @since 18.0.0
* @deprecated 22.0.0
+ * @return mixed
*/
+ #[\ReturnTypeWillChange]
public function offsetGet($offset) {
return $this->arguments[$offset];
}
diff --git a/lib/public/Files/Template/Template.php b/lib/public/Files/Template/Template.php
index 50d8b406be9..d71ef3b3655 100644
--- a/lib/public/Files/Template/Template.php
+++ b/lib/public/Files/Template/Template.php
@@ -69,7 +69,7 @@ final class Template implements \JsonSerializable {
/**
* @since 21.0.0
*/
- public function jsonSerialize() {
+ public function jsonSerialize(): array {
return [
'templateType' => $this->templateType,
'templateId' => $this->templateId,
diff --git a/lib/public/Files/Template/TemplateFileCreator.php b/lib/public/Files/Template/TemplateFileCreator.php
index 7be45e68ef9..26edf585869 100644
--- a/lib/public/Files/Template/TemplateFileCreator.php
+++ b/lib/public/Files/Template/TemplateFileCreator.php
@@ -106,7 +106,7 @@ final class TemplateFileCreator implements \JsonSerializable {
/**
* @since 21.0.0
*/
- public function jsonSerialize() {
+ public function jsonSerialize(): array {
return [
'app' => $this->appId,
'label' => $this->actionName,
diff --git a/lib/public/L10N/ILanguageIterator.php b/lib/public/L10N/ILanguageIterator.php
index 882c8bc6f9e..534d4229b1c 100644
--- a/lib/public/L10N/ILanguageIterator.php
+++ b/lib/public/L10N/ILanguageIterator.php
@@ -53,7 +53,9 @@ interface ILanguageIterator extends \Iterator {
* Move forward to next element
*
* @since 14.0.0
+ * @return void
*/
+ #[\ReturnTypeWillChange]
public function next();
/**