aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/autoloader.php4
-rw-r--r--lib/private/Accounts/Account.php2
-rw-r--r--lib/private/Activity/EventMerger.php2
-rw-r--r--lib/private/Activity/Manager.php2
-rw-r--r--lib/private/App/InfoParser.php2
-rw-r--r--lib/private/App/PlatformRepository.php6
-rw-r--r--lib/private/AppFramework/App.php2
-rw-r--r--lib/private/AppFramework/DependencyInjection/DIContainer.php2
-rw-r--r--lib/private/AppFramework/Http/Request.php6
-rw-r--r--lib/private/AppFramework/Utility/TimeFactory.php2
-rw-r--r--lib/private/Authentication/Exceptions/InvalidProviderException.php2
-rw-r--r--lib/private/Authentication/Login/LoginData.php2
-rw-r--r--lib/private/Authentication/Login/LoginResult.php2
-rw-r--r--lib/private/Authentication/LoginCredentials/Store.php2
-rw-r--r--lib/private/Authentication/Token/PublicKeyToken.php2
-rw-r--r--lib/private/Authentication/Token/PublicKeyTokenProvider.php2
-rw-r--r--lib/private/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDao.php4
-rw-r--r--lib/private/Authentication/TwoFactorAuth/Manager.php2
-rw-r--r--lib/private/Authentication/WebAuthn/CredentialRepository.php4
-rw-r--r--lib/private/BackgroundJob/JobList.php2
-rw-r--r--lib/private/Collaboration/Collaborators/SearchResult.php2
-rw-r--r--lib/private/Comments/Comment.php2
-rw-r--r--lib/private/Comments/Manager.php4
-rw-r--r--lib/private/Console/Application.php2
-rw-r--r--lib/private/Contacts/ContactsMenu/Entry.php6
-rw-r--r--lib/private/DB/Adapter.php2
-rw-r--r--lib/private/DB/AdapterSqlite.php2
-rw-r--r--lib/private/DB/Connection.php6
-rw-r--r--lib/private/DB/ConnectionAdapter.php2
-rw-r--r--lib/private/DB/DbDataCollector.php4
-rw-r--r--lib/private/DB/MigrationService.php2
-rw-r--r--lib/private/DB/Migrator.php2
-rw-r--r--lib/private/DateTimeFormatter.php18
-rw-r--r--lib/private/Diagnostics/QueryLogger.php2
-rw-r--r--lib/private/DirectEditing/Manager.php8
-rw-r--r--lib/private/Encryption/Util.php2
-rw-r--r--lib/private/Files/Cache/Cache.php2
-rw-r--r--lib/private/Files/Cache/CacheQueryBuilder.php2
-rw-r--r--lib/private/Files/Cache/Wrapper/CacheJail.php4
-rw-r--r--lib/private/Files/Cache/Wrapper/CacheWrapper.php2
-rw-r--r--lib/private/Files/Config/CachedMountInfo.php2
-rw-r--r--lib/private/Files/Config/LazyPathCachedMountInfo.php2
-rw-r--r--lib/private/Files/Config/MountProviderCollection.php2
-rw-r--r--lib/private/Files/Config/UserMountCache.php2
-rw-r--r--lib/private/Files/Mount/HomeMountPoint.php10
-rw-r--r--lib/private/Files/Mount/MountPoint.php10
-rw-r--r--lib/private/Files/Node/Folder.php2
-rw-r--r--lib/private/Files/Node/LazyFolder.php2
-rw-r--r--lib/private/Files/Node/Node.php2
-rw-r--r--lib/private/Files/Node/Root.php2
-rw-r--r--lib/private/Files/ObjectStore/Azure.php2
-rw-r--r--lib/private/Files/ObjectStore/ObjectStoreStorage.php2
-rw-r--r--lib/private/Files/ObjectStore/S3ObjectTrait.php6
-rw-r--r--lib/private/Files/ObjectStore/StorageObjectStore.php2
-rw-r--r--lib/private/Files/ObjectStore/Swift.php4
-rw-r--r--lib/private/Files/Storage/Common.php2
-rw-r--r--lib/private/Files/Storage/Local.php2
-rw-r--r--lib/private/Files/Storage/Wrapper/Encryption.php18
-rw-r--r--lib/private/Files/Storage/Wrapper/Jail.php2
-rw-r--r--lib/private/Files/Storage/Wrapper/KnownMtime.php2
-rw-r--r--lib/private/Files/Storage/Wrapper/Wrapper.php2
-rw-r--r--lib/private/Files/Stream/Encryption.php6
-rw-r--r--lib/private/Files/Template/TemplateManager.php2
-rw-r--r--lib/private/Files/Utils/Scanner.php2
-rw-r--r--lib/private/Files/View.php8
-rw-r--r--lib/private/FilesMetadata/FilesMetadataManager.php2
-rw-r--r--lib/private/FilesMetadata/Model/MetadataValueWrapper.php16
-rw-r--r--lib/private/Group/Database.php2
-rw-r--r--lib/private/Group/Group.php4
-rw-r--r--lib/private/Group/Manager.php2
-rw-r--r--lib/private/Hooks/Emitter.php2
-rw-r--r--lib/private/Hooks/EmitterTrait.php2
-rw-r--r--lib/private/L10N/Factory.php16
-rw-r--r--lib/private/L10N/L10N.php2
-rw-r--r--lib/private/Lock/MemcacheLockingProvider.php2
-rw-r--r--lib/private/Mail/Message.php2
-rw-r--r--lib/private/Memcache/ProfilerWrapperCache.php2
-rw-r--r--lib/private/Memcache/Redis.php2
-rw-r--r--lib/private/OCS/Result.php2
-rw-r--r--lib/private/Preview/Generator.php2
-rw-r--r--lib/private/Preview/ProviderV2.php2
-rw-r--r--lib/private/Profiler/FileProfilerStorage.php18
-rw-r--r--lib/private/Profiler/Profiler.php2
-rw-r--r--lib/private/Profiler/RoutingDataCollector.php2
-rw-r--r--lib/private/Route/Router.php2
-rw-r--r--lib/private/Search/Provider/File.php2
-rw-r--r--lib/private/Settings/Manager.php2
-rw-r--r--lib/private/Share20/Manager.php2
-rw-r--r--lib/private/Talk/Broker.php2
-rw-r--r--lib/private/Template/JSResourceLocator.php2
-rw-r--r--lib/private/User/Session.php2
-rw-r--r--lib/private/User/User.php2
-rw-r--r--lib/private/legacy/OC_Files.php2
-rw-r--r--lib/private/legacy/OC_Image.php4
-rw-r--r--lib/private/legacy/OC_User.php2
-rw-r--r--lib/private/legacy/OC_Util.php6
-rw-r--r--lib/public/Accounts/IAccount.php2
-rw-r--r--lib/public/Activity/IEventMerger.php2
-rw-r--r--lib/public/Activity/IManager.php2
-rw-r--r--lib/public/Activity/IProvider.php2
-rw-r--r--lib/public/App/ManagerEvent.php2
-rw-r--r--lib/public/AppFramework/Db/Entity.php2
-rw-r--r--lib/public/AppFramework/Db/QBMapper.php2
-rw-r--r--lib/public/AppFramework/Http/Response.php2
-rw-r--r--lib/public/AppFramework/OCS/OCSBadRequestException.php2
-rw-r--r--lib/public/AppFramework/OCS/OCSForbiddenException.php2
-rw-r--r--lib/public/AppFramework/OCS/OCSNotFoundException.php2
-rw-r--r--lib/public/AppFramework/OCS/OCSPreconditionFailedException.php2
-rw-r--r--lib/public/AppFramework/Utility/ITimeFactory.php2
-rw-r--r--lib/public/BackgroundJob/IJob.php2
-rw-r--r--lib/public/BackgroundJob/QueuedJob.php2
-rw-r--r--lib/public/BackgroundJob/TimedJob.php2
-rw-r--r--lib/public/Collaboration/Collaborators/ISearchResult.php2
-rw-r--r--lib/public/Comments/ICommentsManager.php4
-rw-r--r--lib/public/Contacts/ContactsMenu/IEntry.php6
-rw-r--r--lib/public/DataCollector/IDataCollector.php2
-rw-r--r--lib/public/Defaults.php2
-rw-r--r--lib/public/Diagnostics/IQueryLogger.php2
-rw-r--r--lib/public/DirectEditing/ACreateEmpty.php2
-rw-r--r--lib/public/Encryption/Exceptions/GenericEncryptionException.php2
-rw-r--r--lib/public/Federation/Exceptions/ProviderCouldNotAddShareException.php2
-rw-r--r--lib/public/Files/Config/IUserMountCache.php2
-rw-r--r--lib/public/Files/Events/Node/BeforeNodeDeletedEvent.php2
-rw-r--r--lib/public/Files/Events/Node/BeforeNodeRenamedEvent.php2
-rw-r--r--lib/public/Files/ForbiddenException.php2
-rw-r--r--lib/public/Files/LockNotAcquiredException.php2
-rw-r--r--lib/public/Files/ObjectStore/IObjectStore.php2
-rw-r--r--lib/public/Files/Storage/IChunkedFileWrite.php2
-rw-r--r--lib/public/Files/Storage/IWriteStreamStorage.php2
-rw-r--r--lib/public/Files/StorageAuthException.php2
-rw-r--r--lib/public/Files/StorageBadConfigException.php2
-rw-r--r--lib/public/Files/StorageConnectionException.php2
-rw-r--r--lib/public/Files/StorageNotAvailableException.php2
-rw-r--r--lib/public/Files/StorageTimeoutException.php2
-rw-r--r--lib/public/Files/Template/ITemplateManager.php2
-rw-r--r--lib/public/HintException.php2
-rw-r--r--lib/public/IDBConnection.php2
-rw-r--r--lib/public/IDateTimeFormatter.php14
-rw-r--r--lib/public/IGroup.php2
-rw-r--r--lib/public/IGroupManager.php2
-rw-r--r--lib/public/L10N/IFactory.php8
-rw-r--r--lib/public/Lock/LockedException.php2
-rw-r--r--lib/public/Lock/ManuallyLockedException.php2
-rw-r--r--lib/public/Log/functions.php2
-rw-r--r--lib/public/Mail/IMessage.php2
-rw-r--r--lib/public/Profiler/IProfiler.php2
-rw-r--r--lib/public/Share/Exceptions/GenericShareException.php2
-rw-r--r--lib/public/SystemTag/ManagerEvent.php2
-rw-r--r--lib/public/SystemTag/TagNotFoundException.php2
-rw-r--r--lib/public/Talk/IBroker.php2
-rw-r--r--lib/public/User/Events/BeforePasswordUpdatedEvent.php2
-rw-r--r--lib/public/User/Events/BeforeUserLoggedOutEvent.php2
-rw-r--r--lib/public/User/Events/PasswordUpdatedEvent.php2
-rw-r--r--lib/public/User/Events/UserLoggedOutEvent.php2
-rw-r--r--lib/public/Util.php2
155 files changed, 242 insertions, 242 deletions
diff --git a/lib/autoloader.php b/lib/autoloader.php
index 26540b754a5..0f8a2ad9687 100644
--- a/lib/autoloader.php
+++ b/lib/autoloader.php
@@ -36,7 +36,7 @@ declare(strict_types=1);
*/
namespace OC;
-use \OCP\AutoloadNotAllowedException;
+use OCP\AutoloadNotAllowedException;
use OCP\ICache;
use Psr\Log\LoggerInterface;
@@ -185,7 +185,7 @@ class Autoloader {
*
* @param ICache $memoryCache Instance of memory cache.
*/
- public function setMemoryCache(ICache $memoryCache = null): void {
+ public function setMemoryCache(?ICache $memoryCache = null): void {
$this->memoryCache = $memoryCache;
}
}
diff --git a/lib/private/Accounts/Account.php b/lib/private/Accounts/Account.php
index 22bbe3d11a0..bc74c85eac2 100644
--- a/lib/private/Accounts/Account.php
+++ b/lib/private/Accounts/Account.php
@@ -104,7 +104,7 @@ class Account implements IAccount {
}
}
- public function getFilteredProperties(string $scope = null, string $verified = null): array {
+ public function getFilteredProperties(?string $scope = null, ?string $verified = null): array {
$result = $incrementals = [];
/** @var IAccountProperty $obj */
foreach ($this->getAllProperties() as $obj) {
diff --git a/lib/private/Activity/EventMerger.php b/lib/private/Activity/EventMerger.php
index 9332d8b111a..5775e23a503 100644
--- a/lib/private/Activity/EventMerger.php
+++ b/lib/private/Activity/EventMerger.php
@@ -67,7 +67,7 @@ class EventMerger implements IEventMerger {
* @param IEvent|null $previousEvent
* @return IEvent
*/
- public function mergeEvents($mergeParameter, IEvent $event, IEvent $previousEvent = null) {
+ public function mergeEvents($mergeParameter, IEvent $event, ?IEvent $previousEvent = null) {
// No second event => can not combine
if (!$previousEvent instanceof IEvent) {
return $event;
diff --git a/lib/private/Activity/Manager.php b/lib/private/Activity/Manager.php
index 14069260c6c..b8568a18b81 100644
--- a/lib/private/Activity/Manager.php
+++ b/lib/private/Activity/Manager.php
@@ -348,7 +348,7 @@ class Manager implements IManager {
* @param string|null $currentUserId
* @throws \UnexpectedValueException If the user is invalid
*/
- public function setCurrentUserId(string $currentUserId = null): void {
+ public function setCurrentUserId(?string $currentUserId = null): void {
if (!is_string($currentUserId) && $currentUserId !== null) {
throw new \UnexpectedValueException('The given current user is invalid');
}
diff --git a/lib/private/App/InfoParser.php b/lib/private/App/InfoParser.php
index 2461d587bbd..cb1d63ee37c 100644
--- a/lib/private/App/InfoParser.php
+++ b/lib/private/App/InfoParser.php
@@ -270,7 +270,7 @@ class InfoParser {
} else {
$array[$element] = $data;
}
- // Just a value
+ // Just a value
} else {
if ($totalElement > 1) {
$array[$element][] = $this->xmlToArray($node);
diff --git a/lib/private/App/PlatformRepository.php b/lib/private/App/PlatformRepository.php
index 9b94c0b07bc..2d6ce7e89be 100644
--- a/lib/private/App/PlatformRepository.php
+++ b/lib/private/App/PlatformRepository.php
@@ -154,7 +154,7 @@ class PlatformRepository {
*/
public function normalizeVersion(string $version, ?string $fullVersion = null): string {
$version = trim($version);
- if (null === $fullVersion) {
+ if ($fullVersion === null) {
$fullVersion = $version;
}
// ignore aliases and just assume the alias is required instead of the source
@@ -165,7 +165,7 @@ class PlatformRepository {
if (preg_match('{^(?:dev-)?(?:master|trunk|default)$}i', $version)) {
return '9999999-dev';
}
- if ('dev-' === strtolower(substr($version, 0, 4))) {
+ if (strtolower(substr($version, 0, 4)) === 'dev-') {
return 'dev-' . substr($version, 4);
}
// match classical versioning
@@ -188,7 +188,7 @@ class PlatformRepository {
// add version modifiers if a version was matched
if (isset($index)) {
if (!empty($matches[$index])) {
- if ('stable' === $matches[$index]) {
+ if ($matches[$index] === 'stable') {
return $version;
}
$version .= '-' . $this->expandStability($matches[$index]) . (!empty($matches[$index + 1]) ? $matches[$index + 1] : '');
diff --git a/lib/private/AppFramework/App.php b/lib/private/AppFramework/App.php
index b18c95a2f0d..ddcf38c8010 100644
--- a/lib/private/AppFramework/App.php
+++ b/lib/private/AppFramework/App.php
@@ -116,7 +116,7 @@ class App {
* @param array $urlParams list of URL parameters (optional)
* @throws HintException
*/
- public static function main(string $controllerName, string $methodName, DIContainer $container, array $urlParams = null) {
+ public static function main(string $controllerName, string $methodName, DIContainer $container, ?array $urlParams = null) {
/** @var IProfiler $profiler */
$profiler = $container->get(IProfiler::class);
$eventLogger = $container->get(IEventLogger::class);
diff --git a/lib/private/AppFramework/DependencyInjection/DIContainer.php b/lib/private/AppFramework/DependencyInjection/DIContainer.php
index 5fff0aec9d8..a69fc24c978 100644
--- a/lib/private/AppFramework/DependencyInjection/DIContainer.php
+++ b/lib/private/AppFramework/DependencyInjection/DIContainer.php
@@ -96,7 +96,7 @@ class DIContainer extends SimpleContainer implements IAppContainer {
* @param array $urlParams
* @param ServerContainer|null $server
*/
- public function __construct(string $appName, array $urlParams = [], ServerContainer $server = null) {
+ public function __construct(string $appName, array $urlParams = [], ?ServerContainer $server = null) {
parent::__construct();
$this->appName = $appName;
$this['appName'] = $appName;
diff --git a/lib/private/AppFramework/Http/Request.php b/lib/private/AppFramework/Http/Request.php
index 94054c3e62c..7a614878ab5 100644
--- a/lib/private/AppFramework/Http/Request.php
+++ b/lib/private/AppFramework/Http/Request.php
@@ -121,7 +121,7 @@ class Request implements \ArrayAccess, \Countable, IRequest {
public function __construct(array $vars,
IRequestId $requestId,
IConfig $config,
- CsrfTokenManager $csrfTokenManager = null,
+ ?CsrfTokenManager $csrfTokenManager = null,
string $stream = 'php://input') {
$this->inputStream = $stream;
$this->items['params'] = [];
@@ -432,8 +432,8 @@ class Request implements \ArrayAccess, \Countable, IRequest {
$this->items['post'] = $params;
}
}
- // Handle application/x-www-form-urlencoded for methods other than GET
- // or post correctly
+ // Handle application/x-www-form-urlencoded for methods other than GET
+ // or post correctly
} elseif ($this->method !== 'GET'
&& $this->method !== 'POST'
&& str_contains($this->getHeader('Content-Type'), 'application/x-www-form-urlencoded')) {
diff --git a/lib/private/AppFramework/Utility/TimeFactory.php b/lib/private/AppFramework/Utility/TimeFactory.php
index 737777a11ac..89f4f1b467e 100644
--- a/lib/private/AppFramework/Utility/TimeFactory.php
+++ b/lib/private/AppFramework/Utility/TimeFactory.php
@@ -60,7 +60,7 @@ class TimeFactory implements ITimeFactory {
* @since 15.0.0
* @deprecated 26.0.0 {@see ITimeFactory::now()}
*/
- public function getDateTime(string $time = 'now', \DateTimeZone $timezone = null): \DateTime {
+ public function getDateTime(string $time = 'now', ?\DateTimeZone $timezone = null): \DateTime {
return new \DateTime($time, $timezone);
}
diff --git a/lib/private/Authentication/Exceptions/InvalidProviderException.php b/lib/private/Authentication/Exceptions/InvalidProviderException.php
index 86b44e4d0e2..a47ac6134a8 100644
--- a/lib/private/Authentication/Exceptions/InvalidProviderException.php
+++ b/lib/private/Authentication/Exceptions/InvalidProviderException.php
@@ -29,7 +29,7 @@ use Exception;
use Throwable;
class InvalidProviderException extends Exception {
- public function __construct(string $providerId, Throwable $previous = null) {
+ public function __construct(string $providerId, ?Throwable $previous = null) {
parent::__construct("The provider '$providerId' does not exist'", 0, $previous);
}
}
diff --git a/lib/private/Authentication/Login/LoginData.php b/lib/private/Authentication/Login/LoginData.php
index 0ce11cf70fc..a36fd66df75 100644
--- a/lib/private/Authentication/Login/LoginData.php
+++ b/lib/private/Authentication/Login/LoginData.php
@@ -57,7 +57,7 @@ class LoginData {
public function __construct(IRequest $request,
string $username,
?string $password,
- string $redirectUrl = null,
+ ?string $redirectUrl = null,
string $timeZone = '',
string $timeZoneOffset = '') {
$this->request = $request;
diff --git a/lib/private/Authentication/Login/LoginResult.php b/lib/private/Authentication/Login/LoginResult.php
index 18820d98a47..6c031bc88fb 100644
--- a/lib/private/Authentication/Login/LoginResult.php
+++ b/lib/private/Authentication/Login/LoginResult.php
@@ -64,7 +64,7 @@ class LoginResult {
/**
* @param LoginController::LOGIN_MSG_*|null $msg
*/
- public static function failure(LoginData $data, string $msg = null): LoginResult {
+ public static function failure(LoginData $data, ?string $msg = null): LoginResult {
$result = new static(false, $data);
if ($msg !== null) {
$result->setErrorMessage($msg);
diff --git a/lib/private/Authentication/LoginCredentials/Store.php b/lib/private/Authentication/LoginCredentials/Store.php
index 2e00ac211c1..1e6f52ae2b9 100644
--- a/lib/private/Authentication/LoginCredentials/Store.php
+++ b/lib/private/Authentication/LoginCredentials/Store.php
@@ -49,7 +49,7 @@ class Store implements IStore {
public function __construct(ISession $session,
LoggerInterface $logger,
- IProvider $tokenProvider = null) {
+ ?IProvider $tokenProvider = null) {
$this->session = $session;
$this->logger = $logger;
$this->tokenProvider = $tokenProvider;
diff --git a/lib/private/Authentication/Token/PublicKeyToken.php b/lib/private/Authentication/Token/PublicKeyToken.php
index b77a856589d..48106dc2cec 100644
--- a/lib/private/Authentication/Token/PublicKeyToken.php
+++ b/lib/private/Authentication/Token/PublicKeyToken.php
@@ -211,7 +211,7 @@ class PublicKeyToken extends Entity implements INamedToken, IWipeableToken {
parent::setToken($token);
}
- public function setPassword(string $password = null): void {
+ public function setPassword(?string $password = null): void {
parent::setPassword($password);
}
diff --git a/lib/private/Authentication/Token/PublicKeyTokenProvider.php b/lib/private/Authentication/Token/PublicKeyTokenProvider.php
index 6fd2bebc195..48a23b61e0b 100644
--- a/lib/private/Authentication/Token/PublicKeyTokenProvider.php
+++ b/lib/private/Authentication/Token/PublicKeyTokenProvider.php
@@ -192,7 +192,7 @@ class PublicKeyTokenProvider implements IProvider {
*/
private function getTokenFromCache(string $tokenHash): ?PublicKeyToken {
$serializedToken = $this->cache->get($tokenHash);
- if (null === $serializedToken) {
+ if ($serializedToken === null) {
if ($this->cache->hasKey($tokenHash)) {
throw new InvalidTokenException('Token does not exist: ' . $tokenHash);
}
diff --git a/lib/private/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDao.php b/lib/private/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDao.php
index 97d6a02b4c4..db5da97f275 100644
--- a/lib/private/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDao.php
+++ b/lib/private/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDao.php
@@ -57,7 +57,7 @@ class ProviderUserAssignmentDao {
$result = $query->execute();
$providers = [];
foreach ($result->fetchAll() as $row) {
- $providers[(string)$row['provider_id']] = 1 === (int)$row['enabled'];
+ $providers[(string)$row['provider_id']] = (int)$row['enabled'] === 1;
}
$result->closeCursor();
@@ -114,7 +114,7 @@ class ProviderUserAssignmentDao {
return [
'provider_id' => $row['provider_id'],
'uid' => $row['uid'],
- 'enabled' => 1 === (int) $row['enabled'],
+ 'enabled' => (int) $row['enabled'] === 1,
];
}, $rows);
}
diff --git a/lib/private/Authentication/TwoFactorAuth/Manager.php b/lib/private/Authentication/TwoFactorAuth/Manager.php
index 3870c797f8d..3722b450681 100644
--- a/lib/private/Authentication/TwoFactorAuth/Manager.php
+++ b/lib/private/Authentication/TwoFactorAuth/Manager.php
@@ -313,7 +313,7 @@ class Manager {
* @param IUser $user the currently logged in user
* @return boolean
*/
- public function needsSecondFactor(IUser $user = null): bool {
+ public function needsSecondFactor(?IUser $user = null): bool {
if ($user === null) {
return false;
}
diff --git a/lib/private/Authentication/WebAuthn/CredentialRepository.php b/lib/private/Authentication/WebAuthn/CredentialRepository.php
index e5c3fcf1618..81dad20fc60 100644
--- a/lib/private/Authentication/WebAuthn/CredentialRepository.php
+++ b/lib/private/Authentication/WebAuthn/CredentialRepository.php
@@ -61,7 +61,7 @@ class CredentialRepository implements PublicKeyCredentialSourceRepository {
}, $entities);
}
- public function saveAndReturnCredentialSource(PublicKeyCredentialSource $publicKeyCredentialSource, string $name = null): PublicKeyCredentialEntity {
+ public function saveAndReturnCredentialSource(PublicKeyCredentialSource $publicKeyCredentialSource, ?string $name = null): PublicKeyCredentialEntity {
$oldEntity = null;
try {
@@ -87,7 +87,7 @@ class CredentialRepository implements PublicKeyCredentialSourceRepository {
return $this->credentialMapper->insertOrUpdate($entity);
}
- public function saveCredentialSource(PublicKeyCredentialSource $publicKeyCredentialSource, string $name = null): void {
+ public function saveCredentialSource(PublicKeyCredentialSource $publicKeyCredentialSource, ?string $name = null): void {
$this->saveAndReturnCredentialSource($publicKeyCredentialSource, $name);
}
}
diff --git a/lib/private/BackgroundJob/JobList.php b/lib/private/BackgroundJob/JobList.php
index 93d5cf74a20..4e5d11604e6 100644
--- a/lib/private/BackgroundJob/JobList.php
+++ b/lib/private/BackgroundJob/JobList.php
@@ -59,7 +59,7 @@ class JobList implements IJobList {
$this->logger = $logger;
}
- public function add($job, $argument = null, int $firstCheck = null): void {
+ public function add($job, $argument = null, ?int $firstCheck = null): void {
if ($firstCheck === null) {
$firstCheck = $this->timeFactory->getTime();
}
diff --git a/lib/private/Collaboration/Collaborators/SearchResult.php b/lib/private/Collaboration/Collaborators/SearchResult.php
index 524ffba4b9e..64ff60c71c2 100644
--- a/lib/private/Collaboration/Collaborators/SearchResult.php
+++ b/lib/private/Collaboration/Collaborators/SearchResult.php
@@ -34,7 +34,7 @@ class SearchResult implements ISearchResult {
protected array $exactIdMatches = [];
- public function addResultSet(SearchResultType $type, array $matches, array $exactMatches = null): void {
+ public function addResultSet(SearchResultType $type, array $matches, ?array $exactMatches = null): void {
$type = $type->getLabel();
if (!isset($this->result[$type])) {
$this->result[$type] = [];
diff --git a/lib/private/Comments/Comment.php b/lib/private/Comments/Comment.php
index 58a3ac96b1d..b1261a72520 100644
--- a/lib/private/Comments/Comment.php
+++ b/lib/private/Comments/Comment.php
@@ -55,7 +55,7 @@ class Comment implements IComment {
* @param array $data optional, array with keys according to column names from
* the comments database scheme
*/
- public function __construct(array $data = null) {
+ public function __construct(?array $data = null) {
if (is_array($data)) {
$this->fromArray($data);
}
diff --git a/lib/private/Comments/Manager.php b/lib/private/Comments/Manager.php
index 49b319038cb..3c5522de8ae 100644
--- a/lib/private/Comments/Manager.php
+++ b/lib/private/Comments/Manager.php
@@ -339,7 +339,7 @@ class Manager implements ICommentsManager {
$objectId,
$limit = 0,
$offset = 0,
- \DateTime $notOlderThan = null
+ ?\DateTime $notOlderThan = null
) {
$comments = [];
@@ -632,7 +632,7 @@ class Manager implements ICommentsManager {
* @return Int
* @since 9.0.0
*/
- public function getNumberOfCommentsForObject($objectType, $objectId, \DateTime $notOlderThan = null, $verb = '') {
+ public function getNumberOfCommentsForObject($objectType, $objectId, ?\DateTime $notOlderThan = null, $verb = '') {
$qb = $this->dbConn->getQueryBuilder();
$query = $qb->select($qb->func()->count('id'))
->from('comments')
diff --git a/lib/private/Console/Application.php b/lib/private/Console/Application.php
index fc02c91a99f..ec8d5900f36 100644
--- a/lib/private/Console/Application.php
+++ b/lib/private/Console/Application.php
@@ -203,7 +203,7 @@ class Application {
* @return int
* @throws \Exception
*/
- public function run(InputInterface $input = null, OutputInterface $output = null) {
+ public function run(?InputInterface $input = null, ?OutputInterface $output = null) {
$event = new ConsoleEvent(
ConsoleEvent::EVENT_RUN,
$this->request->server['argv']
diff --git a/lib/private/Contacts/ContactsMenu/Entry.php b/lib/private/Contacts/ContactsMenu/Entry.php
index 954f46e1296..41fb88b1528 100644
--- a/lib/private/Contacts/ContactsMenu/Entry.php
+++ b/lib/private/Contacts/ContactsMenu/Entry.php
@@ -111,9 +111,9 @@ class Entry implements IEntry {
}
public function setStatus(string $status,
- string $statusMessage = null,
- int $statusMessageTimestamp = null,
- string $icon = null): void {
+ ?string $statusMessage = null,
+ ?int $statusMessageTimestamp = null,
+ ?string $icon = null): void {
$this->status = $status;
$this->statusMessage = $statusMessage;
$this->statusMessageTimestamp = $statusMessageTimestamp;
diff --git a/lib/private/DB/Adapter.php b/lib/private/DB/Adapter.php
index ad232aaabd1..c2da5343b4b 100644
--- a/lib/private/DB/Adapter.php
+++ b/lib/private/DB/Adapter.php
@@ -100,7 +100,7 @@ class Adapter {
* @throws Exception
* @deprecated 15.0.0 - use unique index and "try { $db->insert() } catch (UniqueConstraintViolationException $e) {}" instead, because it is more reliable and does not have the risk for deadlocks - see https://github.com/nextcloud/server/pull/12371
*/
- public function insertIfNotExist($table, $input, array $compare = null) {
+ public function insertIfNotExist($table, $input, ?array $compare = null) {
if (empty($compare)) {
$compare = array_keys($input);
}
diff --git a/lib/private/DB/AdapterSqlite.php b/lib/private/DB/AdapterSqlite.php
index 27c700bce7f..7fce1d17c9a 100644
--- a/lib/private/DB/AdapterSqlite.php
+++ b/lib/private/DB/AdapterSqlite.php
@@ -63,7 +63,7 @@ class AdapterSqlite extends Adapter {
* @throws \Doctrine\DBAL\Exception
* @deprecated 15.0.0 - use unique index and "try { $db->insert() } catch (UniqueConstraintViolationException $e) {}" instead, because it is more reliable and does not have the risk for deadlocks - see https://github.com/nextcloud/server/pull/12371
*/
- public function insertIfNotExist($table, $input, array $compare = null) {
+ public function insertIfNotExist($table, $input, ?array $compare = null) {
if (empty($compare)) {
$compare = array_keys($input);
}
diff --git a/lib/private/DB/Connection.php b/lib/private/DB/Connection.php
index a8838bbae2c..bd602c27222 100644
--- a/lib/private/DB/Connection.php
+++ b/lib/private/DB/Connection.php
@@ -269,7 +269,7 @@ class Connection extends PrimaryReadReplicaConnection {
*
* @throws \Doctrine\DBAL\Exception
*/
- public function executeQuery(string $sql, array $params = [], $types = [], QueryCacheProfile $qcp = null): Result {
+ public function executeQuery(string $sql, array $params = [], $types = [], ?QueryCacheProfile $qcp = null): Result {
$tables = $this->getQueriedTables($sql);
$now = $this->clock->now()->getTimestamp();
$dirtyTableWrites = [];
@@ -423,7 +423,7 @@ class Connection extends PrimaryReadReplicaConnection {
* @throws \Doctrine\DBAL\Exception
* @deprecated 15.0.0 - use unique index and "try { $db->insert() } catch (UniqueConstraintViolationException $e) {}" instead, because it is more reliable and does not have the risk for deadlocks - see https://github.com/nextcloud/server/pull/12371
*/
- public function insertIfNotExist($table, $input, array $compare = null) {
+ public function insertIfNotExist($table, $input, ?array $compare = null) {
return $this->adapter->insertIfNotExist($table, $input, $compare);
}
@@ -709,7 +709,7 @@ class Connection extends PrimaryReadReplicaConnection {
private function reconnectIfNeeded(): void {
if (
!isset($this->lastConnectionCheck[$this->getConnectionName()]) ||
- $this->lastConnectionCheck[$this->getConnectionName()] + 30 >= time() ||
+ time() <= $this->lastConnectionCheck[$this->getConnectionName()] + 30 ||
$this->isTransactionActive()
) {
return;
diff --git a/lib/private/DB/ConnectionAdapter.php b/lib/private/DB/ConnectionAdapter.php
index e27c98194fb..411ce3a7e55 100644
--- a/lib/private/DB/ConnectionAdapter.php
+++ b/lib/private/DB/ConnectionAdapter.php
@@ -97,7 +97,7 @@ class ConnectionAdapter implements IDBConnection {
}
}
- public function insertIfNotExist(string $table, array $input, array $compare = null) {
+ public function insertIfNotExist(string $table, array $input, ?array $compare = null) {
try {
return $this->inner->insertIfNotExist($table, $input, $compare);
} catch (Exception $e) {
diff --git a/lib/private/DB/DbDataCollector.php b/lib/private/DB/DbDataCollector.php
index 60e3dbe797d..da5d55316a2 100644
--- a/lib/private/DB/DbDataCollector.php
+++ b/lib/private/DB/DbDataCollector.php
@@ -48,7 +48,7 @@ class DbDataCollector extends \OCP\DataCollector\AbstractDataCollector {
/**
* @inheritDoc
*/
- public function collect(Request $request, Response $response, \Throwable $exception = null): void {
+ public function collect(Request $request, Response $response, ?\Throwable $exception = null): void {
$queries = $this->sanitizeQueries($this->debugStack->queries);
$this->data = [
@@ -75,7 +75,7 @@ class DbDataCollector extends \OCP\DataCollector\AbstractDataCollector {
private function sanitizeQuery(array $query): array {
$query['explainable'] = true;
$query['runnable'] = true;
- if (null === $query['params']) {
+ if ($query['params'] === null) {
$query['params'] = [];
}
if (!\is_array($query['params'])) {
diff --git a/lib/private/DB/MigrationService.php b/lib/private/DB/MigrationService.php
index f885422c928..f23f105763e 100644
--- a/lib/private/DB/MigrationService.php
+++ b/lib/private/DB/MigrationService.php
@@ -79,7 +79,7 @@ class MigrationService {
$this->migrationsNamespace = 'OC\\Core\\Migrations';
$this->checkOracle = true;
} else {
- if (null === $appLocator) {
+ if ($appLocator === null) {
$appLocator = new AppLocator();
}
$appPath = $appLocator->getAppPath($appName);
diff --git a/lib/private/DB/Migrator.php b/lib/private/DB/Migrator.php
index 7cf95b04000..ba3203a34d6 100644
--- a/lib/private/DB/Migrator.php
+++ b/lib/private/DB/Migrator.php
@@ -145,7 +145,7 @@ class Migrator {
/**
* @throws Exception
*/
- protected function applySchema(Schema $targetSchema, Connection $connection = null) {
+ protected function applySchema(Schema $targetSchema, ?Connection $connection = null) {
if (is_null($connection)) {
$connection = $this->connection;
}
diff --git a/lib/private/DateTimeFormatter.php b/lib/private/DateTimeFormatter.php
index 57c4833a4e3..0c5b6a55882 100644
--- a/lib/private/DateTimeFormatter.php
+++ b/lib/private/DateTimeFormatter.php
@@ -77,7 +77,7 @@ class DateTimeFormatter implements \OCP\IDateTimeFormatter {
* @param \DateTimeZone $timeZone The timezone to use
* @return \DateTime
*/
- protected function getDateTime($timestamp, \DateTimeZone $timeZone = null) {
+ protected function getDateTime($timestamp, ?\DateTimeZone $timeZone = null) {
if ($timestamp === null) {
return new \DateTime('now', $timeZone);
} elseif (!$timestamp instanceof \DateTime) {
@@ -105,7 +105,7 @@ class DateTimeFormatter implements \OCP\IDateTimeFormatter {
* @param \OCP\IL10N $l The locale to use
* @return string Formatted date string
*/
- public function formatDate($timestamp, $format = 'long', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null) {
+ public function formatDate($timestamp, $format = 'long', ?\DateTimeZone $timeZone = null, ?\OCP\IL10N $l = null) {
return $this->format($timestamp, 'date', $format, $timeZone, $l);
}
@@ -124,7 +124,7 @@ class DateTimeFormatter implements \OCP\IDateTimeFormatter {
* @param \OCP\IL10N $l The locale to use
* @return string Formatted relative date string
*/
- public function formatDateRelativeDay($timestamp, $format = 'long', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null) {
+ public function formatDateRelativeDay($timestamp, $format = 'long', ?\DateTimeZone $timeZone = null, ?\OCP\IL10N $l = null) {
if (!str_ends_with($format, '^') && !str_ends_with($format, '*')) {
$format .= '^';
}
@@ -145,7 +145,7 @@ class DateTimeFormatter implements \OCP\IDateTimeFormatter {
* @param \OCP\IL10N $l The locale to use
* @return string Formatted date span
*/
- public function formatDateSpan($timestamp, $baseTimestamp = null, \OCP\IL10N $l = null) {
+ public function formatDateSpan($timestamp, $baseTimestamp = null, ?\OCP\IL10N $l = null) {
$l = $this->getLocale($l);
$timestamp = $this->getDateTime($timestamp);
$timestamp->setTime(0, 0, 0);
@@ -211,7 +211,7 @@ class DateTimeFormatter implements \OCP\IDateTimeFormatter {
* @param \OCP\IL10N $l The locale to use
* @return string Formatted time string
*/
- public function formatTime($timestamp, $format = 'medium', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null) {
+ public function formatTime($timestamp, $format = 'medium', ?\DateTimeZone $timeZone = null, ?\OCP\IL10N $l = null) {
return $this->format($timestamp, 'time', $format, $timeZone, $l);
}
@@ -230,7 +230,7 @@ class DateTimeFormatter implements \OCP\IDateTimeFormatter {
* @param \OCP\IL10N $l The locale to use
* @return string Formatted time span
*/
- public function formatTimeSpan($timestamp, $baseTimestamp = null, \OCP\IL10N $l = null) {
+ public function formatTimeSpan($timestamp, $baseTimestamp = null, ?\OCP\IL10N $l = null) {
$l = $this->getLocale($l);
$timestamp = $this->getDateTime($timestamp);
if ($baseTimestamp === null) {
@@ -273,7 +273,7 @@ class DateTimeFormatter implements \OCP\IDateTimeFormatter {
* @param \OCP\IL10N $l The locale to use
* @return string Formatted date and time string
*/
- public function formatDateTime($timestamp, $formatDate = 'long', $formatTime = 'medium', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null) {
+ public function formatDateTime($timestamp, $formatDate = 'long', $formatTime = 'medium', ?\DateTimeZone $timeZone = null, ?\OCP\IL10N $l = null) {
return $this->format($timestamp, 'datetime', $formatDate . '|' . $formatTime, $timeZone, $l);
}
@@ -288,7 +288,7 @@ class DateTimeFormatter implements \OCP\IDateTimeFormatter {
* @param \OCP\IL10N $l The locale to use
* @return string Formatted relative date and time string
*/
- public function formatDateTimeRelativeDay($timestamp, $formatDate = 'long', $formatTime = 'medium', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null) {
+ public function formatDateTimeRelativeDay($timestamp, $formatDate = 'long', $formatTime = 'medium', ?\DateTimeZone $timeZone = null, ?\OCP\IL10N $l = null) {
if (!str_ends_with($formatDate, '^') && !str_ends_with($formatDate, '*')) {
$formatDate .= '^';
}
@@ -306,7 +306,7 @@ class DateTimeFormatter implements \OCP\IDateTimeFormatter {
* @param \OCP\IL10N $l The locale to use
* @return string Formatted date and time string
*/
- protected function format($timestamp, $type, $format, \DateTimeZone $timeZone = null, \OCP\IL10N $l = null) {
+ protected function format($timestamp, $type, $format, ?\DateTimeZone $timeZone = null, ?\OCP\IL10N $l = null) {
$l = $this->getLocale($l);
$timeZone = $this->getTimeZone($timeZone);
$timestamp = $this->getDateTime($timestamp, $timeZone);
diff --git a/lib/private/Diagnostics/QueryLogger.php b/lib/private/Diagnostics/QueryLogger.php
index 5f401751077..f2fa2b574d1 100644
--- a/lib/private/Diagnostics/QueryLogger.php
+++ b/lib/private/Diagnostics/QueryLogger.php
@@ -49,7 +49,7 @@ class QueryLogger implements IQueryLogger {
/**
* @inheritdoc
*/
- public function startQuery($sql, array $params = null, array $types = null) {
+ public function startQuery($sql, ?array $params = null, ?array $types = null) {
if ($this->activated) {
$this->activeQuery = new Query($sql, $params, microtime(true), $this->getStack());
}
diff --git a/lib/private/DirectEditing/Manager.php b/lib/private/DirectEditing/Manager.php
index 53e2e170ed1..4db41d85a3e 100644
--- a/lib/private/DirectEditing/Manager.php
+++ b/lib/private/DirectEditing/Manager.php
@@ -25,8 +25,6 @@
*/
namespace OC\DirectEditing;
-use \OCP\DirectEditing\IManager;
-use \OCP\Files\Folder;
use Doctrine\DBAL\FetchMode;
use OCP\AppFramework\Http\NotFoundResponse;
use OCP\AppFramework\Http\Response;
@@ -35,9 +33,11 @@ use OCP\Constants;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\DirectEditing\ACreateFromTemplate;
use OCP\DirectEditing\IEditor;
+use OCP\DirectEditing\IManager;
use OCP\DirectEditing\IToken;
use OCP\Encryption\IManager as EncryptionManager;
use OCP\Files\File;
+use OCP\Files\Folder;
use OCP\Files\IRootFolder;
use OCP\Files\Node;
use OCP\Files\NotFoundException;
@@ -153,7 +153,7 @@ class Manager implements IManager {
throw new \RuntimeException('No creator found');
}
- public function open(string $filePath, string $editorId = null, ?int $fileId = null): string {
+ public function open(string $filePath, ?string $editorId = null, ?int $fileId = null): string {
$userFolder = $this->rootFolder->getUserFolder($this->userId);
$file = $userFolder->get($filePath);
if ($fileId !== null && $file instanceof Folder) {
@@ -279,7 +279,7 @@ class Manager implements IManager {
$this->userSession->setUser(null);
}
- public function createToken($editorId, File $file, string $filePath, IShare $share = null): string {
+ public function createToken($editorId, File $file, string $filePath, ?IShare $share = null): string {
$token = $this->random->generate(64, ISecureRandom::CHAR_HUMAN_READABLE);
$query = $this->connection->getQueryBuilder();
$query->insert(self::TABLE_TOKENS)
diff --git a/lib/private/Encryption/Util.php b/lib/private/Encryption/Util.php
index bd27d71c40e..e776984ae4f 100644
--- a/lib/private/Encryption/Util.php
+++ b/lib/private/Encryption/Util.php
@@ -105,7 +105,7 @@ class Util {
* @return string
* @throws ModuleDoesNotExistsException
*/
- public function getEncryptionModuleId(array $header = null) {
+ public function getEncryptionModuleId(?array $header = null) {
$id = '';
$encryptionModuleKey = self::HEADER_ENCRYPTION_MODULE_KEY;
diff --git a/lib/private/Files/Cache/Cache.php b/lib/private/Files/Cache/Cache.php
index 5df4002530f..8f0f962a3b7 100644
--- a/lib/private/Files/Cache/Cache.php
+++ b/lib/private/Files/Cache/Cache.php
@@ -99,7 +99,7 @@ class Cache implements ICache {
private IStorage $storage,
// this constructor is used in to many pleases to easily do proper di
// so instead we group it all together
- CacheDependencies $dependencies = null,
+ ?CacheDependencies $dependencies = null,
) {
$this->storageId = $storage->getId();
if (strlen($this->storageId) > 64) {
diff --git a/lib/private/Files/Cache/CacheQueryBuilder.php b/lib/private/Files/Cache/CacheQueryBuilder.php
index 365d28fc8c5..d80375e94ee 100644
--- a/lib/private/Files/Cache/CacheQueryBuilder.php
+++ b/lib/private/Files/Cache/CacheQueryBuilder.php
@@ -68,7 +68,7 @@ class CacheQueryBuilder extends QueryBuilder {
return $this;
}
- public function selectFileCache(string $alias = null, bool $joinExtendedCache = true) {
+ public function selectFileCache(?string $alias = null, bool $joinExtendedCache = true) {
$name = $alias ?: 'filecache';
$this->select("$name.fileid", 'storage', 'path', 'path_hash', "$name.parent", "$name.name", 'mimetype', 'mimepart', 'size', 'mtime',
'storage_mtime', 'encrypted', 'etag', "$name.permissions", 'checksum', 'unencrypted_size')
diff --git a/lib/private/Files/Cache/Wrapper/CacheJail.php b/lib/private/Files/Cache/Wrapper/CacheJail.php
index f9754e433df..e8d5fcb490a 100644
--- a/lib/private/Files/Cache/Wrapper/CacheJail.php
+++ b/lib/private/Files/Cache/Wrapper/CacheJail.php
@@ -50,7 +50,7 @@ class CacheJail extends CacheWrapper {
public function __construct(
?ICache $cache,
string $root,
- CacheDependencies $dependencies = null,
+ ?CacheDependencies $dependencies = null,
) {
parent::__construct($cache, $dependencies);
$this->root = $root;
@@ -88,7 +88,7 @@ class CacheJail extends CacheWrapper {
* @param null|string $root
* @return null|string the jailed path or null if the path is outside the jail
*/
- protected function getJailedPath(string $path, string $root = null) {
+ protected function getJailedPath(string $path, ?string $root = null) {
if ($root === null) {
$root = $this->getRoot();
}
diff --git a/lib/private/Files/Cache/Wrapper/CacheWrapper.php b/lib/private/Files/Cache/Wrapper/CacheWrapper.php
index 31410eea798..1662c76a6b8 100644
--- a/lib/private/Files/Cache/Wrapper/CacheWrapper.php
+++ b/lib/private/Files/Cache/Wrapper/CacheWrapper.php
@@ -43,7 +43,7 @@ class CacheWrapper extends Cache {
*/
protected $cache;
- public function __construct(?ICache $cache, CacheDependencies $dependencies = null) {
+ public function __construct(?ICache $cache, ?CacheDependencies $dependencies = null) {
$this->cache = $cache;
if (!$dependencies && $cache instanceof Cache) {
$this->mimetypeLoader = $cache->mimetypeLoader;
diff --git a/lib/private/Files/Config/CachedMountInfo.php b/lib/private/Files/Config/CachedMountInfo.php
index 19fa87aa090..3e7187a5114 100644
--- a/lib/private/Files/Config/CachedMountInfo.php
+++ b/lib/private/Files/Config/CachedMountInfo.php
@@ -53,7 +53,7 @@ class CachedMountInfo implements ICachedMountInfo {
int $rootId,
string $mountPoint,
string $mountProvider,
- int $mountId = null,
+ ?int $mountId = null,
string $rootInternalPath = ''
) {
$this->user = $user;
diff --git a/lib/private/Files/Config/LazyPathCachedMountInfo.php b/lib/private/Files/Config/LazyPathCachedMountInfo.php
index d42052c5f83..722aec60b3f 100644
--- a/lib/private/Files/Config/LazyPathCachedMountInfo.php
+++ b/lib/private/Files/Config/LazyPathCachedMountInfo.php
@@ -47,7 +47,7 @@ class LazyPathCachedMountInfo extends CachedMountInfo {
int $rootId,
string $mountPoint,
string $mountProvider,
- int $mountId = null,
+ ?int $mountId = null,
callable $rootInternalPathCallback,
) {
parent::__construct($user, $storageId, $rootId, $mountPoint, $mountProvider, $mountId, self::PATH_PLACEHOLDER);
diff --git a/lib/private/Files/Config/MountProviderCollection.php b/lib/private/Files/Config/MountProviderCollection.php
index d251199fd43..fcc151eeda0 100644
--- a/lib/private/Files/Config/MountProviderCollection.php
+++ b/lib/private/Files/Config/MountProviderCollection.php
@@ -119,7 +119,7 @@ class MountProviderCollection implements IMountProviderCollection, Emitter {
return $this->getUserMountsForProviders($user, $providers);
}
- public function addMountForUser(IUser $user, IMountManager $mountManager, callable $providerFilter = null) {
+ public function addMountForUser(IUser $user, IMountManager $mountManager, ?callable $providerFilter = null) {
// shared mount provider gets to go last since it needs to know existing files
// to check for name collisions
$firstMounts = [];
diff --git a/lib/private/Files/Config/UserMountCache.php b/lib/private/Files/Config/UserMountCache.php
index 8275eee7b9f..b5b07d8f29e 100644
--- a/lib/private/Files/Config/UserMountCache.php
+++ b/lib/private/Files/Config/UserMountCache.php
@@ -81,7 +81,7 @@ class UserMountCache implements IUserMountCache {
$this->mountsForUsers = new CappedMemoryCache();
}
- public function registerMounts(IUser $user, array $mounts, array $mountProviderClasses = null) {
+ public function registerMounts(IUser $user, array $mounts, ?array $mountProviderClasses = null) {
$this->eventLogger->start('fs:setup:user:register', 'Registering mounts for user');
/** @var array<string, ICachedMountInfo> $newMounts */
$newMounts = [];
diff --git a/lib/private/Files/Mount/HomeMountPoint.php b/lib/private/Files/Mount/HomeMountPoint.php
index 0bec12af5c2..25a877ce644 100644
--- a/lib/private/Files/Mount/HomeMountPoint.php
+++ b/lib/private/Files/Mount/HomeMountPoint.php
@@ -33,11 +33,11 @@ class HomeMountPoint extends MountPoint {
IUser $user,
$storage,
string $mountpoint,
- array $arguments = null,
- IStorageFactory $loader = null,
- array $mountOptions = null,
- int $mountId = null,
- string $mountProvider = null
+ ?array $arguments = null,
+ ?IStorageFactory $loader = null,
+ ?array $mountOptions = null,
+ ?int $mountId = null,
+ ?string $mountProvider = null
) {
parent::__construct($storage, $mountpoint, $arguments, $loader, $mountOptions, $mountId, $mountProvider);
$this->user = $user;
diff --git a/lib/private/Files/Mount/MountPoint.php b/lib/private/Files/Mount/MountPoint.php
index fe6358b32f1..e9a4c5c8a4f 100644
--- a/lib/private/Files/Mount/MountPoint.php
+++ b/lib/private/Files/Mount/MountPoint.php
@@ -94,11 +94,11 @@ class MountPoint implements IMountPoint {
public function __construct(
$storage,
string $mountpoint,
- array $arguments = null,
- IStorageFactory $loader = null,
- array $mountOptions = null,
- int $mountId = null,
- string $mountProvider = null
+ ?array $arguments = null,
+ ?IStorageFactory $loader = null,
+ ?array $mountOptions = null,
+ ?int $mountId = null,
+ ?string $mountProvider = null
) {
if (is_null($arguments)) {
$arguments = [];
diff --git a/lib/private/Files/Node/Folder.php b/lib/private/Files/Node/Folder.php
index 014b66fdf63..52e7b55676a 100644
--- a/lib/private/Files/Node/Folder.php
+++ b/lib/private/Files/Node/Folder.php
@@ -199,7 +199,7 @@ class Folder extends Node implements \OCP\Files\Folder {
throw new NotPermittedException('No create permission for path "' . $path . '"');
}
- private function queryFromOperator(ISearchOperator $operator, string $uid = null, int $limit = 0, int $offset = 0): ISearchQuery {
+ private function queryFromOperator(ISearchOperator $operator, ?string $uid = null, int $limit = 0, int $offset = 0): ISearchQuery {
if ($uid === null) {
$user = null;
} else {
diff --git a/lib/private/Files/Node/LazyFolder.php b/lib/private/Files/Node/LazyFolder.php
index 4aae5cf9804..08e77d7f705 100644
--- a/lib/private/Files/Node/LazyFolder.php
+++ b/lib/private/Files/Node/LazyFolder.php
@@ -101,7 +101,7 @@ class LazyFolder implements Folder {
/**
* @inheritDoc
*/
- public function removeListener($scope = null, $method = null, callable $callback = null) {
+ public function removeListener($scope = null, $method = null, ?callable $callback = null) {
$this->__call(__FUNCTION__, func_get_args());
}
diff --git a/lib/private/Files/Node/Node.php b/lib/private/Files/Node/Node.php
index acd91c56d3f..9f1a1e357e9 100644
--- a/lib/private/Files/Node/Node.php
+++ b/lib/private/Files/Node/Node.php
@@ -124,7 +124,7 @@ class Node implements INode {
/**
* @param string[] $hooks
*/
- protected function sendHooks($hooks, array $args = null) {
+ protected function sendHooks($hooks, ?array $args = null) {
$args = !empty($args) ? $args : [$this];
/** @var IEventDispatcher $dispatcher */
$dispatcher = \OC::$server->get(IEventDispatcher::class);
diff --git a/lib/private/Files/Node/Root.php b/lib/private/Files/Node/Root.php
index 71bc7a6da6b..7c3ff1d2867 100644
--- a/lib/private/Files/Node/Root.php
+++ b/lib/private/Files/Node/Root.php
@@ -137,7 +137,7 @@ class Root extends Folder implements IRootFolder {
* @param string $method optional
* @param callable $callback optional
*/
- public function removeListener($scope = null, $method = null, callable $callback = null) {
+ public function removeListener($scope = null, $method = null, ?callable $callback = null) {
$this->emitter->removeListener($scope, $method, $callback);
}
diff --git a/lib/private/Files/ObjectStore/Azure.php b/lib/private/Files/ObjectStore/Azure.php
index 553f593b299..c4a349294ec 100644
--- a/lib/private/Files/ObjectStore/Azure.php
+++ b/lib/private/Files/ObjectStore/Azure.php
@@ -100,7 +100,7 @@ class Azure implements IObjectStore {
return $blob->getContentStream();
}
- public function writeObject($urn, $stream, string $mimetype = null) {
+ public function writeObject($urn, $stream, ?string $mimetype = null) {
$options = new CreateBlockBlobOptions();
if ($mimetype) {
$options->setContentType($mimetype);
diff --git a/lib/private/Files/ObjectStore/ObjectStoreStorage.php b/lib/private/Files/ObjectStore/ObjectStoreStorage.php
index 7eb284fc774..ef4d2f7ca13 100644
--- a/lib/private/Files/ObjectStore/ObjectStoreStorage.php
+++ b/lib/private/Files/ObjectStore/ObjectStoreStorage.php
@@ -494,7 +494,7 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common implements IChunkedFil
return $result;
}
- public function writeStream(string $path, $stream, int $size = null): int {
+ public function writeStream(string $path, $stream, ?int $size = null): int {
$stat = $this->stat($path);
if (empty($stat)) {
// create new file
diff --git a/lib/private/Files/ObjectStore/S3ObjectTrait.php b/lib/private/Files/ObjectStore/S3ObjectTrait.php
index e0a94df1d99..b7ec047850b 100644
--- a/lib/private/Files/ObjectStore/S3ObjectTrait.php
+++ b/lib/private/Files/ObjectStore/S3ObjectTrait.php
@@ -106,7 +106,7 @@ trait S3ObjectTrait {
* @param string|null $mimetype the mimetype to set for the remove object @since 22.0.0
* @throws \Exception when something goes wrong, message will be logged
*/
- protected function writeSingle(string $urn, StreamInterface $stream, string $mimetype = null): void {
+ protected function writeSingle(string $urn, StreamInterface $stream, ?string $mimetype = null): void {
$this->getConnection()->putObject([
'Bucket' => $this->bucket,
'Key' => $urn,
@@ -126,7 +126,7 @@ trait S3ObjectTrait {
* @param string|null $mimetype the mimetype to set for the remove object
* @throws \Exception when something goes wrong, message will be logged
*/
- protected function writeMultiPart(string $urn, StreamInterface $stream, string $mimetype = null): void {
+ protected function writeMultiPart(string $urn, StreamInterface $stream, ?string $mimetype = null): void {
$uploader = new MultipartUploader($this->getConnection(), $stream, [
'bucket' => $this->bucket,
'concurrency' => $this->concurrency,
@@ -159,7 +159,7 @@ trait S3ObjectTrait {
* @throws \Exception when something goes wrong, message will be logged
* @since 7.0.0
*/
- public function writeObject($urn, $stream, string $mimetype = null) {
+ public function writeObject($urn, $stream, ?string $mimetype = null) {
$psrStream = Utils::streamFor($stream);
// ($psrStream->isSeekable() && $psrStream->getSize() !== null) evaluates to true for a On-Seekable stream
diff --git a/lib/private/Files/ObjectStore/StorageObjectStore.php b/lib/private/Files/ObjectStore/StorageObjectStore.php
index 85926be897e..d968adb3c29 100644
--- a/lib/private/Files/ObjectStore/StorageObjectStore.php
+++ b/lib/private/Files/ObjectStore/StorageObjectStore.php
@@ -64,7 +64,7 @@ class StorageObjectStore implements IObjectStore {
throw new \Exception();
}
- public function writeObject($urn, $stream, string $mimetype = null) {
+ public function writeObject($urn, $stream, ?string $mimetype = null) {
$handle = $this->storage->fopen($urn, 'w');
if ($handle) {
stream_copy_to_stream($stream, $handle);
diff --git a/lib/private/Files/ObjectStore/Swift.php b/lib/private/Files/ObjectStore/Swift.php
index b463cb9d44d..68618f136b2 100644
--- a/lib/private/Files/ObjectStore/Swift.php
+++ b/lib/private/Files/ObjectStore/Swift.php
@@ -45,7 +45,7 @@ class Swift implements IObjectStore {
/** @var SwiftFactory */
private $swiftFactory;
- public function __construct($params, SwiftFactory $connectionFactory = null) {
+ public function __construct($params, ?SwiftFactory $connectionFactory = null) {
$this->swiftFactory = $connectionFactory ?: new SwiftFactory(
\OC::$server->getMemCacheFactory()->createDistributed('swift::'),
$params,
@@ -74,7 +74,7 @@ class Swift implements IObjectStore {
return $this->params['container'];
}
- public function writeObject($urn, $stream, string $mimetype = null) {
+ public function writeObject($urn, $stream, ?string $mimetype = null) {
$tmpFile = \OC::$server->getTempManager()->getTemporaryFile('swiftwrite');
file_put_contents($tmpFile, $stream);
$handle = fopen($tmpFile, 'rb');
diff --git a/lib/private/Files/Storage/Common.php b/lib/private/Files/Storage/Common.php
index 0d4e8d29295..c236541390f 100644
--- a/lib/private/Files/Storage/Common.php
+++ b/lib/private/Files/Storage/Common.php
@@ -882,7 +882,7 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage {
* @param int $size
* @return int
*/
- public function writeStream(string $path, $stream, int $size = null): int {
+ public function writeStream(string $path, $stream, ?int $size = null): int {
$target = $this->fopen($path, 'w');
if (!$target) {
throw new GenericFileException("Failed to open $path for writing");
diff --git a/lib/private/Files/Storage/Local.php b/lib/private/Files/Storage/Local.php
index c49cf91dc91..909b124ff64 100644
--- a/lib/private/Files/Storage/Local.php
+++ b/lib/private/Files/Storage/Local.php
@@ -642,7 +642,7 @@ class Local extends \OC\Files\Storage\Common {
}
}
- public function writeStream(string $path, $stream, int $size = null): int {
+ public function writeStream(string $path, $stream, ?int $size = null): int {
/** @var int|false $result We consider here that returned size will never be a float because we write less than 4GB */
$result = $this->file_put_contents($path, $stream);
if (is_resource($stream)) {
diff --git a/lib/private/Files/Storage/Wrapper/Encryption.php b/lib/private/Files/Storage/Wrapper/Encryption.php
index 7ce4338256f..e68e1f65048 100644
--- a/lib/private/Files/Storage/Wrapper/Encryption.php
+++ b/lib/private/Files/Storage/Wrapper/Encryption.php
@@ -107,15 +107,15 @@ class Encryption extends Wrapper {
*/
public function __construct(
$parameters,
- IManager $encryptionManager = null,
- Util $util = null,
- LoggerInterface $logger = null,
- IFile $fileHelper = null,
+ ?IManager $encryptionManager = null,
+ ?Util $util = null,
+ ?LoggerInterface $logger = null,
+ ?IFile $fileHelper = null,
$uid = null,
- IStorage $keyStorage = null,
- Update $update = null,
- Manager $mountManager = null,
- ArrayCache $arrayCache = null
+ ?IStorage $keyStorage = null,
+ ?Update $update = null,
+ ?Manager $mountManager = null,
+ ?ArrayCache $arrayCache = null
) {
$this->mountPoint = $parameters['mountPoint'];
$this->mount = $parameters['mount'];
@@ -1062,7 +1062,7 @@ class Encryption extends Wrapper {
return $encryptionModule->shouldEncrypt($fullPath);
}
- public function writeStream(string $path, $stream, int $size = null): int {
+ public function writeStream(string $path, $stream, ?int $size = null): int {
// always fall back to fopen
$target = $this->fopen($path, 'w');
[$count, $result] = \OC_Helper::streamCopy($stream, $target);
diff --git a/lib/private/Files/Storage/Wrapper/Jail.php b/lib/private/Files/Storage/Wrapper/Jail.php
index 592acd418ec..6c185112b23 100644
--- a/lib/private/Files/Storage/Wrapper/Jail.php
+++ b/lib/private/Files/Storage/Wrapper/Jail.php
@@ -514,7 +514,7 @@ class Jail extends Wrapper {
return $this->propagator;
}
- public function writeStream(string $path, $stream, int $size = null): int {
+ public function writeStream(string $path, $stream, ?int $size = null): int {
$storage = $this->getWrapperStorage();
if ($storage->instanceOfStorage(IWriteStreamStorage::class)) {
/** @var IWriteStreamStorage $storage */
diff --git a/lib/private/Files/Storage/Wrapper/KnownMtime.php b/lib/private/Files/Storage/Wrapper/KnownMtime.php
index dde209c44ab..9a71dc90367 100644
--- a/lib/private/Files/Storage/Wrapper/KnownMtime.php
+++ b/lib/private/Files/Storage/Wrapper/KnownMtime.php
@@ -132,7 +132,7 @@ class KnownMtime extends Wrapper {
return $result;
}
- public function writeStream(string $path, $stream, int $size = null): int {
+ public function writeStream(string $path, $stream, ?int $size = null): int {
$result = parent::writeStream($path, $stream, $size);
if ($result) {
$this->knowMtimes->set($path, $this->clock->now()->getTimestamp());
diff --git a/lib/private/Files/Storage/Wrapper/Wrapper.php b/lib/private/Files/Storage/Wrapper/Wrapper.php
index 2c50bbdb11f..2e96733ec66 100644
--- a/lib/private/Files/Storage/Wrapper/Wrapper.php
+++ b/lib/private/Files/Storage/Wrapper/Wrapper.php
@@ -646,7 +646,7 @@ class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage, IWriteStrea
return $this->getWrapperStorage()->needsPartFile();
}
- public function writeStream(string $path, $stream, int $size = null): int {
+ public function writeStream(string $path, $stream, ?int $size = null): int {
$storage = $this->getWrapperStorage();
if ($storage->instanceOfStorage(IWriteStreamStorage::class)) {
/** @var IWriteStreamStorage $storage */
diff --git a/lib/private/Files/Stream/Encryption.php b/lib/private/Files/Stream/Encryption.php
index c57991f35a9..895126653f7 100644
--- a/lib/private/Files/Stream/Encryption.php
+++ b/lib/private/Files/Stream/Encryption.php
@@ -321,7 +321,7 @@ class Encryption extends Wrapper {
$result .= substr($this->cache, $blockPosition, $remainingLength);
$this->position += $remainingLength;
$count = 0;
- // otherwise remainder of current block is fetched, the block is flushed and the position updated
+ // otherwise remainder of current block is fetched, the block is flushed and the position updated
} else {
$result .= substr($this->cache, $blockPosition);
$this->flush();
@@ -389,8 +389,8 @@ class Encryption extends Wrapper {
$this->position += $remainingLength;
$length += $remainingLength;
$data = '';
- // if $data doesn't fit the current block, the fill the current block and reiterate
- // after the block is filled, it is flushed and $data is updatedxxx
+ // if $data doesn't fit the current block, the fill the current block and reiterate
+ // after the block is filled, it is flushed and $data is updatedxxx
} else {
$this->cache = substr($this->cache, 0, $blockPosition) .
substr($data, 0, $this->unencryptedBlockSize - $blockPosition);
diff --git a/lib/private/Files/Template/TemplateManager.php b/lib/private/Files/Template/TemplateManager.php
index 9d9f6416208..3f3c36de5f1 100644
--- a/lib/private/Files/Template/TemplateManager.php
+++ b/lib/private/Files/Template/TemplateManager.php
@@ -262,7 +262,7 @@ class TemplateManager implements ITemplateManager {
return $this->config->getUserValue($this->userId, 'core', 'templateDirectory', '');
}
- public function initializeTemplateDirectory(string $path = null, string $userId = null, $copyTemplates = true): string {
+ public function initializeTemplateDirectory(?string $path = null, ?string $userId = null, $copyTemplates = true): string {
if ($userId !== null) {
$this->userId = $userId;
}
diff --git a/lib/private/Files/Utils/Scanner.php b/lib/private/Files/Utils/Scanner.php
index ae6a0a33d2b..997d6e1a34e 100644
--- a/lib/private/Files/Utils/Scanner.php
+++ b/lib/private/Files/Utils/Scanner.php
@@ -198,7 +198,7 @@ class Scanner extends PublicEmitter {
* @throws ForbiddenException
* @throws NotFoundException
*/
- public function scan($dir = '', $recursive = \OC\Files\Cache\Scanner::SCAN_RECURSIVE, callable $mountFilter = null) {
+ public function scan($dir = '', $recursive = \OC\Files\Cache\Scanner::SCAN_RECURSIVE, ?callable $mountFilter = null) {
if (!Filesystem::isValidPath($dir)) {
throw new \InvalidArgumentException('Invalid path to scan');
}
diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php
index 5ad48e26cc5..98b597dbd4d 100644
--- a/lib/private/Files/View.php
+++ b/lib/private/Files/View.php
@@ -802,14 +802,14 @@ class View {
} else {
$result = false;
}
- // moving a file/folder within the same mount point
+ // moving a file/folder within the same mount point
} elseif ($storage1 === $storage2) {
if ($storage1) {
$result = $storage1->rename($internalPath1, $internalPath2);
} else {
$result = false;
}
- // moving a file/folder between storages (from $storage1 to $storage2)
+ // moving a file/folder between storages (from $storage1 to $storage2)
} else {
$result = $storage2->moveFromStorage($storage1, $internalPath1, $internalPath2);
}
@@ -1428,7 +1428,7 @@ class View {
* @param string $mimetype_filter limit returned content to this mimetype or mimepart
* @return FileInfo[]
*/
- public function getDirectoryContent($directory, $mimetype_filter = '', \OCP\Files\FileInfo $directoryInfo = null) {
+ public function getDirectoryContent($directory, $mimetype_filter = '', ?\OCP\Files\FileInfo $directoryInfo = null) {
$this->assertPathLength($directory);
if (!Filesystem::isValidPath($directory)) {
return [];
@@ -1733,7 +1733,7 @@ class View {
* @return string
* @throws NotFoundException
*/
- public function getPath($id, int $storageId = null) {
+ public function getPath($id, ?int $storageId = null) {
$id = (int)$id;
$manager = Filesystem::getMountManager();
$mounts = $manager->findIn($this->fakeRoot);
diff --git a/lib/private/FilesMetadata/FilesMetadataManager.php b/lib/private/FilesMetadata/FilesMetadataManager.php
index 9bfa8ae49d6..a684b870637 100644
--- a/lib/private/FilesMetadata/FilesMetadataManager.php
+++ b/lib/private/FilesMetadata/FilesMetadataManager.php
@@ -257,7 +257,7 @@ class FilesMetadataManager implements IFilesMetadataManager {
* @since 28.0.0
*/
public function getKnownMetadata(): IFilesMetadata {
- if (null !== $this->all) {
+ if ($this->all !== null) {
return $this->all;
}
$this->all = new FilesMetadata();
diff --git a/lib/private/FilesMetadata/Model/MetadataValueWrapper.php b/lib/private/FilesMetadata/Model/MetadataValueWrapper.php
index 70dec89650a..be38b234be3 100644
--- a/lib/private/FilesMetadata/Model/MetadataValueWrapper.php
+++ b/lib/private/FilesMetadata/Model/MetadataValueWrapper.php
@@ -234,7 +234,7 @@ class MetadataValueWrapper implements IMetadataValueWrapper {
*/
public function getValueString(): string {
$this->assertType(self::TYPE_STRING);
- if (null === $this->value) {
+ if ($this->value === null) {
throw new FilesMetadataNotFoundException('value is not set');
}
@@ -250,7 +250,7 @@ class MetadataValueWrapper implements IMetadataValueWrapper {
*/
public function getValueInt(): int {
$this->assertType(self::TYPE_INT);
- if (null === $this->value) {
+ if ($this->value === null) {
throw new FilesMetadataNotFoundException('value is not set');
}
@@ -266,7 +266,7 @@ class MetadataValueWrapper implements IMetadataValueWrapper {
*/
public function getValueFloat(): float {
$this->assertType(self::TYPE_FLOAT);
- if (null === $this->value) {
+ if ($this->value === null) {
throw new FilesMetadataNotFoundException('value is not set');
}
@@ -282,7 +282,7 @@ class MetadataValueWrapper implements IMetadataValueWrapper {
*/
public function getValueBool(): bool {
$this->assertType(self::TYPE_BOOL);
- if (null === $this->value) {
+ if ($this->value === null) {
throw new FilesMetadataNotFoundException('value is not set');
}
@@ -298,7 +298,7 @@ class MetadataValueWrapper implements IMetadataValueWrapper {
*/
public function getValueArray(): array {
$this->assertType(self::TYPE_ARRAY);
- if (null === $this->value) {
+ if ($this->value === null) {
throw new FilesMetadataNotFoundException('value is not set');
}
@@ -314,7 +314,7 @@ class MetadataValueWrapper implements IMetadataValueWrapper {
*/
public function getValueStringList(): array {
$this->assertType(self::TYPE_STRING_LIST);
- if (null === $this->value) {
+ if ($this->value === null) {
throw new FilesMetadataNotFoundException('value is not set');
}
@@ -330,7 +330,7 @@ class MetadataValueWrapper implements IMetadataValueWrapper {
*/
public function getValueIntList(): array {
$this->assertType(self::TYPE_INT_LIST);
- if (null === $this->value) {
+ if ($this->value === null) {
throw new FilesMetadataNotFoundException('value is not set');
}
@@ -344,7 +344,7 @@ class MetadataValueWrapper implements IMetadataValueWrapper {
* @since 28.0.0
*/
public function getValueAny(): mixed {
- if (null === $this->value) {
+ if ($this->value === null) {
throw new FilesMetadataNotFoundException('value is not set');
}
diff --git a/lib/private/Group/Database.php b/lib/private/Group/Database.php
index 13837eef552..c4915eefeae 100644
--- a/lib/private/Group/Database.php
+++ b/lib/private/Group/Database.php
@@ -73,7 +73,7 @@ class Database extends ABackend implements
*
* @param IDBConnection|null $dbConn
*/
- public function __construct(IDBConnection $dbConn = null) {
+ public function __construct(?IDBConnection $dbConn = null) {
$this->dbConn = $dbConn;
}
diff --git a/lib/private/Group/Group.php b/lib/private/Group/Group.php
index 57289a4d3ac..d43a10b6a5c 100644
--- a/lib/private/Group/Group.php
+++ b/lib/private/Group/Group.php
@@ -76,7 +76,7 @@ class Group implements IGroup {
/** @var PublicEmitter */
private $emitter;
- public function __construct(string $gid, array $backends, IEventDispatcher $dispatcher, IUserManager $userManager, PublicEmitter $emitter = null, ?string $displayName = null) {
+ public function __construct(string $gid, array $backends, IEventDispatcher $dispatcher, IUserManager $userManager, ?PublicEmitter $emitter = null, ?string $displayName = null) {
$this->gid = $gid;
$this->backends = $backends;
$this->dispatcher = $dispatcher;
@@ -302,7 +302,7 @@ class Group implements IGroup {
* @return IUser[]
* @deprecated 27.0.0 Use searchUsers instead (same implementation)
*/
- public function searchDisplayName(string $search, int $limit = null, int $offset = null): array {
+ public function searchDisplayName(string $search, ?int $limit = null, ?int $offset = null): array {
return $this->searchUsers($search, $limit, $offset);
}
diff --git a/lib/private/Group/Manager.php b/lib/private/Group/Manager.php
index dafbe4295a4..2b6eb70502b 100644
--- a/lib/private/Group/Manager.php
+++ b/lib/private/Group/Manager.php
@@ -323,7 +323,7 @@ class Manager extends PublicEmitter implements IGroupManager {
* @param IUser|null $user
* @return \OC\Group\Group[]
*/
- public function getUserGroups(IUser $user = null) {
+ public function getUserGroups(?IUser $user = null) {
if (!$user instanceof IUser) {
return [];
}
diff --git a/lib/private/Hooks/Emitter.php b/lib/private/Hooks/Emitter.php
index bc5af2b60a2..f3ed1f42296 100644
--- a/lib/private/Hooks/Emitter.php
+++ b/lib/private/Hooks/Emitter.php
@@ -49,5 +49,5 @@ interface Emitter {
* @return void
* @deprecated 18.0.0 use \OCP\EventDispatcher\IEventDispatcher::removeListener
*/
- public function removeListener($scope = null, $method = null, callable $callback = null);
+ public function removeListener($scope = null, $method = null, ?callable $callback = null);
}
diff --git a/lib/private/Hooks/EmitterTrait.php b/lib/private/Hooks/EmitterTrait.php
index fe9cba893de..6b084d77533 100644
--- a/lib/private/Hooks/EmitterTrait.php
+++ b/lib/private/Hooks/EmitterTrait.php
@@ -54,7 +54,7 @@ trait EmitterTrait {
* @param callable $callback optional
* @deprecated 18.0.0 use \OCP\EventDispatcher\IEventDispatcher::removeListener
*/
- public function removeListener($scope = null, $method = null, callable $callback = null) {
+ public function removeListener($scope = null, $method = null, ?callable $callback = null) {
$names = [];
$allNames = array_keys($this->listeners);
if ($scope and $method) {
diff --git a/lib/private/L10N/Factory.php b/lib/private/L10N/Factory.php
index 6de620e7ec7..a9717b679ed 100644
--- a/lib/private/L10N/Factory.php
+++ b/lib/private/L10N/Factory.php
@@ -233,7 +233,7 @@ class Factory implements IFactory {
return 'en';
}
- public function findGenericLanguage(string $appId = null): string {
+ public function findGenericLanguage(?string $appId = null): string {
// Step 1: Forced language always has precedence over anything else
$forcedLanguage = $this->config->getSystemValue('force_language', false);
if ($forcedLanguage !== false) {
@@ -283,9 +283,9 @@ class Factory implements IFactory {
}
if ($this->config->getSystemValueBool('installed', false)) {
- $userId = null !== $this->userSession->getUser() ? $this->userSession->getUser()->getUID() : null;
+ $userId = $this->userSession->getUser() !== null ? $this->userSession->getUser()->getUID() : null;
$userLocale = null;
- if (null !== $userId) {
+ if ($userId !== null) {
$userLocale = $this->config->getUserValue($userId, 'core', 'locale', null);
}
} else {
@@ -304,7 +304,7 @@ class Factory implements IFactory {
}
// If no user locale set, use lang as locale
- if (null !== $lang && $this->localeExists($lang)) {
+ if ($lang !== null && $this->localeExists($lang)) {
return $lang;
}
@@ -319,7 +319,7 @@ class Factory implements IFactory {
* @param string $locale
* @return null|string
*/
- public function findLanguageFromLocale(string $app = 'core', string $locale = null) {
+ public function findLanguageFromLocale(string $app = 'core', ?string $locale = null) {
if ($this->languageExists($app, $locale)) {
return $locale;
}
@@ -415,7 +415,7 @@ class Factory implements IFactory {
return in_array($lang, $languages);
}
- public function getLanguageIterator(IUser $user = null): ILanguageIterator {
+ public function getLanguageIterator(?IUser $user = null): ILanguageIterator {
$user = $user ?? $this->userSession->getUser();
if ($user === null) {
throw new \RuntimeException('Failed to get an IUser instance');
@@ -430,7 +430,7 @@ class Factory implements IFactory {
* @return string
* @since 20.0.0
*/
- public function getUserLanguage(IUser $user = null): string {
+ public function getUserLanguage(?IUser $user = null): string {
$language = $this->config->getSystemValue('force_language', false);
if ($language !== false) {
return $language;
@@ -495,7 +495,7 @@ class Factory implements IFactory {
if ($preferred_language === strtolower($available_language)) {
return $this->respectDefaultLanguage($app, $available_language);
}
- if ($preferred_language_parts[0].'_'.end($preferred_language_parts) === strtolower($available_language)) {
+ if (strtolower($available_language) === $preferred_language_parts[0].'_'.end($preferred_language_parts)) {
return $available_language;
}
}
diff --git a/lib/private/L10N/L10N.php b/lib/private/L10N/L10N.php
index c44e4f9cf49..b701d059835 100644
--- a/lib/private/L10N/L10N.php
+++ b/lib/private/L10N/L10N.php
@@ -157,7 +157,7 @@ class L10N implements IL10N {
* - jsdate: Returns the short JS date format
*/
public function l(string $type, $data = null, array $options = []) {
- if (null === $this->locale) {
+ if ($this->locale === null) {
// Use the language of the instance
$this->locale = $this->getLanguageCode();
}
diff --git a/lib/private/Lock/MemcacheLockingProvider.php b/lib/private/Lock/MemcacheLockingProvider.php
index b9c3e995460..bc0ea989cbd 100644
--- a/lib/private/Lock/MemcacheLockingProvider.php
+++ b/lib/private/Lock/MemcacheLockingProvider.php
@@ -44,7 +44,7 @@ class MemcacheLockingProvider extends AbstractLockingProvider {
parent::__construct($ttl);
}
- private function setTTL(string $path, int $ttl = null, ?int $compare = null): void {
+ private function setTTL(string $path, ?int $ttl = null, ?int $compare = null): void {
if (is_null($ttl)) {
$ttl = $this->ttl;
}
diff --git a/lib/private/Mail/Message.php b/lib/private/Mail/Message.php
index 15d4da793dd..81b0775cb15 100644
--- a/lib/private/Mail/Message.php
+++ b/lib/private/Mail/Message.php
@@ -73,7 +73,7 @@ class Message implements IMessage {
* {@inheritDoc}
* @since 26.0.0
*/
- public function attachInline(string $body, string $name, string $contentType = null): IMessage {
+ public function attachInline(string $body, string $name, ?string $contentType = null): IMessage {
# To be sure this works with iCalendar messages, we encode with 8bit instead of
# quoted-printable encoding. We save the current encoder, replace the current
# encoder with an 8bit encoder and after we've finished, we reset the encoder
diff --git a/lib/private/Memcache/ProfilerWrapperCache.php b/lib/private/Memcache/ProfilerWrapperCache.php
index 0d991a87ab8..68fa4e7f22c 100644
--- a/lib/private/Memcache/ProfilerWrapperCache.php
+++ b/lib/private/Memcache/ProfilerWrapperCache.php
@@ -216,7 +216,7 @@ class ProfilerWrapperCache extends AbstractDataCollector implements IMemcacheTTL
$this->remove($offset);
}
- public function collect(Request $request, Response $response, \Throwable $exception = null): void {
+ public function collect(Request $request, Response $response, ?\Throwable $exception = null): void {
// Nothing to do here $data is already ready
}
diff --git a/lib/private/Memcache/Redis.php b/lib/private/Memcache/Redis.php
index 97b6d41ea5e..4f86ff68052 100644
--- a/lib/private/Memcache/Redis.php
+++ b/lib/private/Memcache/Redis.php
@@ -218,7 +218,7 @@ class Redis extends Cache implements IMemcacheTTL {
$script = self::LUA_SCRIPTS[$scriptName];
$result = $this->getCache()->evalSha($script[1], $args, count($keys));
- if (false === $result) {
+ if ($result === false) {
$result = $this->getCache()->eval($script[0], $args, count($keys));
}
diff --git a/lib/private/OCS/Result.php b/lib/private/OCS/Result.php
index 567fe8378a9..a09d0c89bf2 100644
--- a/lib/private/OCS/Result.php
+++ b/lib/private/OCS/Result.php
@@ -56,7 +56,7 @@ class Result {
* @param string|null $message
* @param array $headers
*/
- public function __construct(mixed $data = null, int $code = 100, string $message = null, array $headers = []) {
+ public function __construct(mixed $data = null, int $code = 100, ?string $message = null, array $headers = []) {
if ($data === null) {
$this->data = [];
} elseif (!is_array($data)) {
diff --git a/lib/private/Preview/Generator.php b/lib/private/Preview/Generator.php
index 695d4a3357f..ddb68e012b0 100644
--- a/lib/private/Preview/Generator.php
+++ b/lib/private/Preview/Generator.php
@@ -289,7 +289,7 @@ class Generator {
* @return int number of concurrent preview generations, or -1 if $type is invalid
*/
public function getNumConcurrentPreviews(string $type): int {
- static $cached = array();
+ static $cached = [];
if (array_key_exists($type, $cached)) {
return $cached[$type];
}
diff --git a/lib/private/Preview/ProviderV2.php b/lib/private/Preview/ProviderV2.php
index 0cb7eb59e21..6d80594d1c8 100644
--- a/lib/private/Preview/ProviderV2.php
+++ b/lib/private/Preview/ProviderV2.php
@@ -83,7 +83,7 @@ abstract class ProviderV2 implements IProviderV2 {
* @param int $maxSize maximum size for temporary files
* @return string|false
*/
- protected function getLocalFile(File $file, int $maxSize = null) {
+ protected function getLocalFile(File $file, ?int $maxSize = null) {
if ($this->useTempFile($file)) {
$absPath = \OC::$server->getTempManager()->getTemporaryFile();
diff --git a/lib/private/Profiler/FileProfilerStorage.php b/lib/private/Profiler/FileProfilerStorage.php
index d7f3df752a6..79b17d520c6 100644
--- a/lib/private/Profiler/FileProfilerStorage.php
+++ b/lib/private/Profiler/FileProfilerStorage.php
@@ -45,12 +45,12 @@ class FileProfilerStorage {
public function __construct(string $folder) {
$this->folder = $folder;
- if (!is_dir($this->folder) && false === @mkdir($this->folder, 0777, true) && !is_dir($this->folder)) {
+ if (!is_dir($this->folder) && @mkdir($this->folder, 0777, true) === false && !is_dir($this->folder)) {
throw new \RuntimeException(sprintf('Unable to create the storage directory (%s).', $this->folder));
}
}
- public function find(?string $url, ?int $limit, ?string $method, int $start = null, int $end = null, string $statusCode = null): array {
+ public function find(?string $url, ?int $limit, ?string $method, ?int $start = null, ?int $end = null, ?string $statusCode = null): array {
$file = $this->getIndexFilename();
if (!file_exists($file)) {
@@ -130,7 +130,7 @@ class FileProfilerStorage {
if (!$profileIndexed) {
// Create directory
$dir = \dirname($file);
- if (!is_dir($dir) && false === @mkdir($dir, 0777, true) && !is_dir($dir)) {
+ if (!is_dir($dir) && @mkdir($dir, 0777, true) === false && !is_dir($dir)) {
throw new \RuntimeException(sprintf('Unable to create the storage directory (%s).', $dir));
}
}
@@ -162,7 +162,7 @@ class FileProfilerStorage {
stream_context_set_option($context, 'zlib', 'level', 3);
}
- if (false === file_put_contents($file, serialize($data), 0, $context)) {
+ if (file_put_contents($file, serialize($data), 0, $context) === false) {
return false;
}
@@ -221,7 +221,7 @@ class FileProfilerStorage {
$line = '';
$position = ftell($file);
- if (0 === $position) {
+ if ($position === 0) {
return null;
}
@@ -230,7 +230,7 @@ class FileProfilerStorage {
$position -= $chunkSize;
fseek($file, $position);
- if (0 === $chunkSize) {
+ if ($chunkSize === 0) {
// bof reached
break;
}
@@ -246,15 +246,15 @@ class FileProfilerStorage {
$line = substr($buffer, $upTo + 1).$line;
fseek($file, max(0, $position), \SEEK_SET);
- if ('' !== $line) {
+ if ($line !== '') {
break;
}
}
- return '' === $line ? null : $line;
+ return $line === '' ? null : $line;
}
- protected function createProfileFromData(string $token, array $data, IProfile $parent = null): IProfile {
+ protected function createProfileFromData(string $token, array $data, ?IProfile $parent = null): IProfile {
$profile = new Profile($token);
$profile->setMethod($data['method']);
$profile->setUrl($data['url']);
diff --git a/lib/private/Profiler/Profiler.php b/lib/private/Profiler/Profiler.php
index 9cbf703c79b..10cae8a96a9 100644
--- a/lib/private/Profiler/Profiler.php
+++ b/lib/private/Profiler/Profiler.php
@@ -95,7 +95,7 @@ class Profiler implements IProfiler {
* @return array[]
*/
public function find(?string $url, ?int $limit, ?string $method, ?int $start, ?int $end,
- string $statusCode = null): array {
+ ?string $statusCode = null): array {
if ($this->storage) {
return $this->storage->find($url, $limit, $method, $start, $end, $statusCode);
} else {
diff --git a/lib/private/Profiler/RoutingDataCollector.php b/lib/private/Profiler/RoutingDataCollector.php
index e6659230879..8769615a37b 100644
--- a/lib/private/Profiler/RoutingDataCollector.php
+++ b/lib/private/Profiler/RoutingDataCollector.php
@@ -41,7 +41,7 @@ class RoutingDataCollector extends AbstractDataCollector {
$this->actionName = $actionName;
}
- public function collect(Request $request, Response $response, \Throwable $exception = null): void {
+ public function collect(Request $request, Response $response, ?\Throwable $exception = null): void {
$this->data = [
'appName' => $this->appName,
'controllerName' => $this->controllerName,
diff --git a/lib/private/Route/Router.php b/lib/private/Route/Router.php
index e7e2a9f0e49..28a25b4addf 100644
--- a/lib/private/Route/Router.php
+++ b/lib/private/Route/Router.php
@@ -361,7 +361,7 @@ class Router implements IRouter {
*
*/
public function getGenerator() {
- if (null !== $this->generator) {
+ if ($this->generator !== null) {
return $this->generator;
}
diff --git a/lib/private/Search/Provider/File.php b/lib/private/Search/Provider/File.php
index 5ec0132cc03..6522e9db5a0 100644
--- a/lib/private/Search/Provider/File.php
+++ b/lib/private/Search/Provider/File.php
@@ -51,7 +51,7 @@ class File extends PagedProvider {
* @return \OCP\Search\Result[]
* @deprecated 20.0.0
*/
- public function search($query, int $limit = null, int $offset = null) {
+ public function search($query, ?int $limit = null, ?int $offset = null) {
/** @var IRootFolder $rootFolder */
$rootFolder = \OCP\Server::get(IRootFolder::class);
/** @var IUserSession $userSession */
diff --git a/lib/private/Settings/Manager.php b/lib/private/Settings/Manager.php
index 839d3e5ce38..173b7dc5b01 100644
--- a/lib/private/Settings/Manager.php
+++ b/lib/private/Settings/Manager.php
@@ -184,7 +184,7 @@ class Manager implements IManager {
*
* @return ISettings[]
*/
- protected function getSettings(string $type, string $section, Closure $filter = null): array {
+ protected function getSettings(string $type, string $section, ?Closure $filter = null): array {
if (!isset($this->settings[$type])) {
$this->settings[$type] = [];
}
diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php
index 2bef6ba3ce7..53dbf65ccc7 100644
--- a/lib/private/Share20/Manager.php
+++ b/lib/private/Share20/Manager.php
@@ -902,7 +902,7 @@ class Manager implements IManager {
$link,
$initiator,
$shareWith,
- \DateTime $expiration = null,
+ ?\DateTime $expiration = null,
$note = '') {
$initiatorUser = $this->userManager->get($initiator);
$initiatorDisplayName = ($initiatorUser instanceof IUser) ? $initiatorUser->getDisplayName() : $initiator;
diff --git a/lib/private/Talk/Broker.php b/lib/private/Talk/Broker.php
index 451e7822790..1982d43611c 100644
--- a/lib/private/Talk/Broker.php
+++ b/lib/private/Talk/Broker.php
@@ -95,7 +95,7 @@ class Broker implements IBroker {
public function createConversation(string $name,
array $moderators,
- IConversationOptions $options = null): IConversation {
+ ?IConversationOptions $options = null): IConversation {
if (!$this->hasBackend()) {
throw new NoBackendException("The Talk broker has no registered backend");
}
diff --git a/lib/private/Template/JSResourceLocator.php b/lib/private/Template/JSResourceLocator.php
index b90d66417e0..5be1cb3c81a 100644
--- a/lib/private/Template/JSResourceLocator.php
+++ b/lib/private/Template/JSResourceLocator.php
@@ -120,7 +120,7 @@ class JSResourceLocator extends ResourceLocator {
* Try to find ES6 script file (`.mjs`) with fallback to plain javascript (`.js`)
* @see appendIfExist()
*/
- protected function appendScriptIfExist(string $root, string $file, string $webRoot = null) {
+ protected function appendScriptIfExist(string $root, string $file, ?string $webRoot = null) {
if (!$this->appendIfExist($root, $file . '.mjs', $webRoot)) {
return $this->appendIfExist($root, $file . '.js', $webRoot);
}
diff --git a/lib/private/User/Session.php b/lib/private/User/Session.php
index af2599e26b6..3f893eb9bae 100644
--- a/lib/private/User/Session.php
+++ b/lib/private/User/Session.php
@@ -162,7 +162,7 @@ class Session implements IUserSession, Emitter {
* @param string $method optional
* @param callable $callback optional
*/
- public function removeListener($scope = null, $method = null, callable $callback = null) {
+ public function removeListener($scope = null, $method = null, ?callable $callback = null) {
$this->manager->removeListener($scope, $method, $callback);
}
diff --git a/lib/private/User/User.php b/lib/private/User/User.php
index 28dfb741be8..daa78011007 100644
--- a/lib/private/User/User.php
+++ b/lib/private/User/User.php
@@ -103,7 +103,7 @@ class User implements IUser {
/** @var IURLGenerator */
private $urlGenerator;
- public function __construct(string $uid, ?UserInterface $backend, IEventDispatcher $dispatcher, $emitter = null, IConfig $config = null, $urlGenerator = null) {
+ public function __construct(string $uid, ?UserInterface $backend, IEventDispatcher $dispatcher, $emitter = null, ?IConfig $config = null, $urlGenerator = null) {
$this->uid = $uid;
$this->backend = $backend;
$this->emitter = $emitter;
diff --git a/lib/private/legacy/OC_Files.php b/lib/private/legacy/OC_Files.php
index ef65aa33c93..1b2f83941c8 100644
--- a/lib/private/legacy/OC_Files.php
+++ b/lib/private/legacy/OC_Files.php
@@ -87,7 +87,7 @@ class OC_Files {
header('Accept-Ranges: bytes', true);
if (count($rangeArray) > 1) {
$type = 'multipart/byteranges; boundary='.self::getBoundary();
- // no Content-Length header here
+ // no Content-Length header here
} else {
header(sprintf('Content-Range: bytes %d-%d/%d', $rangeArray[0]['from'], $rangeArray[0]['to'], $fileSize), true);
OC_Response::setContentLengthHeader($rangeArray[0]['to'] - $rangeArray[0]['from'] + 1);
diff --git a/lib/private/legacy/OC_Image.php b/lib/private/legacy/OC_Image.php
index 56fb3e0d52f..48f1812038b 100644
--- a/lib/private/legacy/OC_Image.php
+++ b/lib/private/legacy/OC_Image.php
@@ -85,7 +85,7 @@ class OC_Image implements \OCP\IImage {
* @param \OCP\IConfig $config
* @throws \InvalidArgumentException in case the $imageRef parameter is not null
*/
- public function __construct($imageRef = null, \OCP\ILogger $logger = null, \OCP\IConfig $config = null) {
+ public function __construct($imageRef = null, ?\OCP\ILogger $logger = null, ?\OCP\IConfig $config = null) {
$this->logger = $logger;
if ($logger === null) {
$this->logger = \OC::$server->getLogger();
@@ -211,7 +211,7 @@ class OC_Image implements \OCP\IImage {
* @param string $mimeType
* @return bool
*/
- public function show(string $mimeType = null): bool {
+ public function show(?string $mimeType = null): bool {
if ($mimeType === null) {
$mimeType = $this->mimeType();
}
diff --git a/lib/private/legacy/OC_User.php b/lib/private/legacy/OC_User.php
index 07ec97da7b0..3fe3f173b99 100644
--- a/lib/private/legacy/OC_User.php
+++ b/lib/private/legacy/OC_User.php
@@ -88,7 +88,7 @@ class OC_User {
\OC::$server->getUserManager()->registerBackend($backend);
} else {
// You'll never know what happens
- if (null === $backend or !is_string($backend)) {
+ if ($backend === null or !is_string($backend)) {
$backend = 'database';
}
diff --git a/lib/private/legacy/OC_Util.php b/lib/private/legacy/OC_Util.php
index 09d0719ff2b..86472f1b5e5 100644
--- a/lib/private/legacy/OC_Util.php
+++ b/lib/private/legacy/OC_Util.php
@@ -970,11 +970,11 @@ class OC_Util {
*/
private static function isNonUTF8Locale() {
if (function_exists('escapeshellcmd')) {
- return '' === escapeshellcmd('§');
+ return escapeshellcmd('§') === '';
} elseif (function_exists('escapeshellarg')) {
- return '\'\'' === escapeshellarg('§');
+ return escapeshellarg('§') === '\'\'';
} else {
- return 0 === preg_match('/utf-?8/i', setlocale(LC_CTYPE, 0));
+ return preg_match('/utf-?8/i', setlocale(LC_CTYPE, 0)) === 0;
}
}
diff --git a/lib/public/Accounts/IAccount.php b/lib/public/Accounts/IAccount.php
index e024ced5bda..5a5c838f398 100644
--- a/lib/public/Accounts/IAccount.php
+++ b/lib/public/Accounts/IAccount.php
@@ -154,7 +154,7 @@ interface IAccount extends \JsonSerializable {
* @param string $verified \OCP\Accounts\IAccountManager::NOT_VERIFIED | \OCP\Accounts\IAccountManager::VERIFICATION_IN_PROGRESS | \OCP\Accounts\IAccountManager::VERIFIED
* @return IAccountProperty[]
*/
- public function getFilteredProperties(string $scope = null, string $verified = null): array;
+ public function getFilteredProperties(?string $scope = null, ?string $verified = null): array;
/**
* Get the related user for the account data
diff --git a/lib/public/Activity/IEventMerger.php b/lib/public/Activity/IEventMerger.php
index d72106b24f7..3b6cc179efa 100644
--- a/lib/public/Activity/IEventMerger.php
+++ b/lib/public/Activity/IEventMerger.php
@@ -57,5 +57,5 @@ interface IEventMerger {
* @return IEvent
* @since 11.0
*/
- public function mergeEvents($mergeParameter, IEvent $event, IEvent $previousEvent = null);
+ public function mergeEvents($mergeParameter, IEvent $event, ?IEvent $previousEvent = null);
}
diff --git a/lib/public/Activity/IManager.php b/lib/public/Activity/IManager.php
index 9130c6b6b90..8340b54f757 100644
--- a/lib/public/Activity/IManager.php
+++ b/lib/public/Activity/IManager.php
@@ -161,7 +161,7 @@ interface IManager {
* @throws \UnexpectedValueException If the user is invalid
* @since 9.0.1
*/
- public function setCurrentUserId(string $currentUserId = null): void;
+ public function setCurrentUserId(?string $currentUserId = null): void;
/**
* Get the user we need to use
diff --git a/lib/public/Activity/IProvider.php b/lib/public/Activity/IProvider.php
index 657ffdeadbc..9c032ebaec2 100644
--- a/lib/public/Activity/IProvider.php
+++ b/lib/public/Activity/IProvider.php
@@ -38,5 +38,5 @@ interface IProvider {
* @throws \InvalidArgumentException Should be thrown if your provider does not know this event
* @since 11.0.0
*/
- public function parse($language, IEvent $event, IEvent $previousEvent = null);
+ public function parse($language, IEvent $event, ?IEvent $previousEvent = null);
}
diff --git a/lib/public/App/ManagerEvent.php b/lib/public/App/ManagerEvent.php
index 0853ce7981d..c2c6eca4683 100644
--- a/lib/public/App/ManagerEvent.php
+++ b/lib/public/App/ManagerEvent.php
@@ -70,7 +70,7 @@ class ManagerEvent extends Event {
* @param \OCP\IGroup[]|null $groups
* @since 9.0.0
*/
- public function __construct($event, $appID, array $groups = null) {
+ public function __construct($event, $appID, ?array $groups = null) {
$this->event = $event;
$this->appID = $appID;
$this->groups = $groups;
diff --git a/lib/public/AppFramework/Db/Entity.php b/lib/public/AppFramework/Db/Entity.php
index 1ae938f6e32..e0d9eae9171 100644
--- a/lib/public/AppFramework/Db/Entity.php
+++ b/lib/public/AppFramework/Db/Entity.php
@@ -105,7 +105,7 @@ abstract class Entity {
protected function setter(string $name, array $args): void {
// setters should only work for existing attributes
if (property_exists($this, $name)) {
- if ($this->$name === $args[0]) {
+ if ($args[0] === $this->$name) {
return;
}
$this->markFieldUpdated($name);
diff --git a/lib/public/AppFramework/Db/QBMapper.php b/lib/public/AppFramework/Db/QBMapper.php
index 57b996b2c0f..56957a7c912 100644
--- a/lib/public/AppFramework/Db/QBMapper.php
+++ b/lib/public/AppFramework/Db/QBMapper.php
@@ -59,7 +59,7 @@ abstract class QBMapper {
* mapped to queries without using sql
* @since 14.0.0
*/
- public function __construct(IDBConnection $db, string $tableName, string $entityClass = null) {
+ public function __construct(IDBConnection $db, string $tableName, ?string $entityClass = null) {
$this->db = $db;
$this->tableName = $tableName;
diff --git a/lib/public/AppFramework/Http/Response.php b/lib/public/AppFramework/Http/Response.php
index d28f45f4c60..06541df2da2 100644
--- a/lib/public/AppFramework/Http/Response.php
+++ b/lib/public/AppFramework/Http/Response.php
@@ -141,7 +141,7 @@ class Response {
* @return $this
* @since 8.0.0
*/
- public function addCookie($name, $value, \DateTime $expireDate = null, $sameSite = 'Lax') {
+ public function addCookie($name, $value, ?\DateTime $expireDate = null, $sameSite = 'Lax') {
$this->cookies[$name] = ['value' => $value, 'expireDate' => $expireDate, 'sameSite' => $sameSite];
return $this;
}
diff --git a/lib/public/AppFramework/OCS/OCSBadRequestException.php b/lib/public/AppFramework/OCS/OCSBadRequestException.php
index db146076f2a..997b2fdb025 100644
--- a/lib/public/AppFramework/OCS/OCSBadRequestException.php
+++ b/lib/public/AppFramework/OCS/OCSBadRequestException.php
@@ -38,7 +38,7 @@ class OCSBadRequestException extends OCSException {
* @param Exception|null $previous
* @since 9.1.0
*/
- public function __construct($message = '', Exception $previous = null) {
+ public function __construct($message = '', ?Exception $previous = null) {
parent::__construct($message, Http::STATUS_BAD_REQUEST, $previous);
}
}
diff --git a/lib/public/AppFramework/OCS/OCSForbiddenException.php b/lib/public/AppFramework/OCS/OCSForbiddenException.php
index ecdccb05a6f..691d31996ca 100644
--- a/lib/public/AppFramework/OCS/OCSForbiddenException.php
+++ b/lib/public/AppFramework/OCS/OCSForbiddenException.php
@@ -38,7 +38,7 @@ class OCSForbiddenException extends OCSException {
* @param Exception|null $previous
* @since 9.1.0
*/
- public function __construct($message = '', Exception $previous = null) {
+ public function __construct($message = '', ?Exception $previous = null) {
parent::__construct($message, Http::STATUS_FORBIDDEN, $previous);
}
}
diff --git a/lib/public/AppFramework/OCS/OCSNotFoundException.php b/lib/public/AppFramework/OCS/OCSNotFoundException.php
index 7a2ffb5de91..9dd2925ef11 100644
--- a/lib/public/AppFramework/OCS/OCSNotFoundException.php
+++ b/lib/public/AppFramework/OCS/OCSNotFoundException.php
@@ -38,7 +38,7 @@ class OCSNotFoundException extends OCSException {
* @param Exception|null $previous
* @since 9.1.0
*/
- public function __construct($message = '', Exception $previous = null) {
+ public function __construct($message = '', ?Exception $previous = null) {
parent::__construct($message, Http::STATUS_NOT_FOUND, $previous);
}
}
diff --git a/lib/public/AppFramework/OCS/OCSPreconditionFailedException.php b/lib/public/AppFramework/OCS/OCSPreconditionFailedException.php
index 1b661ed9943..b7064aff318 100644
--- a/lib/public/AppFramework/OCS/OCSPreconditionFailedException.php
+++ b/lib/public/AppFramework/OCS/OCSPreconditionFailedException.php
@@ -38,7 +38,7 @@ class OCSPreconditionFailedException extends OCSException {
* @param Exception|null $previous
* @since 9.1.0
*/
- public function __construct($message = '', Exception $previous = null) {
+ public function __construct($message = '', ?Exception $previous = null) {
parent::__construct($message, Http::STATUS_PRECONDITION_FAILED, $previous);
}
}
diff --git a/lib/public/AppFramework/Utility/ITimeFactory.php b/lib/public/AppFramework/Utility/ITimeFactory.php
index be1b80ff617..ee5901b5a45 100644
--- a/lib/public/AppFramework/Utility/ITimeFactory.php
+++ b/lib/public/AppFramework/Utility/ITimeFactory.php
@@ -50,7 +50,7 @@ interface ITimeFactory extends ClockInterface {
* @return \DateTime
* @since 15.0.0
*/
- public function getDateTime(string $time = 'now', \DateTimeZone $timezone = null): \DateTime;
+ public function getDateTime(string $time = 'now', ?\DateTimeZone $timezone = null): \DateTime;
/**
* @param \DateTimeZone $timezone
diff --git a/lib/public/BackgroundJob/IJob.php b/lib/public/BackgroundJob/IJob.php
index 24d8e7aad4a..90c0804c1e1 100644
--- a/lib/public/BackgroundJob/IJob.php
+++ b/lib/public/BackgroundJob/IJob.php
@@ -55,7 +55,7 @@ interface IJob {
* @deprecated since 25.0.0 Use start() instead. This method will be removed
* with the ILogger interface
*/
- public function execute(IJobList $jobList, ILogger $logger = null);
+ public function execute(IJobList $jobList, ?ILogger $logger = null);
/**
* Start the background job with the registered argument
diff --git a/lib/public/BackgroundJob/QueuedJob.php b/lib/public/BackgroundJob/QueuedJob.php
index e93db3420b8..bac60f9be11 100644
--- a/lib/public/BackgroundJob/QueuedJob.php
+++ b/lib/public/BackgroundJob/QueuedJob.php
@@ -43,7 +43,7 @@ abstract class QueuedJob extends Job {
* @deprecated since 25.0.0 Use start() instead. This method will be removed
* with the ILogger interface
*/
- final public function execute($jobList, ILogger $logger = null) {
+ final public function execute($jobList, ?ILogger $logger = null) {
$this->start($jobList);
}
diff --git a/lib/public/BackgroundJob/TimedJob.php b/lib/public/BackgroundJob/TimedJob.php
index 8fd8fadce4f..2f91dbfdc6e 100644
--- a/lib/public/BackgroundJob/TimedJob.php
+++ b/lib/public/BackgroundJob/TimedJob.php
@@ -88,7 +88,7 @@ abstract class TimedJob extends Job {
* @since 15.0.0
* @deprecated since 25.0.0 Use start() instead
*/
- final public function execute(IJobList $jobList, ILogger $logger = null) {
+ final public function execute(IJobList $jobList, ?ILogger $logger = null) {
$this->start($jobList);
}
diff --git a/lib/public/Collaboration/Collaborators/ISearchResult.php b/lib/public/Collaboration/Collaborators/ISearchResult.php
index 15d14d656ed..a27a52fc54a 100644
--- a/lib/public/Collaboration/Collaborators/ISearchResult.php
+++ b/lib/public/Collaboration/Collaborators/ISearchResult.php
@@ -34,7 +34,7 @@ interface ISearchResult {
* @param array|null $exactMatches
* @since 13.0.0
*/
- public function addResultSet(SearchResultType $type, array $matches, array $exactMatches = null);
+ public function addResultSet(SearchResultType $type, array $matches, ?array $exactMatches = null);
/**
* @param SearchResultType $type
diff --git a/lib/public/Comments/ICommentsManager.php b/lib/public/Comments/ICommentsManager.php
index 3d47be3d951..3df7984387a 100644
--- a/lib/public/Comments/ICommentsManager.php
+++ b/lib/public/Comments/ICommentsManager.php
@@ -118,7 +118,7 @@ interface ICommentsManager {
$objectId,
$limit = 0,
$offset = 0,
- \DateTime $notOlderThan = null
+ ?\DateTime $notOlderThan = null
);
/**
@@ -201,7 +201,7 @@ interface ICommentsManager {
* @return Int
* @since 9.0.0
*/
- public function getNumberOfCommentsForObject($objectType, $objectId, \DateTime $notOlderThan = null, $verb = '');
+ public function getNumberOfCommentsForObject($objectType, $objectId, ?\DateTime $notOlderThan = null, $verb = '');
/**
* @param string $objectType the object type, e.g. 'files'
diff --git a/lib/public/Contacts/ContactsMenu/IEntry.php b/lib/public/Contacts/ContactsMenu/IEntry.php
index 1307e2c74f7..a1c64ca56aa 100644
--- a/lib/public/Contacts/ContactsMenu/IEntry.php
+++ b/lib/public/Contacts/ContactsMenu/IEntry.php
@@ -63,9 +63,9 @@ interface IEntry extends JsonSerializable {
* @return void
*/
public function setStatus(string $status,
- string $statusMessage = null,
- int $statusMessageTimestamp = null,
- string $icon = null): void;
+ ?string $statusMessage = null,
+ ?int $statusMessageTimestamp = null,
+ ?string $icon = null): void;
/**
* Get an arbitrary property from the contact
diff --git a/lib/public/DataCollector/IDataCollector.php b/lib/public/DataCollector/IDataCollector.php
index 0fb914727df..def260402f9 100644
--- a/lib/public/DataCollector/IDataCollector.php
+++ b/lib/public/DataCollector/IDataCollector.php
@@ -39,7 +39,7 @@ interface IDataCollector {
* Collects data for the given Request and Response.
* @since 24.0.0
*/
- public function collect(Request $request, Response $response, \Throwable $exception = null): void;
+ public function collect(Request $request, Response $response, ?\Throwable $exception = null): void;
/**
* Reset the state of the profiler.
diff --git a/lib/public/Defaults.php b/lib/public/Defaults.php
index 63568b27294..0b52a0f6bf0 100644
--- a/lib/public/Defaults.php
+++ b/lib/public/Defaults.php
@@ -50,7 +50,7 @@ class Defaults {
* actual defaults
* @since 6.0.0
*/
- public function __construct(\OC_Defaults $defaults = null) {
+ public function __construct(?\OC_Defaults $defaults = null) {
if ($defaults === null) {
$defaults = \OC::$server->get('ThemingDefaults');
}
diff --git a/lib/public/Diagnostics/IQueryLogger.php b/lib/public/Diagnostics/IQueryLogger.php
index ba4c97f5b50..f1f4d623da1 100644
--- a/lib/public/Diagnostics/IQueryLogger.php
+++ b/lib/public/Diagnostics/IQueryLogger.php
@@ -43,7 +43,7 @@ interface IQueryLogger extends SQLLogger {
* @param array|null $types
* @since 8.0.0
*/
- public function startQuery($sql, array $params = null, array $types = null);
+ public function startQuery($sql, ?array $params = null, ?array $types = null);
/**
* Mark the end of the current active query. Ending query should store \OCP\Diagnostics\IQuery to
diff --git a/lib/public/DirectEditing/ACreateEmpty.php b/lib/public/DirectEditing/ACreateEmpty.php
index 89209748e4f..66b772e4d80 100644
--- a/lib/public/DirectEditing/ACreateEmpty.php
+++ b/lib/public/DirectEditing/ACreateEmpty.php
@@ -70,6 +70,6 @@ abstract class ACreateEmpty {
* @since 18.0.0
* @param File $file
*/
- public function create(File $file, string $creatorId = null, string $templateId = null): void {
+ public function create(File $file, ?string $creatorId = null, ?string $templateId = null): void {
}
}
diff --git a/lib/public/Encryption/Exceptions/GenericEncryptionException.php b/lib/public/Encryption/Exceptions/GenericEncryptionException.php
index 8406d0593d2..5338b221675 100644
--- a/lib/public/Encryption/Exceptions/GenericEncryptionException.php
+++ b/lib/public/Encryption/Exceptions/GenericEncryptionException.php
@@ -41,7 +41,7 @@ class GenericEncryptionException extends HintException {
* @param \Exception|null $previous
* @since 8.1.0
*/
- public function __construct($message = '', $hint = '', $code = 0, \Exception $previous = null) {
+ public function __construct($message = '', $hint = '', $code = 0, ?\Exception $previous = null) {
if (empty($message)) {
$message = 'Unspecified encryption exception';
}
diff --git a/lib/public/Federation/Exceptions/ProviderCouldNotAddShareException.php b/lib/public/Federation/Exceptions/ProviderCouldNotAddShareException.php
index 9294f5e1d95..d3cfd6cea2d 100644
--- a/lib/public/Federation/Exceptions/ProviderCouldNotAddShareException.php
+++ b/lib/public/Federation/Exceptions/ProviderCouldNotAddShareException.php
@@ -42,7 +42,7 @@ class ProviderCouldNotAddShareException extends HintException {
* @param int $code
* @param \Exception|null $previous
*/
- public function __construct($message, $hint = '', $code = Http::STATUS_BAD_REQUEST, \Exception $previous = null) {
+ public function __construct($message, $hint = '', $code = Http::STATUS_BAD_REQUEST, ?\Exception $previous = null) {
parent::__construct($message, $hint, $code, $previous);
}
}
diff --git a/lib/public/Files/Config/IUserMountCache.php b/lib/public/Files/Config/IUserMountCache.php
index 4411200c7ae..d60a7aad94b 100644
--- a/lib/public/Files/Config/IUserMountCache.php
+++ b/lib/public/Files/Config/IUserMountCache.php
@@ -42,7 +42,7 @@ interface IUserMountCache {
* @param array|null $mountProviderClasses
* @since 9.0.0
*/
- public function registerMounts(IUser $user, array $mounts, array $mountProviderClasses = null);
+ public function registerMounts(IUser $user, array $mounts, ?array $mountProviderClasses = null);
/**
* Get all cached mounts for a user
diff --git a/lib/public/Files/Events/Node/BeforeNodeDeletedEvent.php b/lib/public/Files/Events/Node/BeforeNodeDeletedEvent.php
index c0226a9b527..8cbd1d8a3a0 100644
--- a/lib/public/Files/Events/Node/BeforeNodeDeletedEvent.php
+++ b/lib/public/Files/Events/Node/BeforeNodeDeletedEvent.php
@@ -35,7 +35,7 @@ class BeforeNodeDeletedEvent extends AbstractNodeEvent {
* @since 28.0.0
* @deprecated 29.0.0 - use OCP\Exceptions\AbortedEventException instead
*/
- public function abortOperation(\Throwable $ex = null) {
+ public function abortOperation(?\Throwable $ex = null) {
throw new AbortedEventException($ex?->getMessage() ?? 'Operation aborted');
}
}
diff --git a/lib/public/Files/Events/Node/BeforeNodeRenamedEvent.php b/lib/public/Files/Events/Node/BeforeNodeRenamedEvent.php
index 4c2c566c8c6..7331f750267 100644
--- a/lib/public/Files/Events/Node/BeforeNodeRenamedEvent.php
+++ b/lib/public/Files/Events/Node/BeforeNodeRenamedEvent.php
@@ -35,7 +35,7 @@ class BeforeNodeRenamedEvent extends AbstractNodesEvent {
* @since 28.0.0
* @deprecated 29.0.0 - use OCP\Exceptions\AbortedEventException instead
*/
- public function abortOperation(\Throwable $ex = null) {
+ public function abortOperation(?\Throwable $ex = null) {
throw new AbortedEventException($ex?->getMessage() ?? 'Operation aborted');
}
}
diff --git a/lib/public/Files/ForbiddenException.php b/lib/public/Files/ForbiddenException.php
index 6a0a8d7fc4b..1f45e94f55c 100644
--- a/lib/public/Files/ForbiddenException.php
+++ b/lib/public/Files/ForbiddenException.php
@@ -41,7 +41,7 @@ class ForbiddenException extends \Exception {
* @param \Exception|null $previous previous exception for cascading
* @since 9.0.0
*/
- public function __construct($message, $retry, \Exception $previous = null) {
+ public function __construct($message, $retry, ?\Exception $previous = null) {
parent::__construct($message, 0, $previous);
$this->retry = $retry;
}
diff --git a/lib/public/Files/LockNotAcquiredException.php b/lib/public/Files/LockNotAcquiredException.php
index 2cf8ea20acf..000c5320634 100644
--- a/lib/public/Files/LockNotAcquiredException.php
+++ b/lib/public/Files/LockNotAcquiredException.php
@@ -42,7 +42,7 @@ class LockNotAcquiredException extends \Exception {
/**
* @since 7.0.0
*/
- public function __construct($path, $lockType, $code = 0, \Exception $previous = null) {
+ public function __construct($path, $lockType, $code = 0, ?\Exception $previous = null) {
$message = \OCP\Util::getL10N('core')->t('Could not obtain lock type %d on "%s".', [$lockType, $path]);
parent::__construct($message, $code, $previous);
}
diff --git a/lib/public/Files/ObjectStore/IObjectStore.php b/lib/public/Files/ObjectStore/IObjectStore.php
index a202ef7c0c2..e58f41cf69d 100644
--- a/lib/public/Files/ObjectStore/IObjectStore.php
+++ b/lib/public/Files/ObjectStore/IObjectStore.php
@@ -54,7 +54,7 @@ interface IObjectStore {
* @throws \Exception when something goes wrong, message will be logged
* @since 7.0.0
*/
- public function writeObject($urn, $stream, string $mimetype = null);
+ public function writeObject($urn, $stream, ?string $mimetype = null);
/**
* @param string $urn the unified resource name used to identify the object
diff --git a/lib/public/Files/Storage/IChunkedFileWrite.php b/lib/public/Files/Storage/IChunkedFileWrite.php
index 01f5cbbb20a..2d5825c4ee8 100644
--- a/lib/public/Files/Storage/IChunkedFileWrite.php
+++ b/lib/public/Files/Storage/IChunkedFileWrite.php
@@ -49,7 +49,7 @@ interface IChunkedFileWrite extends IStorage {
* @throws GenericFileException
* @since 26.0.0
*/
- public function putChunkedWritePart(string $targetPath, string $writeToken, string $chunkId, $data, int $size = null): ?array;
+ public function putChunkedWritePart(string $targetPath, string $writeToken, string $chunkId, $data, ?int $size = null): ?array;
/**
* @param string $targetPath
diff --git a/lib/public/Files/Storage/IWriteStreamStorage.php b/lib/public/Files/Storage/IWriteStreamStorage.php
index f9122cd4b2c..3de2f8a25c1 100644
--- a/lib/public/Files/Storage/IWriteStreamStorage.php
+++ b/lib/public/Files/Storage/IWriteStreamStorage.php
@@ -44,5 +44,5 @@ interface IWriteStreamStorage extends IStorage {
* @throws GenericFileException
* @since 15.0.0
*/
- public function writeStream(string $path, $stream, int $size = null): int;
+ public function writeStream(string $path, $stream, ?int $size = null): int;
}
diff --git a/lib/public/Files/StorageAuthException.php b/lib/public/Files/StorageAuthException.php
index bc39f8e27f5..60f711af326 100644
--- a/lib/public/Files/StorageAuthException.php
+++ b/lib/public/Files/StorageAuthException.php
@@ -35,7 +35,7 @@ class StorageAuthException extends StorageNotAvailableException {
* @param \Exception|null $previous
* @since 9.0.0
*/
- public function __construct($message = '', \Exception $previous = null) {
+ public function __construct($message = '', ?\Exception $previous = null) {
$l = \OCP\Util::getL10N('core');
parent::__construct($l->t('Storage unauthorized. %s', [$message]), self::STATUS_UNAUTHORIZED, $previous);
}
diff --git a/lib/public/Files/StorageBadConfigException.php b/lib/public/Files/StorageBadConfigException.php
index 36d7329d4b5..ac017f1edf9 100644
--- a/lib/public/Files/StorageBadConfigException.php
+++ b/lib/public/Files/StorageBadConfigException.php
@@ -35,7 +35,7 @@ class StorageBadConfigException extends StorageNotAvailableException {
* @param \Exception|null $previous
* @since 9.0.0
*/
- public function __construct($message = '', \Exception $previous = null) {
+ public function __construct($message = '', ?\Exception $previous = null) {
$l = \OCP\Util::getL10N('core');
parent::__construct($l->t('Storage incomplete configuration. %s', [$message]), self::STATUS_INCOMPLETE_CONF, $previous);
}
diff --git a/lib/public/Files/StorageConnectionException.php b/lib/public/Files/StorageConnectionException.php
index d29398172e6..0f3f2e0e54c 100644
--- a/lib/public/Files/StorageConnectionException.php
+++ b/lib/public/Files/StorageConnectionException.php
@@ -35,7 +35,7 @@ class StorageConnectionException extends StorageNotAvailableException {
* @param \Exception|null $previous
* @since 9.0.0
*/
- public function __construct($message = '', \Exception $previous = null) {
+ public function __construct($message = '', ?\Exception $previous = null) {
$l = \OCP\Util::getL10N('core');
parent::__construct($l->t('Storage connection error. %s', [$message]), self::STATUS_NETWORK_ERROR, $previous);
}
diff --git a/lib/public/Files/StorageNotAvailableException.php b/lib/public/Files/StorageNotAvailableException.php
index 78b004f8518..a87ed500e02 100644
--- a/lib/public/Files/StorageNotAvailableException.php
+++ b/lib/public/Files/StorageNotAvailableException.php
@@ -83,7 +83,7 @@ class StorageNotAvailableException extends HintException {
* @param \Exception|null $previous
* @since 6.0.0
*/
- public function __construct($message = '', $code = self::STATUS_ERROR, \Exception $previous = null) {
+ public function __construct($message = '', $code = self::STATUS_ERROR, ?\Exception $previous = null) {
$l = \OCP\Util::getL10N('core');
parent::__construct($message, $l->t('Storage is temporarily not available'), $code, $previous);
}
diff --git a/lib/public/Files/StorageTimeoutException.php b/lib/public/Files/StorageTimeoutException.php
index c20711d4181..45ee4c15464 100644
--- a/lib/public/Files/StorageTimeoutException.php
+++ b/lib/public/Files/StorageTimeoutException.php
@@ -35,7 +35,7 @@ class StorageTimeoutException extends StorageNotAvailableException {
* @param \Exception|null $previous
* @since 9.0.0
*/
- public function __construct($message = '', \Exception $previous = null) {
+ public function __construct($message = '', ?\Exception $previous = null) {
$l = \OCP\Util::getL10N('core');
parent::__construct($l->t('Storage connection timeout. %s', [$message]), self::STATUS_TIMEOUT, $previous);
}
diff --git a/lib/public/Files/Template/ITemplateManager.php b/lib/public/Files/Template/ITemplateManager.php
index f39cf65fba4..c54c9716804 100644
--- a/lib/public/Files/Template/ITemplateManager.php
+++ b/lib/public/Files/Template/ITemplateManager.php
@@ -80,7 +80,7 @@ interface ITemplateManager {
* @param string|null $userId
* @since 21.0.0
*/
- public function initializeTemplateDirectory(string $path = null, string $userId = null, $copyTemplates = true): string;
+ public function initializeTemplateDirectory(?string $path = null, ?string $userId = null, $copyTemplates = true): string;
/**
* @param string $filePath
diff --git a/lib/public/HintException.php b/lib/public/HintException.php
index ad6eb486d4b..0e9a142e8f3 100644
--- a/lib/public/HintException.php
+++ b/lib/public/HintException.php
@@ -49,7 +49,7 @@ class HintException extends \Exception {
* @param int $code
* @param \Exception|null $previous
*/
- public function __construct($message, $hint = '', $code = 0, \Exception $previous = null) {
+ public function __construct($message, $hint = '', $code = 0, ?\Exception $previous = null) {
$this->hint = $hint;
parent::__construct($message, $code, $previous);
}
diff --git a/lib/public/IDBConnection.php b/lib/public/IDBConnection.php
index 5613aa3743b..026e79c3776 100644
--- a/lib/public/IDBConnection.php
+++ b/lib/public/IDBConnection.php
@@ -164,7 +164,7 @@ interface IDBConnection {
* @since 6.0.0 - parameter $compare was added in 8.1.0, return type changed from boolean in 8.1.0
* @deprecated 15.0.0 - use unique index and "try { $db->insert() } catch (UniqueConstraintViolationException $e) {}" instead, because it is more reliable and does not have the risk for deadlocks - see https://github.com/nextcloud/server/pull/12371
*/
- public function insertIfNotExist(string $table, array $input, array $compare = null);
+ public function insertIfNotExist(string $table, array $input, ?array $compare = null);
/**
diff --git a/lib/public/IDateTimeFormatter.php b/lib/public/IDateTimeFormatter.php
index f85a88b4e38..75e5f2e1cc7 100644
--- a/lib/public/IDateTimeFormatter.php
+++ b/lib/public/IDateTimeFormatter.php
@@ -44,7 +44,7 @@ interface IDateTimeFormatter {
* @return string Formatted date string
* @since 8.0.0
*/
- public function formatDate($timestamp, $format = 'long', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null);
+ public function formatDate($timestamp, $format = 'long', ?\DateTimeZone $timeZone = null, ?\OCP\IL10N $l = null);
/**
* Formats the date of the given timestamp
@@ -62,7 +62,7 @@ interface IDateTimeFormatter {
* @return string Formatted relative date string
* @since 8.0.0
*/
- public function formatDateRelativeDay($timestamp, $format = 'long', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null);
+ public function formatDateRelativeDay($timestamp, $format = 'long', ?\DateTimeZone $timeZone = null, ?\OCP\IL10N $l = null);
/**
* Gives the relative date of the timestamp
@@ -77,7 +77,7 @@ interface IDateTimeFormatter {
* >= 13 month => last year, n years ago
* @since 8.0.0
*/
- public function formatDateSpan($timestamp, $baseTimestamp = null, \OCP\IL10N $l = null);
+ public function formatDateSpan($timestamp, $baseTimestamp = null, ?\OCP\IL10N $l = null);
/**
* Formats the time of the given timestamp
@@ -94,7 +94,7 @@ interface IDateTimeFormatter {
* @return string Formatted time string
* @since 8.0.0
*/
- public function formatTime($timestamp, $format = 'medium', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null);
+ public function formatTime($timestamp, $format = 'medium', ?\DateTimeZone $timeZone = null, ?\OCP\IL10N $l = null);
/**
* Gives the relative past time of the timestamp
@@ -111,7 +111,7 @@ interface IDateTimeFormatter {
* >= 13 month => last year, n years ago
* @since 8.0.0
*/
- public function formatTimeSpan($timestamp, $baseTimestamp = null, \OCP\IL10N $l = null);
+ public function formatTimeSpan($timestamp, $baseTimestamp = null, ?\OCP\IL10N $l = null);
/**
* Formats the date and time of the given timestamp
@@ -124,7 +124,7 @@ interface IDateTimeFormatter {
* @return string Formatted date and time string
* @since 8.0.0
*/
- public function formatDateTime($timestamp, $formatDate = 'long', $formatTime = 'medium', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null);
+ public function formatDateTime($timestamp, $formatDate = 'long', $formatTime = 'medium', ?\DateTimeZone $timeZone = null, ?\OCP\IL10N $l = null);
/**
* Formats the date and time of the given timestamp
@@ -138,5 +138,5 @@ interface IDateTimeFormatter {
* @return string Formatted relative date and time string
* @since 8.0.0
*/
- public function formatDateTimeRelativeDay($timestamp, $formatDate = 'long', $formatTime = 'medium', \DateTimeZone $timeZone = null, \OCP\IL10N $l = null);
+ public function formatDateTimeRelativeDay($timestamp, $formatDate = 'long', $formatTime = 'medium', ?\DateTimeZone $timeZone = null, ?\OCP\IL10N $l = null);
}
diff --git a/lib/public/IGroup.php b/lib/public/IGroup.php
index 51417641e26..9739a324168 100644
--- a/lib/public/IGroup.php
+++ b/lib/public/IGroup.php
@@ -135,7 +135,7 @@ interface IGroup {
* @return IUser[]
* @since 8.0.0
*/
- public function searchDisplayName(string $search, int $limit = null, int $offset = null): array;
+ public function searchDisplayName(string $search, ?int $limit = null, ?int $offset = null): array;
/**
* Get the names of the backends the group is connected to
diff --git a/lib/public/IGroupManager.php b/lib/public/IGroupManager.php
index a6655292398..df7321bf0d7 100644
--- a/lib/public/IGroupManager.php
+++ b/lib/public/IGroupManager.php
@@ -108,7 +108,7 @@ interface IGroupManager {
* @return \OCP\IGroup[]
* @since 8.0.0
*/
- public function getUserGroups(IUser $user = null);
+ public function getUserGroups(?IUser $user = null);
/**
* @param \OCP\IUser $user
diff --git a/lib/public/L10N/IFactory.php b/lib/public/L10N/IFactory.php
index 35713862f07..72aa11f002c 100644
--- a/lib/public/L10N/IFactory.php
+++ b/lib/public/L10N/IFactory.php
@@ -78,7 +78,7 @@ interface IFactory {
* @return string language code, defaults to 'en' if no other matches are found
* @since 23.0.0
*/
- public function findGenericLanguage(string $appId = null): string;
+ public function findGenericLanguage(?string $appId = null): string;
/**
* @param string|null $lang user language as default locale
@@ -95,7 +95,7 @@ interface IFactory {
* @return null|string
* @since 14.0.1
*/
- public function findLanguageFromLocale(string $app = 'core', string $locale = null);
+ public function findLanguageFromLocale(string $app = 'core', ?string $locale = null);
/**
* Find all available languages for an app
@@ -141,7 +141,7 @@ interface IFactory {
*
* @since 14.0.0
*/
- public function getLanguageIterator(IUser $user = null): ILanguageIterator;
+ public function getLanguageIterator(?IUser $user = null): ILanguageIterator;
/**
* returns the common language and other languages in an
@@ -158,5 +158,5 @@ interface IFactory {
* @return string
* @since 20.0.0
*/
- public function getUserLanguage(IUser $user = null): string;
+ public function getUserLanguage(?IUser $user = null): string;
}
diff --git a/lib/public/Lock/LockedException.php b/lib/public/Lock/LockedException.php
index ec7701523fb..2b1377b5854 100644
--- a/lib/public/Lock/LockedException.php
+++ b/lib/public/Lock/LockedException.php
@@ -53,7 +53,7 @@ class LockedException extends \Exception {
* @param string $readablePath since 20.0.0
* @since 8.1.0
*/
- public function __construct(string $path, \Exception $previous = null, string $existingLock = null, string $readablePath = null) {
+ public function __construct(string $path, ?\Exception $previous = null, ?string $existingLock = null, ?string $readablePath = null) {
if ($readablePath) {
$message = "\"$path\"(\"$readablePath\") is locked";
} else {
diff --git a/lib/public/Lock/ManuallyLockedException.php b/lib/public/Lock/ManuallyLockedException.php
index 914f0392e39..bc91a9c3304 100644
--- a/lib/public/Lock/ManuallyLockedException.php
+++ b/lib/public/Lock/ManuallyLockedException.php
@@ -58,7 +58,7 @@ class ManuallyLockedException extends LockedException {
*
* @since 18.0.0
*/
- public function __construct(string $path, \Exception $previous = null, ?string $existingLock = null, ?string $owner = null, int $timeout = -1) {
+ public function __construct(string $path, ?\Exception $previous = null, ?string $existingLock = null, ?string $owner = null, int $timeout = -1) {
parent::__construct($path, $previous, $existingLock);
$this->owner = $owner;
$this->timeout = $timeout;
diff --git a/lib/public/Log/functions.php b/lib/public/Log/functions.php
index ac043b4d958..be14208103b 100644
--- a/lib/public/Log/functions.php
+++ b/lib/public/Log/functions.php
@@ -48,7 +48,7 @@ use function class_exists;
* @return LoggerInterface
* @since 24.0.0
*/
-function logger(string $appId = null): LoggerInterface {
+function logger(?string $appId = null): LoggerInterface {
/** @psalm-suppress TypeDoesNotContainNull false-positive, it may contain null if we are logging from initialization */
if (!class_exists(OC::class) || OC::$server === null) {
// If someone calls this log before Nextcloud is initialized, there is
diff --git a/lib/public/Mail/IMessage.php b/lib/public/Mail/IMessage.php
index bd96918c7ac..79efc1e2a71 100644
--- a/lib/public/Mail/IMessage.php
+++ b/lib/public/Mail/IMessage.php
@@ -79,7 +79,7 @@ interface IMessage {
* @return IMessage
* @since 27.0.0
*/
- public function attachInline(string $body, string $name, string $contentType = null): IMessage;
+ public function attachInline(string $body, string $name, ?string $contentType = null): IMessage;
/**
* Set the from address of this message.
diff --git a/lib/public/Profiler/IProfiler.php b/lib/public/Profiler/IProfiler.php
index 5fa4582add7..50edabb47ff 100644
--- a/lib/public/Profiler/IProfiler.php
+++ b/lib/public/Profiler/IProfiler.php
@@ -67,7 +67,7 @@ interface IProfiler {
* Find a profile from various search parameters
* @since 24.0.0
*/
- public function find(?string $url, ?int $limit, ?string $method, ?int $start, ?int $end, string $statusCode = null): array;
+ public function find(?string $url, ?int $limit, ?string $method, ?int $start, ?int $end, ?string $statusCode = null): array;
/**
* Get the list of data providers by identifier
diff --git a/lib/public/Share/Exceptions/GenericShareException.php b/lib/public/Share/Exceptions/GenericShareException.php
index 496aae1406b..b726ce27b91 100644
--- a/lib/public/Share/Exceptions/GenericShareException.php
+++ b/lib/public/Share/Exceptions/GenericShareException.php
@@ -39,7 +39,7 @@ class GenericShareException extends HintException {
* @param \Exception|null $previous
* @since 9.0.0
*/
- public function __construct($message = '', $hint = '', $code = 0, \Exception $previous = null) {
+ public function __construct($message = '', $hint = '', $code = 0, ?\Exception $previous = null) {
if (empty($message)) {
$message = 'There was an error retrieving the share. Maybe the link is wrong, it was unshared, or it was deleted.';
}
diff --git a/lib/public/SystemTag/ManagerEvent.php b/lib/public/SystemTag/ManagerEvent.php
index 48bd651f7a3..802b690038a 100644
--- a/lib/public/SystemTag/ManagerEvent.php
+++ b/lib/public/SystemTag/ManagerEvent.php
@@ -69,7 +69,7 @@ class ManagerEvent extends Event {
* @param ISystemTag|null $beforeTag
* @since 9.0.0
*/
- public function __construct(string $event, ISystemTag $tag, ISystemTag $beforeTag = null) {
+ public function __construct(string $event, ISystemTag $tag, ?ISystemTag $beforeTag = null) {
$this->event = $event;
$this->tag = $tag;
$this->beforeTag = $beforeTag;
diff --git a/lib/public/SystemTag/TagNotFoundException.php b/lib/public/SystemTag/TagNotFoundException.php
index 54e96856052..8f5442bb145 100644
--- a/lib/public/SystemTag/TagNotFoundException.php
+++ b/lib/public/SystemTag/TagNotFoundException.php
@@ -45,7 +45,7 @@ class TagNotFoundException extends \RuntimeException {
* @param string[] $tags
* @since 9.0.0
*/
- public function __construct(string $message = '', int $code = 0, \Exception $previous = null, array $tags = []) {
+ public function __construct(string $message = '', int $code = 0, ?\Exception $previous = null, array $tags = []) {
parent::__construct($message, $code, $previous);
$this->tags = $tags;
}
diff --git a/lib/public/Talk/IBroker.php b/lib/public/Talk/IBroker.php
index f2b512ea4a8..67fae10253f 100644
--- a/lib/public/Talk/IBroker.php
+++ b/lib/public/Talk/IBroker.php
@@ -69,7 +69,7 @@ interface IBroker {
*/
public function createConversation(string $name,
array $moderators,
- IConversationOptions $options = null): IConversation;
+ ?IConversationOptions $options = null): IConversation;
/**
* Delete a conversation by id
diff --git a/lib/public/User/Events/BeforePasswordUpdatedEvent.php b/lib/public/User/Events/BeforePasswordUpdatedEvent.php
index ee228ae01e7..67c01dec259 100644
--- a/lib/public/User/Events/BeforePasswordUpdatedEvent.php
+++ b/lib/public/User/Events/BeforePasswordUpdatedEvent.php
@@ -52,7 +52,7 @@ class BeforePasswordUpdatedEvent extends Event {
*/
public function __construct(IUser $user,
string $password,
- string $recoveryPassword = null) {
+ ?string $recoveryPassword = null) {
parent::__construct();
$this->user = $user;
$this->password = $password;
diff --git a/lib/public/User/Events/BeforeUserLoggedOutEvent.php b/lib/public/User/Events/BeforeUserLoggedOutEvent.php
index aa81801f474..be6f2848cb2 100644
--- a/lib/public/User/Events/BeforeUserLoggedOutEvent.php
+++ b/lib/public/User/Events/BeforeUserLoggedOutEvent.php
@@ -41,7 +41,7 @@ class BeforeUserLoggedOutEvent extends Event {
/**
* @since 18.0.0
*/
- public function __construct(IUser $user = null) {
+ public function __construct(?IUser $user = null) {
parent::__construct();
$this->user = $user;
}
diff --git a/lib/public/User/Events/PasswordUpdatedEvent.php b/lib/public/User/Events/PasswordUpdatedEvent.php
index 782d6d270ea..b6fa75e0221 100644
--- a/lib/public/User/Events/PasswordUpdatedEvent.php
+++ b/lib/public/User/Events/PasswordUpdatedEvent.php
@@ -52,7 +52,7 @@ class PasswordUpdatedEvent extends Event {
*/
public function __construct(IUser $user,
string $password,
- string $recoveryPassword = null) {
+ ?string $recoveryPassword = null) {
parent::__construct();
$this->user = $user;
$this->password = $password;
diff --git a/lib/public/User/Events/UserLoggedOutEvent.php b/lib/public/User/Events/UserLoggedOutEvent.php
index c1b97fec29c..fa22b1bd53d 100644
--- a/lib/public/User/Events/UserLoggedOutEvent.php
+++ b/lib/public/User/Events/UserLoggedOutEvent.php
@@ -41,7 +41,7 @@ class UserLoggedOutEvent extends Event {
/**
* @since 18.0.0
*/
- public function __construct(IUser $user = null) {
+ public function __construct(?IUser $user = null) {
parent::__construct();
$this->user = $user;
}
diff --git a/lib/public/Util.php b/lib/public/Util.php
index 11229567188..9ab9895acb8 100644
--- a/lib/public/Util.php
+++ b/lib/public/Util.php
@@ -177,7 +177,7 @@ class Util {
* @param bool $prepend
* @since 4.0.0
*/
- public static function addScript(string $application, string $file = null, string $afterAppId = 'core', bool $prepend = false): void {
+ public static function addScript(string $application, ?string $file = null, string $afterAppId = 'core', bool $prepend = false): void {
if (!empty($application)) {
$path = "$application/js/$file";
} else {