diff --git a/apps/admin_audit/lib/AuditLogger.php b/apps/admin_audit/lib/AuditLogger.php
index c326573740997..fa33e828bfda2 100644
--- a/apps/admin_audit/lib/AuditLogger.php
+++ b/apps/admin_audit/lib/AuditLogger.php
@@ -49,39 +49,39 @@ public function __construct(ILogFactory $logFactory, IConfig $config) {
$this->parentLogger = $logFactory->getCustomPsrLogger($logFile, $auditType, $auditTag);
}
- public function emergency($message, array $context = array()): void {
+ public function emergency($message, array $context = []): void {
$this->parentLogger->emergency($message, $context);
}
- public function alert($message, array $context = array()): void {
+ public function alert($message, array $context = []): void {
$this->parentLogger->alert($message, $context);
}
- public function critical($message, array $context = array()): void {
+ public function critical($message, array $context = []): void {
$this->parentLogger->critical($message, $context);
}
- public function error($message, array $context = array()): void {
+ public function error($message, array $context = []): void {
$this->parentLogger->error($message, $context);
}
- public function warning($message, array $context = array()): void {
+ public function warning($message, array $context = []): void {
$this->parentLogger->warning($message, $context);
}
- public function notice($message, array $context = array()): void {
+ public function notice($message, array $context = []): void {
$this->parentLogger->notice($message, $context);
}
- public function info($message, array $context = array()): void {
+ public function info($message, array $context = []): void {
$this->parentLogger->info($message, $context);
}
- public function debug($message, array $context = array()): void {
+ public function debug($message, array $context = []): void {
$this->parentLogger->debug($message, $context);
}
- public function log($level, $message, array $context = array()): void {
+ public function log($level, $message, array $context = []): void {
$this->parentLogger->log($level, $message, $context);
}
}
diff --git a/apps/cloud_federation_api/lib/Capabilities.php b/apps/cloud_federation_api/lib/Capabilities.php
index 9b04145caa231..ad7e0889ba59d 100644
--- a/apps/cloud_federation_api/lib/Capabilities.php
+++ b/apps/cloud_federation_api/lib/Capabilities.php
@@ -66,7 +66,7 @@ public function getCapabilities() {
$this->provider->setApiVersion(self::API_VERSION);
$pos = strrpos($url, '/');
- if (false === $pos) {
+ if ($pos === false) {
throw new OCMArgumentException('generated route should contains a slash character');
}
diff --git a/apps/comments/lib/Activity/Provider.php b/apps/comments/lib/Activity/Provider.php
index b139b18371d28..2f0f8e314cb74 100644
--- a/apps/comments/lib/Activity/Provider.php
+++ b/apps/comments/lib/Activity/Provider.php
@@ -54,7 +54,7 @@ public function __construct(
* @throws \InvalidArgumentException
* @since 11.0.0
*/
- public function parse($language, IEvent $event, IEvent $previousEvent = null): IEvent {
+ public function parse($language, IEvent $event, ?IEvent $previousEvent = null): IEvent {
if ($event->getApp() !== 'comments') {
throw new \InvalidArgumentException();
}
diff --git a/apps/contactsinteraction/tests/Db/RecentContactMapperTest.php b/apps/contactsinteraction/tests/Db/RecentContactMapperTest.php
index 7042de9c1b0b9..f0a4ddcaac4fe 100644
--- a/apps/contactsinteraction/tests/Db/RecentContactMapperTest.php
+++ b/apps/contactsinteraction/tests/Db/RecentContactMapperTest.php
@@ -107,7 +107,7 @@ public function testCleanUp(): void {
$this->assertCount(0, $this->recentContactMapper->findAll('admin'));
}
- protected function createRecentContact(string $email = null, string $federatedCloudId = null): RecentContact {
+ protected function createRecentContact(?string $email = null, ?string $federatedCloudId = null): RecentContact {
$props = [
'URI' => UUIDUtil::getUUID(),
'FN' => 'Foo Bar',
diff --git a/apps/dav/appinfo/v2/direct.php b/apps/dav/appinfo/v2/direct.php
index c4676e62c4f93..37e4feeb6e041 100644
--- a/apps/dav/appinfo/v2/direct.php
+++ b/apps/dav/appinfo/v2/direct.php
@@ -24,7 +24,7 @@
* along with this program. If not, see .
*
*/
-use \OCA\DAV\Direct\ServerFactory;
+use OCA\DAV\Direct\ServerFactory;
// no php execution timeout for webdav
if (!str_contains(@ini_get('disable_functions'), 'set_time_limit')) {
diff --git a/apps/dav/lib/CalDAV/Activity/Provider/Calendar.php b/apps/dav/lib/CalDAV/Activity/Provider/Calendar.php
index daab7806e4678..e4cc5fadf7c28 100644
--- a/apps/dav/lib/CalDAV/Activity/Provider/Calendar.php
+++ b/apps/dav/lib/CalDAV/Activity/Provider/Calendar.php
@@ -83,7 +83,7 @@ public function __construct(IFactory $languageFactory, IURLGenerator $url, IMana
* @throws \InvalidArgumentException
* @since 11.0.0
*/
- public function parse($language, IEvent $event, IEvent $previousEvent = null) {
+ public function parse($language, IEvent $event, ?IEvent $previousEvent = null) {
if ($event->getApp() !== 'dav' || $event->getType() !== 'calendar') {
throw new \InvalidArgumentException();
}
diff --git a/apps/dav/lib/CalDAV/Activity/Provider/Event.php b/apps/dav/lib/CalDAV/Activity/Provider/Event.php
index 13f0036b0b032..4dcb18fdb908f 100644
--- a/apps/dav/lib/CalDAV/Activity/Provider/Event.php
+++ b/apps/dav/lib/CalDAV/Activity/Provider/Event.php
@@ -121,7 +121,7 @@ protected function generateObjectParameter(array $eventData) {
* @throws \InvalidArgumentException
* @since 11.0.0
*/
- public function parse($language, IEvent $event, IEvent $previousEvent = null) {
+ public function parse($language, IEvent $event, ?IEvent $previousEvent = null) {
if ($event->getApp() !== 'dav' || $event->getType() !== 'calendar_event') {
throw new \InvalidArgumentException();
}
diff --git a/apps/dav/lib/CalDAV/Activity/Provider/Todo.php b/apps/dav/lib/CalDAV/Activity/Provider/Todo.php
index e2ddb99a1af7f..0a8434b959564 100644
--- a/apps/dav/lib/CalDAV/Activity/Provider/Todo.php
+++ b/apps/dav/lib/CalDAV/Activity/Provider/Todo.php
@@ -36,7 +36,7 @@ class Todo extends Event {
* @throws \InvalidArgumentException
* @since 11.0.0
*/
- public function parse($language, IEvent $event, IEvent $previousEvent = null) {
+ public function parse($language, IEvent $event, ?IEvent $previousEvent = null) {
if ($event->getApp() !== 'dav' || $event->getType() !== 'calendar_todo') {
throw new \InvalidArgumentException();
}
diff --git a/apps/dav/lib/CalDAV/BirthdayService.php b/apps/dav/lib/CalDAV/BirthdayService.php
index 5d1d55879ca3f..93344e33186da 100644
--- a/apps/dav/lib/CalDAV/BirthdayService.php
+++ b/apps/dav/lib/CalDAV/BirthdayService.php
@@ -470,7 +470,7 @@ private function getReminderOffsetForUser(string $userPrincipal):?string {
*/
private function formatTitle(string $field,
string $name,
- int $year = null,
+ ?int $year = null,
bool $supports4Byte = true):string {
if ($supports4Byte) {
switch ($field) {
diff --git a/apps/dav/lib/CalDAV/CalDavBackend.php b/apps/dav/lib/CalDAV/CalDavBackend.php
index 3abb9d584c1a5..a6c00a59174ce 100644
--- a/apps/dav/lib/CalDAV/CalDavBackend.php
+++ b/apps/dav/lib/CalDAV/CalDavBackend.php
@@ -2169,7 +2169,7 @@ public function searchPrincipalUri(string $principalUri,
->andWhere($searchOr)
->andWhere($calendarObjectIdQuery->expr()->isNull('deleted_at'));
- if ('' !== $pattern) {
+ if ($pattern !== '') {
if (!$escapePattern) {
$calendarObjectIdQuery->andWhere($calendarObjectIdQuery->expr()->ilike('cob.value', $calendarObjectIdQuery->createNamedParameter($pattern)));
} else {
diff --git a/apps/dav/lib/CalDAV/Reminder/ReminderService.php b/apps/dav/lib/CalDAV/Reminder/ReminderService.php
index 9ededb8d01592..9f4b55824e8fa 100644
--- a/apps/dav/lib/CalDAV/Reminder/ReminderService.php
+++ b/apps/dav/lib/CalDAV/Reminder/ReminderService.php
@@ -392,8 +392,8 @@ public function onCalendarObjectDelete(array $objectData):void {
private function getRemindersForVAlarm(VAlarm $valarm,
array $objectData,
DateTimeZone $calendarTimeZone,
- string $eventHash = null,
- string $alarmHash = null,
+ ?string $eventHash = null,
+ ?string $alarmHash = null,
bool $isRecurring = false,
bool $isRecurrenceException = false):array {
if ($eventHash === null) {
diff --git a/apps/dav/lib/CalDAV/Schedule/Plugin.php b/apps/dav/lib/CalDAV/Schedule/Plugin.php
index 2ccecc8131c82..a1297fd2cf1d8 100644
--- a/apps/dav/lib/CalDAV/Schedule/Plugin.php
+++ b/apps/dav/lib/CalDAV/Schedule/Plugin.php
@@ -57,7 +57,7 @@
use Sabre\VObject\Parameter;
use Sabre\VObject\Property;
use Sabre\VObject\Reader;
-use function \Sabre\Uri\split;
+use function Sabre\Uri\split;
class Plugin extends \Sabre\CalDAV\Schedule\Plugin {
@@ -457,7 +457,7 @@ private function getCurrentAttendee(ITip\Message $iTipMessage):?Property {
* @param Property|null $attendee
* @return bool
*/
- private function getAttendeeRSVP(Property $attendee = null):bool {
+ private function getAttendeeRSVP(?Property $attendee = null):bool {
if ($attendee !== null) {
$rsvp = $attendee->offsetGet('RSVP');
if (($rsvp instanceof Parameter) && (strcasecmp($rsvp->getValue(), 'TRUE') === 0)) {
diff --git a/apps/dav/lib/CalDAV/Status/StatusService.php b/apps/dav/lib/CalDAV/Status/StatusService.php
index 9dccd4e77a3fb..29129a3b0732b 100644
--- a/apps/dav/lib/CalDAV/Status/StatusService.php
+++ b/apps/dav/lib/CalDAV/Status/StatusService.php
@@ -154,7 +154,7 @@ private function getCalendarEvents(User $user): array {
}
$sct = $calendarObject->getSchedulingTransparency();
- if ($sct !== null && ScheduleCalendarTransp::TRANSPARENT == strtolower($sct->getValue())) {
+ if ($sct !== null && strtolower($sct->getValue()) == ScheduleCalendarTransp::TRANSPARENT) {
// If a calendar is marked as 'transparent', it means we must
// ignore it for free-busy purposes.
continue;
diff --git a/apps/dav/lib/CardDAV/Activity/Provider/Addressbook.php b/apps/dav/lib/CardDAV/Activity/Provider/Addressbook.php
index a9ed767ffc719..a404dde4448a7 100644
--- a/apps/dav/lib/CardDAV/Activity/Provider/Addressbook.php
+++ b/apps/dav/lib/CardDAV/Activity/Provider/Addressbook.php
@@ -71,7 +71,7 @@ public function __construct(IFactory $languageFactory,
* @return IEvent
* @throws \InvalidArgumentException
*/
- public function parse($language, IEvent $event, IEvent $previousEvent = null): IEvent {
+ public function parse($language, IEvent $event, ?IEvent $previousEvent = null): IEvent {
if ($event->getApp() !== 'dav' || $event->getType() !== 'contacts') {
throw new \InvalidArgumentException();
}
diff --git a/apps/dav/lib/CardDAV/Activity/Provider/Card.php b/apps/dav/lib/CardDAV/Activity/Provider/Card.php
index 8f205942d4bce..7f49a428caee6 100644
--- a/apps/dav/lib/CardDAV/Activity/Provider/Card.php
+++ b/apps/dav/lib/CardDAV/Activity/Provider/Card.php
@@ -73,7 +73,7 @@ public function __construct(IFactory $languageFactory,
* @return IEvent
* @throws \InvalidArgumentException
*/
- public function parse($language, IEvent $event, IEvent $previousEvent = null): IEvent {
+ public function parse($language, IEvent $event, ?IEvent $previousEvent = null): IEvent {
if ($event->getApp() !== 'dav' || $event->getType() !== 'contacts') {
throw new \InvalidArgumentException();
}
diff --git a/apps/dav/lib/CardDAV/CardDavBackend.php b/apps/dav/lib/CardDAV/CardDavBackend.php
index e9ffe6f25e926..f887e3b32b755 100644
--- a/apps/dav/lib/CardDAV/CardDavBackend.php
+++ b/apps/dav/lib/CardDAV/CardDavBackend.php
@@ -1151,7 +1151,7 @@ private function searchByAddressBookIds(array $addressBookIds,
->andWhere($query2->expr()->in('cp.name', $query2->createNamedParameter($searchProperties, IQueryBuilder::PARAM_STR_ARRAY)));
// No need for like when the pattern is empty
- if ('' !== $pattern) {
+ if ($pattern !== '') {
if (!$useWildcards) {
$query2->andWhere($query2->expr()->eq('cp.value', $query2->createNamedParameter($pattern)));
} elseif (!$escapePattern) {
diff --git a/apps/dav/lib/CardDAV/SyncService.php b/apps/dav/lib/CardDAV/SyncService.php
index 66927d35e0421..01747a9b10512 100644
--- a/apps/dav/lib/CardDAV/SyncService.php
+++ b/apps/dav/lib/CardDAV/SyncService.php
@@ -271,7 +271,10 @@ public function getLocalSystemAddressBook() {
return $this->localSystemAddressBook;
}
- public function syncInstance(\Closure $progressCallback = null) {
+ /**
+ * @return void
+ */
+ public function syncInstance(?\Closure $progressCallback = null) {
$systemAddressBook = $this->getLocalSystemAddressBook();
$this->userManager->callForAllUsers(function ($user) use ($systemAddressBook, $progressCallback) {
$this->updateUser($user);
diff --git a/apps/dav/lib/Command/MoveCalendar.php b/apps/dav/lib/Command/MoveCalendar.php
index a3045797ff45f..7269a5ad4f3ed 100644
--- a/apps/dav/lib/Command/MoveCalendar.php
+++ b/apps/dav/lib/Command/MoveCalendar.php
@@ -93,7 +93,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$calendar = $this->calDav->getCalendarByUri(self::URI_USERS . $userOrigin, $name);
- if (null === $calendar) {
+ if ($calendar === null) {
throw new \InvalidArgumentException("User <$userOrigin> has no calendar named <$name>. You can run occ dav:list-calendars to list calendars URIs for this user.");
}
@@ -133,7 +133,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
* Check if the calendar exists for user
*/
protected function calendarExists(string $userDestination, string $name): bool {
- return null !== $this->calDav->getCalendarByUri(self::URI_USERS . $userDestination, $name);
+ return $this->calDav->getCalendarByUri(self::URI_USERS . $userDestination, $name) !== null;
}
/**
@@ -172,7 +172,7 @@ private function checkShares(array $calendar, string $userOrigin, string $userDe
* Check that user destination is member of the groups which whom the calendar was shared
* If we ask to force the migration, the share with the group is dropped
*/
- if ($this->shareManager->shareWithGroupMembersOnly() === true && 'groups' === $prefix && !$this->groupManager->isInGroup($userDestination, $userOrGroup)) {
+ if ($this->shareManager->shareWithGroupMembersOnly() === true && $prefix === 'groups' && !$this->groupManager->isInGroup($userDestination, $userOrGroup)) {
if ($force) {
$this->calDav->updateShares(new Calendar($this->calDav, $calendar, $this->l10n, $this->config, $this->logger), [], ['principal:principals/groups/' . $userOrGroup]);
} else {
diff --git a/apps/dav/lib/Comments/EntityCollection.php b/apps/dav/lib/Comments/EntityCollection.php
index 2581ff0c367af..1b6139a34a24b 100644
--- a/apps/dav/lib/Comments/EntityCollection.php
+++ b/apps/dav/lib/Comments/EntityCollection.php
@@ -130,7 +130,7 @@ public function getChildren() {
* @param \DateTime|null $datetime
* @return CommentNode[]
*/
- public function findChildren($limit = 0, $offset = 0, \DateTime $datetime = null) {
+ public function findChildren($limit = 0, $offset = 0, ?\DateTime $datetime = null) {
$comments = $this->commentsManager->getForObject($this->name, $this->id, $limit, $offset, $datetime);
$result = [];
foreach ($comments as $comment) {
diff --git a/apps/dav/lib/Connector/Sabre/CachingTree.php b/apps/dav/lib/Connector/Sabre/CachingTree.php
index b1bccce36201f..54038468dc56e 100644
--- a/apps/dav/lib/Connector/Sabre/CachingTree.php
+++ b/apps/dav/lib/Connector/Sabre/CachingTree.php
@@ -46,7 +46,7 @@ public function markDirty($path) {
$path = trim($path, '/');
foreach ($this->cache as $nodePath => $node) {
$nodePath = (string) $nodePath;
- if ('' === $path || $nodePath == $path || str_starts_with($nodePath, $path . '/')) {
+ if ($path === '' || $nodePath == $path || str_starts_with($nodePath, $path . '/')) {
unset($this->cache[$nodePath]);
}
}
diff --git a/apps/dav/lib/Connector/Sabre/Directory.php b/apps/dav/lib/Connector/Sabre/Directory.php
index 441e6ea8f570c..e40b8d760eb48 100644
--- a/apps/dav/lib/Connector/Sabre/Directory.php
+++ b/apps/dav/lib/Connector/Sabre/Directory.php
@@ -72,7 +72,7 @@ class Directory extends \OCA\DAV\Connector\Sabre\Node implements \Sabre\DAV\ICol
/**
* Sets up the node, expects a full path name
*/
- public function __construct(View $view, FileInfo $info, ?CachingTree $tree = null, IShareManager $shareManager = null) {
+ public function __construct(View $view, FileInfo $info, ?CachingTree $tree = null, ?IShareManager $shareManager = null) {
parent::__construct($view, $info, $shareManager);
$this->tree = $tree;
}
@@ -202,7 +202,7 @@ public function createDirectory($name) {
* @throws \Sabre\DAV\Exception\NotFound
* @throws \Sabre\DAV\Exception\ServiceUnavailable
*/
- public function getChild($name, $info = null, IRequest $request = null, IL10N $l10n = null) {
+ public function getChild($name, $info = null, ?IRequest $request = null, ?IL10N $l10n = null) {
if (!$this->info->isReadable()) {
// avoid detecting files through this way
throw new NotFound();
diff --git a/apps/dav/lib/Connector/Sabre/Exception/FileLocked.php b/apps/dav/lib/Connector/Sabre/Exception/FileLocked.php
index 36063da8d6573..83e01f290b872 100644
--- a/apps/dav/lib/Connector/Sabre/Exception/FileLocked.php
+++ b/apps/dav/lib/Connector/Sabre/Exception/FileLocked.php
@@ -29,7 +29,11 @@
use Exception;
class FileLocked extends \Sabre\DAV\Exception {
- public function __construct($message = "", $code = 0, Exception $previous = null) {
+ /**
+ * @param string $message
+ * @param int $code
+ */
+ public function __construct($message = "", $code = 0, ?Exception $previous = null) {
if ($previous instanceof \OCP\Files\LockNotAcquiredException) {
$message = sprintf('Target file %s is locked by another process.', $previous->path);
}
diff --git a/apps/dav/lib/Connector/Sabre/Exception/Forbidden.php b/apps/dav/lib/Connector/Sabre/Exception/Forbidden.php
index a5eed91170125..d71b837ade29b 100644
--- a/apps/dav/lib/Connector/Sabre/Exception/Forbidden.php
+++ b/apps/dav/lib/Connector/Sabre/Exception/Forbidden.php
@@ -35,7 +35,7 @@ class Forbidden extends \Sabre\DAV\Exception\Forbidden {
* @param bool $retry
* @param \Exception $previous
*/
- public function __construct($message, $retry = false, \Exception $previous = null) {
+ public function __construct($message, $retry = false, ?\Exception $previous = null) {
parent::__construct($message, 0, $previous);
$this->retry = $retry;
}
diff --git a/apps/dav/lib/Connector/Sabre/Exception/InvalidPath.php b/apps/dav/lib/Connector/Sabre/Exception/InvalidPath.php
index 9d1fda339a233..a8ca0aea97d32 100644
--- a/apps/dav/lib/Connector/Sabre/Exception/InvalidPath.php
+++ b/apps/dav/lib/Connector/Sabre/Exception/InvalidPath.php
@@ -38,7 +38,7 @@ class InvalidPath extends Exception {
* @param bool $retry
* @param \Exception|null $previous
*/
- public function __construct($message, $retry = false, \Exception $previous = null) {
+ public function __construct($message, $retry = false, ?\Exception $previous = null) {
parent::__construct($message, 0, $previous);
$this->retry = $retry;
}
diff --git a/apps/dav/lib/Connector/Sabre/File.php b/apps/dav/lib/Connector/Sabre/File.php
index f188490fd938f..f54fbbdd15aa3 100644
--- a/apps/dav/lib/Connector/Sabre/File.php
+++ b/apps/dav/lib/Connector/Sabre/File.php
@@ -89,7 +89,7 @@ class File extends Node implements IFile {
* @param ?IRequest $request
* @param ?IL10N $l10n
*/
- public function __construct(View $view, FileInfo $info, IManager $shareManager = null, IRequest $request = null, IL10N $l10n = null) {
+ public function __construct(View $view, FileInfo $info, ?IManager $shareManager = null, ?IRequest $request = null, ?IL10N $l10n = null) {
parent::__construct($view, $info, $shareManager);
if ($l10n) {
diff --git a/apps/dav/lib/Connector/Sabre/FilesPlugin.php b/apps/dav/lib/Connector/Sabre/FilesPlugin.php
index cd692602df834..7c9c709987875 100644
--- a/apps/dav/lib/Connector/Sabre/FilesPlugin.php
+++ b/apps/dav/lib/Connector/Sabre/FilesPlugin.php
@@ -563,7 +563,7 @@ public function handleUpdateProperties($path, PropPatch $propPatch) {
*/
private function handleUpdatePropertiesMetadata(PropPatch $propPatch, Node $node): void {
$userId = $this->userSession->getUser()?->getUID();
- if (null === $userId) {
+ if ($userId === null) {
return;
}
@@ -664,10 +664,11 @@ private function getMetadataFileAccessRight(Node $node, string $userId): int {
/**
* @param string $filePath
- * @param \Sabre\DAV\INode $node
+ * @param ?\Sabre\DAV\INode $node
+ * @return void
* @throws \Sabre\DAV\Exception\BadRequest
*/
- public function sendFileIdHeader($filePath, \Sabre\DAV\INode $node = null) {
+ public function sendFileIdHeader($filePath, ?\Sabre\DAV\INode $node = null) {
// chunked upload handling
if (isset($_SERVER['HTTP_OC_CHUNKED'])) {
[$path, $name] = \Sabre\Uri\split($filePath);
diff --git a/apps/dav/lib/Connector/Sabre/Node.php b/apps/dav/lib/Connector/Sabre/Node.php
index 5237064b46f01..2b77dc08e8dbe 100644
--- a/apps/dav/lib/Connector/Sabre/Node.php
+++ b/apps/dav/lib/Connector/Sabre/Node.php
@@ -79,7 +79,7 @@ abstract class Node implements \Sabre\DAV\INode {
/**
* Sets up the node, expects a full path name
*/
- public function __construct(View $view, FileInfo $info, IManager $shareManager = null) {
+ public function __construct(View $view, FileInfo $info, ?IManager $shareManager = null) {
$this->fileView = $view;
$this->path = $this->fileView->getRelativePath($info->getPath());
$this->info = $info;
diff --git a/apps/dav/lib/DAV/Sharing/Xml/Invite.php b/apps/dav/lib/DAV/Sharing/Xml/Invite.php
index e6219f2bbfe07..3c03dfa5d2589 100644
--- a/apps/dav/lib/DAV/Sharing/Xml/Invite.php
+++ b/apps/dav/lib/DAV/Sharing/Xml/Invite.php
@@ -85,7 +85,7 @@ class Invite implements XmlSerializable {
*
* @param array $users
*/
- public function __construct(array $users, array $organizer = null) {
+ public function __construct(array $users, ?array $organizer = null) {
$this->users = $users;
$this->organizer = $organizer;
}
diff --git a/apps/dav/lib/HookManager.php b/apps/dav/lib/HookManager.php
index 1e7990af32f7c..46cf9621f4774 100644
--- a/apps/dav/lib/HookManager.php
+++ b/apps/dav/lib/HookManager.php
@@ -163,7 +163,10 @@ public function changeUser($params) {
}
}
- public function firstLogin(IUser $user = null) {
+ /**
+ * @return void
+ */
+ public function firstLogin(?IUser $user = null) {
if (!is_null($user)) {
$principal = 'principals/users/' . $user->getUID();
if ($this->calDav->getCalendarsForUserCount($principal) === 0) {
diff --git a/apps/dav/tests/unit/CalDAV/Reminder/NotificationProvider/EmailProviderTest.php b/apps/dav/tests/unit/CalDAV/Reminder/NotificationProvider/EmailProviderTest.php
index fb98552507841..f5a2890207a40 100644
--- a/apps/dav/tests/unit/CalDAV/Reminder/NotificationProvider/EmailProviderTest.php
+++ b/apps/dav/tests/unit/CalDAV/Reminder/NotificationProvider/EmailProviderTest.php
@@ -367,7 +367,7 @@ private function getTemplateMock():IEMailTemplate {
* @param array|null $replyTo
* @return IMessage
*/
- private function getMessageMock(string $toMail, IEMailTemplate $templateMock, array $replyTo = null):IMessage {
+ private function getMessageMock(string $toMail, IEMailTemplate $templateMock, ?array $replyTo = null):IMessage {
$message = $this->createMock(IMessage::class);
$i = 0;
diff --git a/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php b/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php
index 942718f7ce553..4cd65a341b029 100644
--- a/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php
+++ b/apps/dav/tests/unit/CardDAV/CardDavBackendTest.php
@@ -99,35 +99,35 @@ class CardDavBackendTest extends TestCase {
public const UNIT_TEST_GROUP = 'principals/groups/carddav-unit-test-group';
private $vcardTest0 = 'BEGIN:VCARD'.PHP_EOL.
- 'VERSION:3.0'.PHP_EOL.
- 'PRODID:-//Sabre//Sabre VObject 4.1.2//EN'.PHP_EOL.
- 'UID:Test'.PHP_EOL.
- 'FN:Test'.PHP_EOL.
- 'N:Test;;;;'.PHP_EOL.
- 'END:VCARD';
+ 'VERSION:3.0'.PHP_EOL.
+ 'PRODID:-//Sabre//Sabre VObject 4.1.2//EN'.PHP_EOL.
+ 'UID:Test'.PHP_EOL.
+ 'FN:Test'.PHP_EOL.
+ 'N:Test;;;;'.PHP_EOL.
+ 'END:VCARD';
private $vcardTest1 = 'BEGIN:VCARD'.PHP_EOL.
- 'VERSION:3.0'.PHP_EOL.
- 'PRODID:-//Sabre//Sabre VObject 4.1.2//EN'.PHP_EOL.
- 'UID:Test2'.PHP_EOL.
- 'FN:Test2'.PHP_EOL.
- 'N:Test2;;;;'.PHP_EOL.
- 'END:VCARD';
+ 'VERSION:3.0'.PHP_EOL.
+ 'PRODID:-//Sabre//Sabre VObject 4.1.2//EN'.PHP_EOL.
+ 'UID:Test2'.PHP_EOL.
+ 'FN:Test2'.PHP_EOL.
+ 'N:Test2;;;;'.PHP_EOL.
+ 'END:VCARD';
private $vcardTest2 = 'BEGIN:VCARD'.PHP_EOL.
- 'VERSION:3.0'.PHP_EOL.
- 'PRODID:-//Sabre//Sabre VObject 4.1.2//EN'.PHP_EOL.
- 'UID:Test3'.PHP_EOL.
- 'FN:Test3'.PHP_EOL.
- 'N:Test3;;;;'.PHP_EOL.
- 'END:VCARD';
+ 'VERSION:3.0'.PHP_EOL.
+ 'PRODID:-//Sabre//Sabre VObject 4.1.2//EN'.PHP_EOL.
+ 'UID:Test3'.PHP_EOL.
+ 'FN:Test3'.PHP_EOL.
+ 'N:Test3;;;;'.PHP_EOL.
+ 'END:VCARD';
private $vcardTestNoUID = 'BEGIN:VCARD'.PHP_EOL.
- 'VERSION:3.0'.PHP_EOL.
- 'PRODID:-//Sabre//Sabre VObject 4.1.2//EN'.PHP_EOL.
- 'FN:TestNoUID'.PHP_EOL.
- 'N:TestNoUID;;;;'.PHP_EOL.
- 'END:VCARD';
+ 'VERSION:3.0'.PHP_EOL.
+ 'PRODID:-//Sabre//Sabre VObject 4.1.2//EN'.PHP_EOL.
+ 'FN:TestNoUID'.PHP_EOL.
+ 'N:TestNoUID;;;;'.PHP_EOL.
+ 'END:VCARD';
protected function setUp(): void {
parent::setUp();
diff --git a/apps/dav/tests/unit/Connector/Sabre/FileTest.php b/apps/dav/tests/unit/Connector/Sabre/FileTest.php
index 36dc550a8a392..688b1ac6b44b9 100644
--- a/apps/dav/tests/unit/Connector/Sabre/FileTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/FileTest.php
@@ -318,7 +318,7 @@ function ($path) use ($storage) {
*
* @return null|string of the PUT operation which is usually the etag
*/
- private function doPut($path, $viewRoot = null, Request $request = null) {
+ private function doPut($path, $viewRoot = null, ?Request $request = null) {
$view = \OC\Files\Filesystem::getView();
if (!is_null($viewRoot)) {
$view = new \OC\Files\View($viewRoot);
@@ -1124,7 +1124,7 @@ function () use ($view, $path, &$wasLockedPost): void {
*
* @return array list of part files
*/
- private function listPartFiles(\OC\Files\View $userView = null, $path = '') {
+ private function listPartFiles(?\OC\Files\View $userView = null, $path = '') {
if ($userView === null) {
$userView = \OC\Files\Filesystem::getView();
}
@@ -1150,7 +1150,7 @@ private function listPartFiles(\OC\Files\View $userView = null, $path = '') {
* @param View $userView
* @return array
*/
- private function getFileInfos($path = '', View $userView = null) {
+ private function getFileInfos($path = '', ?View $userView = null) {
if ($userView === null) {
$userView = Filesystem::getView();
}
diff --git a/apps/dav/tests/unit/Files/MultipartRequestParserTest.php b/apps/dav/tests/unit/Files/MultipartRequestParserTest.php
index 745a568b8ad2c..0edf68e6c095d 100644
--- a/apps/dav/tests/unit/Files/MultipartRequestParserTest.php
+++ b/apps/dav/tests/unit/Files/MultipartRequestParserTest.php
@@ -22,7 +22,7 @@
namespace OCA\DAV\Tests\unit\DAV;
-use \OCA\DAV\BulkUpload\MultipartRequestParser;
+use OCA\DAV\BulkUpload\MultipartRequestParser;
use Psr\Log\LoggerInterface;
use Test\TestCase;
diff --git a/apps/encryption/lib/Hooks/UserHooks.php b/apps/encryption/lib/Hooks/UserHooks.php
index 487e108949565..27eba0ad781e1 100644
--- a/apps/encryption/lib/Hooks/UserHooks.php
+++ b/apps/encryption/lib/Hooks/UserHooks.php
@@ -210,9 +210,9 @@ public function setPassphrase($params) {
$this->logger->error('Encryption could not update users encryption password');
}
- // NOTE: Session does not need to be updated as the
- // private key has not changed, only the passphrase
- // used to decrypt it has changed
+ // NOTE: Session does not need to be updated as the
+ // private key has not changed, only the passphrase
+ // used to decrypt it has changed
} else { // admin changed the password for a different user, create new keys and re-encrypt file keys
$userId = $params['uid'];
$this->initMountPoints($userId);
diff --git a/apps/files/lib/Activity/FavoriteProvider.php b/apps/files/lib/Activity/FavoriteProvider.php
index 9c7018e6a5c6e..c96d5b5debe7a 100644
--- a/apps/files/lib/Activity/FavoriteProvider.php
+++ b/apps/files/lib/Activity/FavoriteProvider.php
@@ -71,7 +71,7 @@ public function __construct(IFactory $languageFactory, IURLGenerator $url, IMana
* @throws \InvalidArgumentException
* @since 11.0.0
*/
- public function parse($language, IEvent $event, IEvent $previousEvent = null) {
+ public function parse($language, IEvent $event, ?IEvent $previousEvent = null) {
if ($event->getApp() !== 'files' || $event->getType() !== 'favorite') {
throw new \InvalidArgumentException();
}
@@ -125,7 +125,7 @@ public function parseShortVersion(IEvent $event) {
* @throws \InvalidArgumentException
* @since 11.0.0
*/
- public function parseLongVersion(IEvent $event, IEvent $previousEvent = null) {
+ public function parseLongVersion(IEvent $event, ?IEvent $previousEvent = null) {
if ($event->getSubject() === self::SUBJECT_ADDED) {
$subject = $this->l->t('You added {file} to your favorites');
if ($this->activityManager->getRequirePNG()) {
diff --git a/apps/files/lib/Activity/Provider.php b/apps/files/lib/Activity/Provider.php
index 50535cab5c6d2..662ea98d0b9a8 100644
--- a/apps/files/lib/Activity/Provider.php
+++ b/apps/files/lib/Activity/Provider.php
@@ -102,7 +102,7 @@ public function __construct(IFactory $languageFactory,
* @throws \InvalidArgumentException
* @since 11.0.0
*/
- public function parse($language, IEvent $event, IEvent $previousEvent = null) {
+ public function parse($language, IEvent $event, ?IEvent $previousEvent = null) {
if ($event->getApp() !== 'files') {
throw new \InvalidArgumentException();
}
@@ -136,7 +136,7 @@ protected function setIcon(IEvent $event, string $icon, string $app = 'files') {
* @throws \InvalidArgumentException
* @since 11.0.0
*/
- public function parseShortVersion(IEvent $event, IEvent $previousEvent = null) {
+ public function parseShortVersion(IEvent $event, ?IEvent $previousEvent = null) {
$parsedParameters = $this->getParameters($event);
if ($event->getSubject() === 'created_by') {
@@ -178,7 +178,7 @@ public function parseShortVersion(IEvent $event, IEvent $previousEvent = null) {
* @throws \InvalidArgumentException
* @since 11.0.0
*/
- public function parseLongVersion(IEvent $event, IEvent $previousEvent = null) {
+ public function parseLongVersion(IEvent $event, ?IEvent $previousEvent = null) {
$this->fileIsEncrypted = false;
$parsedParameters = $this->getParameters($event);
@@ -368,7 +368,7 @@ protected function getParameters(IEvent $event) {
* @return array
* @throws \InvalidArgumentException
*/
- protected function getFile($parameter, IEvent $event = null) {
+ protected function getFile($parameter, ?IEvent $event = null) {
if (is_array($parameter)) {
$path = reset($parameter);
$id = (string) key($parameter);
diff --git a/apps/files/lib/Collaboration/Resources/ResourceProvider.php b/apps/files/lib/Collaboration/Resources/ResourceProvider.php
index a15e15580572c..a1a944bc56a7f 100644
--- a/apps/files/lib/Collaboration/Resources/ResourceProvider.php
+++ b/apps/files/lib/Collaboration/Resources/ResourceProvider.php
@@ -107,7 +107,7 @@ public function getResourceRichObject(IResource $resource): array {
* @return bool
* @since 16.0.0
*/
- public function canAccessResource(IResource $resource, IUser $user = null): bool {
+ public function canAccessResource(IResource $resource, ?IUser $user = null): bool {
if (!$user instanceof IUser) {
return false;
}
diff --git a/apps/files/lib/Controller/DirectEditingController.php b/apps/files/lib/Controller/DirectEditingController.php
index 5d2162c69e055..ab061382a2de7 100644
--- a/apps/files/lib/Controller/DirectEditingController.php
+++ b/apps/files/lib/Controller/DirectEditingController.php
@@ -79,7 +79,7 @@ public function info(): DataResponse {
* 200: URL for direct editing returned
* 403: Opening file is not allowed
*/
- public function create(string $path, string $editorId, string $creatorId, string $templateId = null): DataResponse {
+ public function create(string $path, string $editorId, string $creatorId, ?string $templateId = null): DataResponse {
if (!$this->directEditingManager->isEnabled()) {
return new DataResponse(['message' => 'Direct editing is not enabled'], Http::STATUS_INTERNAL_SERVER_ERROR);
}
@@ -115,7 +115,7 @@ public function create(string $path, string $editorId, string $creatorId, string
* 200: URL for direct editing returned
* 403: Opening file is not allowed
*/
- public function open(string $path, string $editorId = null, ?int $fileId = null): DataResponse {
+ public function open(string $path, ?string $editorId = null, ?int $fileId = null): DataResponse {
if (!$this->directEditingManager->isEnabled()) {
return new DataResponse(['message' => 'Direct editing is not enabled'], Http::STATUS_INTERNAL_SERVER_ERROR);
}
diff --git a/apps/files/lib/Controller/ViewController.php b/apps/files/lib/Controller/ViewController.php
index 2934ac06704c7..67cd0bf2aefff 100644
--- a/apps/files/lib/Controller/ViewController.php
+++ b/apps/files/lib/Controller/ViewController.php
@@ -135,7 +135,7 @@ protected function getStorageInfo(string $dir = '/') {
* @param string $fileid
* @return TemplateResponse|RedirectResponse
*/
- public function showFile(string $fileid = null): Response {
+ public function showFile(?string $fileid = null): Response {
if (!$fileid) {
return new RedirectResponse($this->urlGenerator->linkToRoute('files.view.index'));
}
diff --git a/apps/files_external/lib/Lib/Auth/Password/GlobalAuth.php b/apps/files_external/lib/Lib/Auth/Password/GlobalAuth.php
index dff5bf8662533..174efd96e3c29 100644
--- a/apps/files_external/lib/Lib/Auth/Password/GlobalAuth.php
+++ b/apps/files_external/lib/Lib/Auth/Password/GlobalAuth.php
@@ -70,7 +70,10 @@ public function saveAuth($uid, $user, $password) {
]);
}
- public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = null) {
+ /**
+ * @return void
+ */
+ public function manipulateStorageConfig(StorageConfig &$storage, ?IUser $user = null) {
if ($storage->getType() === StorageConfig::MOUNT_TYPE_ADMIN) {
$uid = '';
} elseif (is_null($user)) {
diff --git a/apps/files_external/lib/Lib/Auth/Password/LoginCredentials.php b/apps/files_external/lib/Lib/Auth/Password/LoginCredentials.php
index e6c2be70056f9..5dc290d3548cd 100644
--- a/apps/files_external/lib/Lib/Auth/Password/LoginCredentials.php
+++ b/apps/files_external/lib/Lib/Auth/Password/LoginCredentials.php
@@ -112,7 +112,10 @@ private function getCredentials(IUser $user): array {
return $credentials;
}
- public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = null) {
+ /**
+ * @return void
+ */
+ public function manipulateStorageConfig(StorageConfig &$storage, ?IUser $user = null) {
if (!isset($user)) {
throw new InsufficientDataForMeaningfulAnswerException('No login credentials saved');
}
diff --git a/apps/files_external/lib/Lib/Auth/Password/SessionCredentials.php b/apps/files_external/lib/Lib/Auth/Password/SessionCredentials.php
index a1add7c870f6a..d2587991a96e2 100644
--- a/apps/files_external/lib/Lib/Auth/Password/SessionCredentials.php
+++ b/apps/files_external/lib/Lib/Auth/Password/SessionCredentials.php
@@ -51,7 +51,10 @@ public function __construct(IL10N $l, CredentialsStore $credentialsStore) {
->addParameters([]);
}
- public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = null) {
+ /**
+ * @return void
+ */
+ public function manipulateStorageConfig(StorageConfig &$storage, ?IUser $user = null) {
try {
$credentials = $this->credentialsStore->getLoginCredentials();
} catch (CredentialsUnavailableException $e) {
diff --git a/apps/files_external/lib/Lib/Auth/Password/UserGlobalAuth.php b/apps/files_external/lib/Lib/Auth/Password/UserGlobalAuth.php
index d8ed217b3363b..d43c4327b6ba5 100644
--- a/apps/files_external/lib/Lib/Auth/Password/UserGlobalAuth.php
+++ b/apps/files_external/lib/Lib/Auth/Password/UserGlobalAuth.php
@@ -69,7 +69,10 @@ public function saveBackendOptions(IUser $user, $id, $backendOptions) {
$this->credentialsManager->store($user->getUID(), self::CREDENTIALS_IDENTIFIER, $credentials);
}
- public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = null) {
+ /**
+ * @return void
+ */
+ public function manipulateStorageConfig(StorageConfig &$storage, ?IUser $user = null) {
if ($user === null) {
throw new InsufficientDataForMeaningfulAnswerException('No credentials saved');
}
diff --git a/apps/files_external/lib/Lib/Auth/Password/UserProvided.php b/apps/files_external/lib/Lib/Auth/Password/UserProvided.php
index 87bf96aeae16d..7fcbdb383368e 100644
--- a/apps/files_external/lib/Lib/Auth/Password/UserProvided.php
+++ b/apps/files_external/lib/Lib/Auth/Password/UserProvided.php
@@ -71,7 +71,10 @@ public function saveBackendOptions(IUser $user, $mountId, array $options) {
]);
}
- public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = null) {
+ /**
+ * @return void
+ */
+ public function manipulateStorageConfig(StorageConfig &$storage, ?IUser $user = null) {
if (!isset($user)) {
throw new InsufficientDataForMeaningfulAnswerException('No credentials saved');
}
diff --git a/apps/files_external/lib/Lib/Auth/PublicKey/RSA.php b/apps/files_external/lib/Lib/Auth/PublicKey/RSA.php
index c9ed8d1b9e38d..67259ffc5b396 100644
--- a/apps/files_external/lib/Lib/Auth/PublicKey/RSA.php
+++ b/apps/files_external/lib/Lib/Auth/PublicKey/RSA.php
@@ -56,7 +56,10 @@ public function __construct(IL10N $l, IConfig $config) {
;
}
- public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = null) {
+ /**
+ * @return void
+ */
+ public function manipulateStorageConfig(StorageConfig &$storage, ?IUser $user = null) {
$auth = new RSACrypt();
$auth->setPassword($this->config->getSystemValue('secret', ''));
if (!$auth->loadKey($storage->getBackendOption('private_key'))) {
diff --git a/apps/files_external/lib/Lib/Auth/PublicKey/RSAPrivateKey.php b/apps/files_external/lib/Lib/Auth/PublicKey/RSAPrivateKey.php
index c648173a82b7c..30ff5dd2a4c21 100644
--- a/apps/files_external/lib/Lib/Auth/PublicKey/RSAPrivateKey.php
+++ b/apps/files_external/lib/Lib/Auth/PublicKey/RSAPrivateKey.php
@@ -54,7 +54,10 @@ public function __construct(IL10N $l, IConfig $config) {
]);
}
- public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = null) {
+ /**
+ * @return void
+ */
+ public function manipulateStorageConfig(StorageConfig &$storage, ?IUser $user = null) {
$auth = new RSACrypt();
$auth->setPassword($this->config->getSystemValue('secret', ''));
if (!$auth->loadKey($storage->getBackendOption('private_key'))) {
diff --git a/apps/files_external/lib/Lib/Backend/InvalidBackend.php b/apps/files_external/lib/Lib/Backend/InvalidBackend.php
index 3a5355774472f..88c7347027936 100644
--- a/apps/files_external/lib/Lib/Backend/InvalidBackend.php
+++ b/apps/files_external/lib/Lib/Backend/InvalidBackend.php
@@ -60,7 +60,10 @@ public function getInvalidId() {
return $this->invalidId;
}
- public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = null) {
+ /**
+ * @return void
+ */
+ public function manipulateStorageConfig(StorageConfig &$storage, ?IUser $user = null) {
$storage->setBackendOption('exception', new \Exception('Unknown storage backend "' . $this->invalidId . '"', StorageNotAvailableException::STATUS_ERROR));
}
}
diff --git a/apps/files_external/lib/Lib/Backend/Local.php b/apps/files_external/lib/Lib/Backend/Local.php
index bd15cb461271b..41b8e2fbad732 100644
--- a/apps/files_external/lib/Lib/Backend/Local.php
+++ b/apps/files_external/lib/Lib/Backend/Local.php
@@ -48,7 +48,7 @@ public function __construct(IL10N $l, NullMechanism $legacyAuth) {
;
}
- public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = null): void {
+ public function manipulateStorageConfig(StorageConfig &$storage, ?IUser $user = null): void {
$storage->setBackendOption('isExternal', true);
}
}
diff --git a/apps/files_external/lib/Lib/Backend/SMB.php b/apps/files_external/lib/Lib/Backend/SMB.php
index 9ac10025ea021..29f6c727a1074 100644
--- a/apps/files_external/lib/Lib/Backend/SMB.php
+++ b/apps/files_external/lib/Lib/Backend/SMB.php
@@ -77,7 +77,10 @@ public function __construct(IL10N $l, Password $legacyAuth) {
->setLegacyAuthMechanism($legacyAuth);
}
- public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = null) {
+ /**
+ * @return void
+ */
+ public function manipulateStorageConfig(StorageConfig &$storage, ?IUser $user = null) {
$auth = $storage->getAuthMechanism();
if ($auth->getScheme() === AuthMechanism::SCHEME_PASSWORD) {
if (!is_string($storage->getBackendOption('user')) || !is_string($storage->getBackendOption('password'))) {
diff --git a/apps/files_external/lib/Lib/Backend/SMB_OC.php b/apps/files_external/lib/Lib/Backend/SMB_OC.php
index 35743c5bc3bf0..5f1ed3b833483 100644
--- a/apps/files_external/lib/Lib/Backend/SMB_OC.php
+++ b/apps/files_external/lib/Lib/Backend/SMB_OC.php
@@ -60,7 +60,10 @@ public function __construct(IL10N $l, SessionCredentials $legacyAuth, SMB $smbBa
;
}
- public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = null) {
+ /**
+ * @return void
+ */
+ public function manipulateStorageConfig(StorageConfig &$storage, ?IUser $user = null) {
$username_as_share = ($storage->getBackendOption('username_as_share') === true);
if ($username_as_share) {
diff --git a/apps/files_external/lib/Lib/InsufficientDataForMeaningfulAnswerException.php b/apps/files_external/lib/Lib/InsufficientDataForMeaningfulAnswerException.php
index b2301543d8ea1..0e5c0be069ccf 100644
--- a/apps/files_external/lib/Lib/InsufficientDataForMeaningfulAnswerException.php
+++ b/apps/files_external/lib/Lib/InsufficientDataForMeaningfulAnswerException.php
@@ -38,7 +38,7 @@ class InsufficientDataForMeaningfulAnswerException extends StorageNotAvailableEx
* @param \Exception|null $previous
* @since 6.0.0
*/
- public function __construct($message = '', $code = self::STATUS_INDETERMINATE, \Exception $previous = null) {
+ public function __construct($message = '', $code = self::STATUS_INDETERMINATE, ?\Exception $previous = null) {
parent::__construct($message, $code, $previous);
}
}
diff --git a/apps/files_external/lib/Lib/Storage/FTP.php b/apps/files_external/lib/Lib/Storage/FTP.php
index 72b97f5a42fd0..544ebc2c52906 100644
--- a/apps/files_external/lib/Lib/Storage/FTP.php
+++ b/apps/files_external/lib/Lib/Storage/FTP.php
@@ -301,7 +301,7 @@ public function fopen($path, $mode) {
return false;
}
- public function writeStream(string $path, $stream, int $size = null): int {
+ public function writeStream(string $path, $stream, ?int $size = null): int {
if ($size === null) {
$stream = CountWrapper::wrap($stream, function ($writtenSize) use (&$size) {
$size = $writtenSize;
diff --git a/apps/files_external/lib/Lib/Storage/SFTP.php b/apps/files_external/lib/Lib/Storage/SFTP.php
index 3fa04209fa005..e6fc5dd3e2241 100644
--- a/apps/files_external/lib/Lib/Storage/SFTP.php
+++ b/apps/files_external/lib/Lib/Storage/SFTP.php
@@ -500,7 +500,7 @@ public function file_put_contents($path, $data) {
}
}
- public function writeStream(string $path, $stream, int $size = null): int {
+ public function writeStream(string $path, $stream, ?int $size = null): int {
if ($size === null) {
$stream = CountWrapper::wrap($stream, function (int $writtenSize) use (&$size) {
$size = $writtenSize;
diff --git a/apps/files_external/lib/Lib/StorageModifierTrait.php b/apps/files_external/lib/Lib/StorageModifierTrait.php
index 48e91531cc1f5..096e091576eaa 100644
--- a/apps/files_external/lib/Lib/StorageModifierTrait.php
+++ b/apps/files_external/lib/Lib/StorageModifierTrait.php
@@ -46,10 +46,11 @@ trait StorageModifierTrait {
*
* @param StorageConfig $storage
* @param IUser $user User the storage is being used as
+ * @return void
* @throws InsufficientDataForMeaningfulAnswerException
* @throws StorageNotAvailableException
*/
- public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = null) {
+ public function manipulateStorageConfig(StorageConfig &$storage, ?IUser $user = null) {
}
/**
diff --git a/apps/files_external/lib/MountConfig.php b/apps/files_external/lib/MountConfig.php
index 5ddff0f57fc0a..6c13ab3b727ba 100644
--- a/apps/files_external/lib/MountConfig.php
+++ b/apps/files_external/lib/MountConfig.php
@@ -88,7 +88,7 @@ public function __construct(
* @throws \OCP\AppFramework\QueryException
* @since 16.0.0
*/
- public static function substitutePlaceholdersInConfig($input, string $userId = null) {
+ public static function substitutePlaceholdersInConfig($input, ?string $userId = null) {
/** @var BackendService $backendService */
$backendService = \OC::$server->get(BackendService::class);
/** @var IConfigHandler[] $handlers */
diff --git a/apps/files_external/lib/Service/UserGlobalStoragesService.php b/apps/files_external/lib/Service/UserGlobalStoragesService.php
index 2eda36e92429d..3a269e3622def 100644
--- a/apps/files_external/lib/Service/UserGlobalStoragesService.php
+++ b/apps/files_external/lib/Service/UserGlobalStoragesService.php
@@ -183,7 +183,7 @@ protected function isApplicable(StorageConfig $config) {
* @param IUser|null $user user to get the storages for, if not set the currently logged in user will be used
* @return StorageConfig[] array of storage configs
*/
- public function getAllStoragesForUser(IUser $user = null) {
+ public function getAllStoragesForUser(?IUser $user = null) {
if (is_null($user)) {
$user = $this->getUser();
}
diff --git a/apps/files_external/templates/settings.php b/apps/files_external/templates/settings.php
index c6525a8be8376..6d6e9fd5b8596 100644
--- a/apps/files_external/templates/settings.php
+++ b/apps/files_external/templates/settings.php
@@ -1,8 +1,8 @@
getApp() !== 'files_sharing') {
throw new \InvalidArgumentException();
}
@@ -119,7 +119,7 @@ abstract protected function parseShortVersion(IEvent $event);
* @throws \InvalidArgumentException
* @since 11.0.0
*/
- abstract protected function parseLongVersion(IEvent $event, IEvent $previousEvent = null);
+ abstract protected function parseLongVersion(IEvent $event, ?IEvent $previousEvent = null);
/**
* @throws \InvalidArgumentException
@@ -134,7 +134,7 @@ protected function setSubjects(IEvent $event, string $subject, array $parameters
* @return array
* @throws \InvalidArgumentException
*/
- protected function getFile($parameter, IEvent $event = null) {
+ protected function getFile($parameter, ?IEvent $event = null) {
if (is_array($parameter)) {
$path = reset($parameter);
$id = (string) key($parameter);
diff --git a/apps/files_sharing/lib/Activity/Providers/Downloads.php b/apps/files_sharing/lib/Activity/Providers/Downloads.php
index 8152e0b08853a..3566431757d2d 100644
--- a/apps/files_sharing/lib/Activity/Providers/Downloads.php
+++ b/apps/files_sharing/lib/Activity/Providers/Downloads.php
@@ -68,7 +68,7 @@ public function parseShortVersion(IEvent $event) {
* @throws \InvalidArgumentException
* @since 11.0.0
*/
- public function parseLongVersion(IEvent $event, IEvent $previousEvent = null) {
+ public function parseLongVersion(IEvent $event, ?IEvent $previousEvent = null) {
$parsedParameters = $this->getParsedParameters($event);
if ($event->getSubject() === self::SUBJECT_PUBLIC_SHARED_FILE_DOWNLOADED ||
diff --git a/apps/files_sharing/lib/Activity/Providers/Groups.php b/apps/files_sharing/lib/Activity/Providers/Groups.php
index a6e6fae3e9bf4..ac6aaba9dbf15 100644
--- a/apps/files_sharing/lib/Activity/Providers/Groups.php
+++ b/apps/files_sharing/lib/Activity/Providers/Groups.php
@@ -102,7 +102,7 @@ public function parseShortVersion(IEvent $event) {
* @throws \InvalidArgumentException
* @since 11.0.0
*/
- public function parseLongVersion(IEvent $event, IEvent $previousEvent = null) {
+ public function parseLongVersion(IEvent $event, ?IEvent $previousEvent = null) {
$parsedParameters = $this->getParsedParameters($event);
if ($event->getSubject() === self::SUBJECT_SHARED_GROUP_SELF) {
diff --git a/apps/files_sharing/lib/Activity/Providers/PublicLinks.php b/apps/files_sharing/lib/Activity/Providers/PublicLinks.php
index c09b9baa9513a..264e3c7d5f769 100644
--- a/apps/files_sharing/lib/Activity/Providers/PublicLinks.php
+++ b/apps/files_sharing/lib/Activity/Providers/PublicLinks.php
@@ -75,7 +75,7 @@ public function parseShortVersion(IEvent $event) {
* @throws \InvalidArgumentException
* @since 11.0.0
*/
- public function parseLongVersion(IEvent $event, IEvent $previousEvent = null) {
+ public function parseLongVersion(IEvent $event, ?IEvent $previousEvent = null) {
$parsedParameters = $this->getParsedParameters($event);
if ($event->getSubject() === self::SUBJECT_SHARED_LINK_SELF) {
diff --git a/apps/files_sharing/lib/Activity/Providers/RemoteShares.php b/apps/files_sharing/lib/Activity/Providers/RemoteShares.php
index b46db3105e950..ea9e689558613 100644
--- a/apps/files_sharing/lib/Activity/Providers/RemoteShares.php
+++ b/apps/files_sharing/lib/Activity/Providers/RemoteShares.php
@@ -83,7 +83,7 @@ public function parseShortVersion(IEvent $event) {
* @throws \InvalidArgumentException
* @since 11.0.0
*/
- public function parseLongVersion(IEvent $event, IEvent $previousEvent = null) {
+ public function parseLongVersion(IEvent $event, ?IEvent $previousEvent = null) {
$parsedParameters = $this->getParsedParameters($event);
if ($event->getSubject() === self::SUBJECT_REMOTE_SHARE_RECEIVED) {
diff --git a/apps/files_sharing/lib/Activity/Providers/Users.php b/apps/files_sharing/lib/Activity/Providers/Users.php
index ce873eb5f77ab..26ddbb0631872 100644
--- a/apps/files_sharing/lib/Activity/Providers/Users.php
+++ b/apps/files_sharing/lib/Activity/Providers/Users.php
@@ -91,7 +91,7 @@ public function parseShortVersion(IEvent $event) {
* @throws \InvalidArgumentException
* @since 11.0.0
*/
- public function parseLongVersion(IEvent $event, IEvent $previousEvent = null) {
+ public function parseLongVersion(IEvent $event, ?IEvent $previousEvent = null) {
$parsedParameters = $this->getParsedParameters($event);
if ($event->getSubject() === self::SUBJECT_SHARED_USER_SELF) {
diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php
index c9a1486db2fe2..4a01d97cdf0fe 100644
--- a/apps/files_sharing/lib/Controller/ShareAPIController.php
+++ b/apps/files_sharing/lib/Controller/ShareAPIController.php
@@ -134,7 +134,7 @@ public function __construct(
IUserManager $userManager,
IRootFolder $rootFolder,
IURLGenerator $urlGenerator,
- string $userId = null,
+ ?string $userId = null,
IL10N $l10n,
IConfig $config,
IAppManager $appManager,
@@ -170,7 +170,7 @@ public function __construct(
*
* @suppress PhanUndeclaredClassMethod
*/
- protected function formatShare(IShare $share, Node $recipientNode = null): array {
+ protected function formatShare(IShare $share, ?Node $recipientNode = null): array {
$sharedBy = $this->userManager->get($share->getSharedBy());
$shareOwner = $this->userManager->get($share->getShareOwner());
@@ -600,17 +600,17 @@ public function deleteShare(string $id): DataResponse {
* 200: Share created
*/
public function createShare(
- string $path = null,
- int $permissions = null,
+ ?string $path = null,
+ ?int $permissions = null,
int $shareType = -1,
- string $shareWith = null,
+ ?string $shareWith = null,
string $publicUpload = 'false',
string $password = '',
- string $sendPasswordByTalk = null,
+ ?string $sendPasswordByTalk = null,
string $expireDate = '',
string $note = '',
string $label = '',
- string $attributes = null
+ ?string $attributes = null
): DataResponse {
$share = $this->shareManager->newShare();
@@ -1209,15 +1209,15 @@ private function hasPermission(int $permissionsSet, int $permissionsToCheck): bo
*/
public function updateShare(
string $id,
- int $permissions = null,
- string $password = null,
- string $sendPasswordByTalk = null,
- string $publicUpload = null,
- string $expireDate = null,
- string $note = null,
- string $label = null,
- string $hideDownload = null,
- string $attributes = null
+ ?int $permissions = null,
+ ?string $password = null,
+ ?string $sendPasswordByTalk = null,
+ ?string $publicUpload = null,
+ ?string $expireDate = null,
+ ?string $note = null,
+ ?string $label = null,
+ ?string $hideDownload = null,
+ ?string $attributes = null
): DataResponse {
try {
$share = $this->getShareById($id);
diff --git a/apps/files_sharing/lib/Controller/ShareesAPIController.php b/apps/files_sharing/lib/Controller/ShareesAPIController.php
index de601607f2c9b..31014ac6565a7 100644
--- a/apps/files_sharing/lib/Controller/ShareesAPIController.php
+++ b/apps/files_sharing/lib/Controller/ShareesAPIController.php
@@ -131,7 +131,7 @@ public function __construct(
*
* 200: Sharees search result returned
*/
- public function search(string $search = '', string $itemType = null, int $page = 1, int $perPage = 200, $shareType = null, bool $lookup = false): DataResponse {
+ public function search(string $search = '', ?string $itemType = null, int $page = 1, int $perPage = 200, $shareType = null, bool $lookup = false): DataResponse {
// only search for string larger than a given threshold
$threshold = $this->config->getSystemValueInt('sharing.minSearchStringLength', 0);
diff --git a/apps/files_sharing/lib/External/Storage.php b/apps/files_sharing/lib/External/Storage.php
index 7b64690d53e17..8cd0b50f44ffd 100644
--- a/apps/files_sharing/lib/External/Storage.php
+++ b/apps/files_sharing/lib/External/Storage.php
@@ -95,7 +95,7 @@ public function __construct($options) {
$host = parse_url($remote, PHP_URL_HOST);
$port = parse_url($remote, PHP_URL_PORT);
- $host .= (null === $port) ? '' : ':' . $port; // we add port if available
+ $host .= ($port === null) ? '' : ':' . $port; // we add port if available
// in case remote NC is on a sub folder and using deprecated ocm provider
$tmpPath = rtrim(parse_url($this->cloudId->getRemote(), PHP_URL_PATH) ?? '', '/');
diff --git a/apps/files_sharing/lib/Helper.php b/apps/files_sharing/lib/Helper.php
index 931301a04c4b5..c080a4f611c55 100644
--- a/apps/files_sharing/lib/Helper.php
+++ b/apps/files_sharing/lib/Helper.php
@@ -68,7 +68,7 @@ public static function generateUniqueTarget($path, $excludeList, $view) {
* @param string|null $userId
* @return string
*/
- public static function getShareFolder(View $view = null, string $userId = null): string {
+ public static function getShareFolder(?View $view = null, ?string $userId = null): string {
if ($view === null) {
$view = Filesystem::getView();
}
diff --git a/apps/files_sharing/lib/ShareBackend/File.php b/apps/files_sharing/lib/ShareBackend/File.php
index 23096d6415669..4dec20cabd9ae 100644
--- a/apps/files_sharing/lib/ShareBackend/File.php
+++ b/apps/files_sharing/lib/ShareBackend/File.php
@@ -51,7 +51,7 @@ class File implements \OCP\Share_Backend_File_Dependent {
/** @var FederatedShareProvider */
private $federatedShareProvider;
- public function __construct(FederatedShareProvider $federatedShareProvider = null) {
+ public function __construct(?FederatedShareProvider $federatedShareProvider = null) {
if ($federatedShareProvider) {
$this->federatedShareProvider = $federatedShareProvider;
} else {
diff --git a/apps/files_trashbin/lib/Command/ExpireTrash.php b/apps/files_trashbin/lib/Command/ExpireTrash.php
index e64ef2973f76a..048631db7a54a 100644
--- a/apps/files_trashbin/lib/Command/ExpireTrash.php
+++ b/apps/files_trashbin/lib/Command/ExpireTrash.php
@@ -52,8 +52,8 @@ class ExpireTrash extends Command {
* @param IUserManager|null $userManager
* @param Expiration|null $expiration
*/
- public function __construct(IUserManager $userManager = null,
- Expiration $expiration = null) {
+ public function __construct(?IUserManager $userManager = null,
+ ?Expiration $expiration = null) {
parent::__construct();
$this->userManager = $userManager;
diff --git a/apps/files_trashbin/lib/Events/BeforeNodeRestoredEvent.php b/apps/files_trashbin/lib/Events/BeforeNodeRestoredEvent.php
index 9c1bf4e891063..2996343800253 100644
--- a/apps/files_trashbin/lib/Events/BeforeNodeRestoredEvent.php
+++ b/apps/files_trashbin/lib/Events/BeforeNodeRestoredEvent.php
@@ -40,7 +40,7 @@ public function __construct(Node $source, Node $target, private bool &$run) {
/**
* @return never
*/
- public function abortOperation(\Throwable $ex = null) {
+ public function abortOperation(?\Throwable $ex = null) {
$this->stopPropagation();
$this->run = false;
if ($ex !== null) {
diff --git a/apps/files_trashbin/lib/Storage.php b/apps/files_trashbin/lib/Storage.php
index e1470e7634a5c..11ace4248d96c 100644
--- a/apps/files_trashbin/lib/Storage.php
+++ b/apps/files_trashbin/lib/Storage.php
@@ -61,11 +61,11 @@ class Storage extends Wrapper {
*/
public function __construct(
$parameters,
- ITrashManager $trashManager = null,
- IUserManager $userManager = null,
- LoggerInterface $logger = null,
- IEventDispatcher $eventDispatcher = null,
- IRootFolder $rootFolder = null
+ ?ITrashManager $trashManager = null,
+ ?IUserManager $userManager = null,
+ ?LoggerInterface $logger = null,
+ ?IEventDispatcher $eventDispatcher = null,
+ ?IRootFolder $rootFolder = null
) {
$this->mountPoint = $parameters['mountPoint'];
$this->trashManager = $trashManager;
diff --git a/apps/files_trashbin/lib/Trash/LegacyTrashBackend.php b/apps/files_trashbin/lib/Trash/LegacyTrashBackend.php
index ada42dbe857fb..a608dc08331e3 100644
--- a/apps/files_trashbin/lib/Trash/LegacyTrashBackend.php
+++ b/apps/files_trashbin/lib/Trash/LegacyTrashBackend.php
@@ -51,7 +51,7 @@ public function __construct(IRootFolder $rootFolder) {
* @param ITrashItem $parent
* @return ITrashItem[]
*/
- private function mapTrashItems(array $items, IUser $user, ITrashItem $parent = null): array {
+ private function mapTrashItems(array $items, IUser $user, ?ITrashItem $parent = null): array {
$parentTrashPath = ($parent instanceof ITrashItem) ? $parent->getTrashPath() : '';
$isRoot = $parent === null;
return array_map(function (FileInfo $file) use ($parent, $parentTrashPath, $isRoot, $user) {
diff --git a/apps/provisioning_api/lib/Controller/GroupsController.php b/apps/provisioning_api/lib/Controller/GroupsController.php
index d140c5d60b139..8d6ba5e3ed44a 100644
--- a/apps/provisioning_api/lib/Controller/GroupsController.php
+++ b/apps/provisioning_api/lib/Controller/GroupsController.php
@@ -117,7 +117,7 @@ public function getGroups(string $search = '', ?int $limit = null, int $offset =
*
* 200: Groups details returned
*/
- public function getGroupsDetails(string $search = '', int $limit = null, int $offset = 0): DataResponse {
+ public function getGroupsDetails(string $search = '', ?int $limit = null, int $offset = 0): DataResponse {
$groups = $this->groupManager->search($search, $limit, $offset);
$groups = array_map(function ($group) {
/** @var IGroup $group */
@@ -209,7 +209,7 @@ public function getGroupUsers(string $groupId): DataResponse {
*
* 200: Group users details returned
*/
- public function getGroupUsersDetails(string $groupId, string $search = '', int $limit = null, int $offset = 0): DataResponse {
+ public function getGroupUsersDetails(string $groupId, string $search = '', ?int $limit = null, int $offset = 0): DataResponse {
$groupId = urldecode($groupId);
$currentUser = $this->userSession->getUser();
diff --git a/apps/provisioning_api/lib/Controller/UsersController.php b/apps/provisioning_api/lib/Controller/UsersController.php
index 1833166a4c6aa..7a25f3e47c62c 100644
--- a/apps/provisioning_api/lib/Controller/UsersController.php
+++ b/apps/provisioning_api/lib/Controller/UsersController.php
@@ -129,7 +129,7 @@ public function __construct(
*
* 200: Users returned
*/
- public function getUsers(string $search = '', int $limit = null, int $offset = 0): DataResponse {
+ public function getUsers(string $search = '', ?int $limit = null, int $offset = 0): DataResponse {
$user = $this->userSession->getUser();
$users = [];
@@ -170,7 +170,7 @@ public function getUsers(string $search = '', int $limit = null, int $offset = 0
*
* 200: Users details returned
*/
- public function getUsersDetails(string $search = '', int $limit = null, int $offset = 0): DataResponse {
+ public function getUsersDetails(string $search = '', ?int $limit = null, int $offset = 0): DataResponse {
$currentUser = $this->userSession->getUser();
$users = [];
diff --git a/apps/settings/lib/Activity/GroupProvider.php b/apps/settings/lib/Activity/GroupProvider.php
index 32e6438d97241..15b2612889024 100644
--- a/apps/settings/lib/Activity/GroupProvider.php
+++ b/apps/settings/lib/Activity/GroupProvider.php
@@ -64,7 +64,7 @@ public function __construct(L10nFactory $l10n,
$this->groupManager = $groupManager;
}
- public function parse($language, IEvent $event, IEvent $previousEvent = null) {
+ public function parse($language, IEvent $event, ?IEvent $previousEvent = null) {
if ($event->getType() !== 'group_settings') {
throw new InvalidArgumentException();
}
diff --git a/apps/settings/lib/Activity/Provider.php b/apps/settings/lib/Activity/Provider.php
index 001f75ba5e65c..e10e55b5750cb 100644
--- a/apps/settings/lib/Activity/Provider.php
+++ b/apps/settings/lib/Activity/Provider.php
@@ -83,7 +83,7 @@ public function __construct(IFactory $languageFactory,
* @throws \InvalidArgumentException
* @since 11.0.0
*/
- public function parse($language, IEvent $event, IEvent $previousEvent = null): IEvent {
+ public function parse($language, IEvent $event, ?IEvent $previousEvent = null): IEvent {
if ($event->getApp() !== 'settings') {
throw new \InvalidArgumentException('Unknown app');
}
diff --git a/apps/settings/lib/Activity/SecurityProvider.php b/apps/settings/lib/Activity/SecurityProvider.php
index cdf7b80298d5e..f847a53d4bf6f 100644
--- a/apps/settings/lib/Activity/SecurityProvider.php
+++ b/apps/settings/lib/Activity/SecurityProvider.php
@@ -51,7 +51,7 @@ public function __construct(L10nFactory $l10n, IURLGenerator $urlGenerator, IMan
$this->activityManager = $activityManager;
}
- public function parse($language, IEvent $event, IEvent $previousEvent = null) {
+ public function parse($language, IEvent $event, ?IEvent $previousEvent = null) {
if ($event->getType() !== 'security') {
throw new InvalidArgumentException();
}
diff --git a/apps/settings/lib/Controller/ChangePasswordController.php b/apps/settings/lib/Controller/ChangePasswordController.php
index 50d72e582dd1d..f9fa07ed73a5b 100644
--- a/apps/settings/lib/Controller/ChangePasswordController.php
+++ b/apps/settings/lib/Controller/ChangePasswordController.php
@@ -79,7 +79,7 @@ public function __construct(string $appName,
* @NoSubAdminRequired
* @BruteForceProtection(action=changePersonalPassword)
*/
- public function changePersonalPassword(string $oldpassword = '', string $newpassword = null): JSONResponse {
+ public function changePersonalPassword(string $oldpassword = '', ?string $newpassword = null): JSONResponse {
$loginName = $this->userSession->getLoginName();
/** @var IUser $user */
$user = $this->userManager->checkPassword($loginName, $oldpassword);
@@ -127,7 +127,7 @@ public function changePersonalPassword(string $oldpassword = '', string $newpass
* @NoAdminRequired
* @PasswordConfirmationRequired
*/
- public function changeUserPassword(string $username = null, string $password = null, string $recoveryPassword = null): JSONResponse {
+ public function changeUserPassword(?string $username = null, ?string $password = null, ?string $recoveryPassword = null): JSONResponse {
if ($username === null) {
return new JSONResponse([
'status' => 'error',
diff --git a/apps/settings/lib/Controller/UsersController.php b/apps/settings/lib/Controller/UsersController.php
index 10b8f6908129a..2cfe9d515bf1d 100644
--- a/apps/settings/lib/Controller/UsersController.php
+++ b/apps/settings/lib/Controller/UsersController.php
@@ -391,10 +391,10 @@ public function setUserSettings(?string $avatarScope = null,
continue;
}
$property = $userAccount->getProperty($property);
- if (null !== $data['value']) {
+ if ($data['value'] !== null) {
$property->setValue($data['value']);
}
- if (null !== $data['scope']) {
+ if ($data['scope'] !== null) {
$property->setScope($data['scope']);
}
}
diff --git a/apps/settings/lib/Mailer/NewUserMailHelper.php b/apps/settings/lib/Mailer/NewUserMailHelper.php
index 2d41577f5545b..03c5f4bc3acde 100644
--- a/apps/settings/lib/Mailer/NewUserMailHelper.php
+++ b/apps/settings/lib/Mailer/NewUserMailHelper.php
@@ -108,7 +108,7 @@ public function generateTemplate(IUser $user, $generatePasswordResetToken = fals
ISecureRandom::CHAR_ALPHANUMERIC
);
$tokenValue = $this->timeFactory->getTime() . ':' . $token;
- $mailAddress = (null !== $user->getEMailAddress()) ? $user->getEMailAddress() : '';
+ $mailAddress = ($user->getEMailAddress() !== null) ? $user->getEMailAddress() : '';
$encryptedValue = $this->crypto->encrypt($tokenValue, $mailAddress . $this->config->getSystemValue('secret'));
$this->config->setUserValue($user->getUID(), 'core', 'lostpassword', $encryptedValue);
$link = $this->urlGenerator->linkToRouteAbsolute('core.lost.resetform', ['userId' => $user->getUID(), 'token' => $token]);
diff --git a/apps/settings/lib/SetupChecks/PhpOpcacheSetup.php b/apps/settings/lib/SetupChecks/PhpOpcacheSetup.php
index 07e4b5134976c..c6f5c9802ca8d 100644
--- a/apps/settings/lib/SetupChecks/PhpOpcacheSetup.php
+++ b/apps/settings/lib/SetupChecks/PhpOpcacheSetup.php
@@ -104,7 +104,7 @@ protected function getOpcacheSetupRecommendations(): array {
if (
// Do not recommend to raise the interned strings buffer size above a quarter of the total OPcache size
- ($this->iniGetWrapper->getNumeric('opcache.interned_strings_buffer') ?? 0 < $this->iniGetWrapper->getNumeric('opcache.memory_consumption') ?? 0 / 4) &&
+ ($this->iniGetWrapper->getNumeric('opcache.interned_strings_buffer') ?? $this->iniGetWrapper->getNumeric('opcache.memory_consumption') > 0 ?? 0 / 4) &&
(
empty($status['interned_strings_usage']['free_memory']) ||
($status['interned_strings_usage']['used_memory'] / $status['interned_strings_usage']['free_memory'] > 9)
diff --git a/apps/settings/templates/settings/personal/security/twofactor.php b/apps/settings/templates/settings/personal/security/twofactor.php
index 17d1e6e707445..0ec402bd6139a 100644
--- a/apps/settings/templates/settings/personal/security/twofactor.php
+++ b/apps/settings/templates/settings/personal/security/twofactor.php
@@ -41,7 +41,7 @@
//Handle 2FA provider icons and theme
if ($provider instanceof \OCP\Authentication\TwoFactorAuth\IProvidesIcons) {
$icon = $provider->getDarkIcon();
- //fallback icon if the 2factor provider doesn't provide an icon.
+ //fallback icon if the 2factor provider doesn't provide an icon.
} else {
$icon = image_path('core', 'actions/password.svg');
}
@@ -57,4 +57,3 @@
-
diff --git a/apps/sharebymail/lib/Activity.php b/apps/sharebymail/lib/Activity.php
index d1f15eb0e5465..b8df056c8b7d8 100644
--- a/apps/sharebymail/lib/Activity.php
+++ b/apps/sharebymail/lib/Activity.php
@@ -85,7 +85,7 @@ public function __construct(IFactory $languageFactory, IURLGenerator $url, IMana
* @throws \InvalidArgumentException
* @since 11.0.0
*/
- public function parse($language, IEvent $event, IEvent $previousEvent = null) {
+ public function parse($language, IEvent $event, ?IEvent $previousEvent = null) {
if ($event->getApp() !== 'sharebymail') {
throw new \InvalidArgumentException();
}
diff --git a/apps/systemtags/lib/Activity/Provider.php b/apps/systemtags/lib/Activity/Provider.php
index 63e000325d487..be268c57ca8f4 100644
--- a/apps/systemtags/lib/Activity/Provider.php
+++ b/apps/systemtags/lib/Activity/Provider.php
@@ -75,7 +75,7 @@ public function __construct(IFactory $languageFactory, IURLGenerator $url, IMana
* @throws \InvalidArgumentException
* @since 11.0.0
*/
- public function parse($language, IEvent $event, IEvent $previousEvent = null) {
+ public function parse($language, IEvent $event, ?IEvent $previousEvent = null) {
if ($event->getApp() !== 'systemtags') {
throw new \InvalidArgumentException();
}
diff --git a/apps/testing/lib/Controller/LockingController.php b/apps/testing/lib/Controller/LockingController.php
index 0c084b4f9cd28..2174b6784f484 100644
--- a/apps/testing/lib/Controller/LockingController.php
+++ b/apps/testing/lib/Controller/LockingController.php
@@ -199,7 +199,7 @@ public function isLocked(int $type, string $user, string $path): DataResponse {
throw new OCSException('', Http::STATUS_LOCKED);
}
- public function releaseAll(int $type = null): DataResponse {
+ public function releaseAll(?int $type = null): DataResponse {
$lockingProvider = $this->getLockingProvider();
foreach ($this->config->getAppKeys('testing') as $lock) {
diff --git a/apps/theming/lib/Controller/UserThemeController.php b/apps/theming/lib/Controller/UserThemeController.php
index 1ccce65290884..657c20036d36c 100644
--- a/apps/theming/lib/Controller/UserThemeController.php
+++ b/apps/theming/lib/Controller/UserThemeController.php
@@ -204,7 +204,7 @@ public function deleteBackground(): JSONResponse {
* 200: Background set successfully
* 400: Setting background is not possible
*/
- public function setBackground(string $type = BackgroundService::BACKGROUND_DEFAULT, string $value = '', string $color = null): JSONResponse {
+ public function setBackground(string $type = BackgroundService::BACKGROUND_DEFAULT, string $value = '', ?string $color = null): JSONResponse {
$currentVersion = (int)$this->config->getUserValue($this->userId, Application::APP_ID, 'userCacheBuster', '0');
// Set color if provided
diff --git a/apps/theming/lib/Service/ThemeInjectionService.php b/apps/theming/lib/Service/ThemeInjectionService.php
index 169bc0c02234b..c6ef6b9614d31 100644
--- a/apps/theming/lib/Service/ThemeInjectionService.php
+++ b/apps/theming/lib/Service/ThemeInjectionService.php
@@ -93,7 +93,7 @@ public function injectHeaders(): void {
* @param bool $plain request the :root syntax
* @param string $media media query to use in the element
*/
- private function addThemeHeaders(ITheme $theme, bool $plain = true, string $media = null): void {
+ private function addThemeHeaders(ITheme $theme, bool $plain = true, ?string $media = null): void {
$linkToCSS = $this->urlGenerator->linkToRoute('theming.Theming.getThemeStylesheet', [
'themeId' => $theme->getId(),
'plain' => $plain,
diff --git a/apps/theming/tests/Controller/UserThemeControllerTest.php b/apps/theming/tests/Controller/UserThemeControllerTest.php
index 500cb807e83b3..30d5b77bb6ca9 100644
--- a/apps/theming/tests/Controller/UserThemeControllerTest.php
+++ b/apps/theming/tests/Controller/UserThemeControllerTest.php
@@ -121,7 +121,7 @@ public function dataTestThemes() {
* @param string $themeId
* @param string $exception
*/
- public function testEnableTheme($themeId, string $exception = null) {
+ public function testEnableTheme($themeId, ?string $exception = null) {
$this->themesService
->expects($this->any())
->method('getThemes')
@@ -141,7 +141,7 @@ public function testEnableTheme($themeId, string $exception = null) {
* @param string $themeId
* @param string $exception
*/
- public function testDisableTheme($themeId, string $exception = null) {
+ public function testDisableTheme($themeId, ?string $exception = null) {
$this->themesService
->expects($this->any())
->method('getThemes')
diff --git a/apps/twofactor_backupcodes/lib/Activity/Provider.php b/apps/twofactor_backupcodes/lib/Activity/Provider.php
index 2d60c8fe3f108..ffb67fcab8d09 100644
--- a/apps/twofactor_backupcodes/lib/Activity/Provider.php
+++ b/apps/twofactor_backupcodes/lib/Activity/Provider.php
@@ -56,7 +56,7 @@ public function __construct(L10nFactory $l10n, IURLGenerator $urlGenerator, IMan
$this->l10n = $l10n;
}
- public function parse($language, IEvent $event, IEvent $previousEvent = null): IEvent {
+ public function parse($language, IEvent $event, ?IEvent $previousEvent = null): IEvent {
if ($event->getApp() !== 'twofactor_backupcodes') {
throw new InvalidArgumentException();
}
diff --git a/apps/twofactor_backupcodes/lib/Service/BackupCodeStorage.php b/apps/twofactor_backupcodes/lib/Service/BackupCodeStorage.php
index 9d4b6a28500b8..92c53e649175f 100644
--- a/apps/twofactor_backupcodes/lib/Service/BackupCodeStorage.php
+++ b/apps/twofactor_backupcodes/lib/Service/BackupCodeStorage.php
@@ -108,7 +108,7 @@ public function getBackupCodesState(IUser $user): array {
$total = count($codes);
$used = 0;
array_walk($codes, function (BackupCode $code) use (&$used) {
- if (1 === (int)$code->getUsed()) {
+ if ((int)$code->getUsed() === 1) {
$used++;
}
});
@@ -128,7 +128,7 @@ public function validateCode(IUser $user, string $code): bool {
$dbCodes = $this->mapper->getBackupCodes($user);
foreach ($dbCodes as $dbCode) {
- if (0 === (int)$dbCode->getUsed() && $this->hasher->verify($code, $dbCode->getCode())) {
+ if ((int)$dbCode->getUsed() === 0 && $this->hasher->verify($code, $dbCode->getCode())) {
$dbCode->setUsed(1);
$this->mapper->update($dbCode);
return true;
diff --git a/apps/user_ldap/lib/Access.php b/apps/user_ldap/lib/Access.php
index 3a1690c3b764b..a51dfc3b349f5 100644
--- a/apps/user_ldap/lib/Access.php
+++ b/apps/user_ldap/lib/Access.php
@@ -492,7 +492,7 @@ public function dn2username($fdn, $ldapName = null) {
* @return false|string with with the name to use in Nextcloud
* @throws \Exception
*/
- public function dn2ocname($fdn, $ldapName = null, $isUser = true, &$newlyMapped = null, array $record = null) {
+ public function dn2ocname($fdn, $ldapName = null, $isUser = true, &$newlyMapped = null, ?array $record = null) {
static $intermediates = [];
if (isset($intermediates[($isUser ? 'user-' : 'group-') . $fdn])) {
return false; // is a known intermediate
@@ -865,7 +865,7 @@ public function countUsersByLoginName($loginName) {
/**
* @throws \Exception
*/
- public function fetchListOfUsers(string $filter, array $attr, int $limit = null, int $offset = null, bool $forceApplyAttributes = false): array {
+ public function fetchListOfUsers(string $filter, array $attr, ?int $limit = null, ?int $offset = null, bool $forceApplyAttributes = false): array {
$ldapRecords = $this->searchUsers($filter, $attr, $limit, $offset);
$recordsToUpdate = $ldapRecords;
if (!$forceApplyAttributes) {
@@ -926,7 +926,7 @@ public function batchApplyUserAttributes(array $ldapRecords): void {
/**
* @return array[]
*/
- public function fetchListOfGroups(string $filter, array $attr, int $limit = null, int $offset = null): array {
+ public function fetchListOfGroups(string $filter, array $attr, ?int $limit = null, ?int $offset = null): array {
$cacheKey = 'fetchListOfGroups_' . $filter . '_' . implode('-', $attr) . '_' . (string)$limit . '_' . (string)$offset;
$listOfGroups = $this->connection->getFromCache($cacheKey);
if (!is_null($listOfGroups)) {
@@ -971,7 +971,7 @@ private function fetchList(array $list, bool $manyAttributes): array {
/**
* @throws ServerNotAvailableException
*/
- public function searchUsers(string $filter, array $attr = null, int $limit = null, int $offset = null): array {
+ public function searchUsers(string $filter, ?array $attr = null, ?int $limit = null, ?int $offset = null): array {
$result = [];
foreach ($this->connection->ldapBaseUsers as $base) {
$result = array_merge($result, $this->search($filter, $base, $attr, $limit, $offset));
@@ -984,7 +984,7 @@ public function searchUsers(string $filter, array $attr = null, int $limit = nul
* @return false|int
* @throws ServerNotAvailableException
*/
- public function countUsers(string $filter, array $attr = ['dn'], int $limit = null, int $offset = null) {
+ public function countUsers(string $filter, array $attr = ['dn'], ?int $limit = null, ?int $offset = null) {
$result = false;
foreach ($this->connection->ldapBaseUsers as $base) {
$count = $this->count($filter, [$base], $attr, $limit ?? 0, $offset ?? 0);
@@ -1001,7 +1001,7 @@ public function countUsers(string $filter, array $attr = ['dn'], int $limit = nu
* Executes an LDAP search
* @throws ServerNotAvailableException
*/
- public function searchGroups(string $filter, array $attr = null, int $limit = null, int $offset = null): array {
+ public function searchGroups(string $filter, ?array $attr = null, ?int $limit = null, ?int $offset = null): array {
$result = [];
foreach ($this->connection->ldapBaseGroups as $base) {
$result = array_merge($result, $this->search($filter, $base, $attr, $limit, $offset));
@@ -1015,7 +1015,7 @@ public function searchGroups(string $filter, array $attr = null, int $limit = nu
* @return int|bool
* @throws ServerNotAvailableException
*/
- public function countGroups(string $filter, array $attr = ['dn'], int $limit = null, int $offset = null) {
+ public function countGroups(string $filter, array $attr = ['dn'], ?int $limit = null, ?int $offset = null) {
$result = false;
foreach ($this->connection->ldapBaseGroups as $base) {
$count = $this->count($filter, [$base], $attr, $limit ?? 0, $offset ?? 0);
@@ -1030,7 +1030,7 @@ public function countGroups(string $filter, array $attr = ['dn'], int $limit = n
* @return int|bool
* @throws ServerNotAvailableException
*/
- public function countObjects(int $limit = null, int $offset = null) {
+ public function countObjects(?int $limit = null, ?int $offset = null) {
$result = false;
foreach ($this->connection->ldapBase as $base) {
$count = $this->count('objectclass=*', [$base], ['dn'], $limit ?? 0, $offset ?? 0);
@@ -1202,7 +1202,7 @@ private function processPagedSearchStatus(
private function count(
string $filter,
array $bases,
- array $attr = null,
+ ?array $attr = null,
int $limit = 0,
int $offset = 0,
bool $skipHandling = false
@@ -1730,7 +1730,7 @@ private function detectUuidAttribute(string $dn, bool $isUser = true, bool $forc
* @return false|string
* @throws ServerNotAvailableException
*/
- public function getUUID(string $dn, bool $isUser = true, array $ldapRecord = null) {
+ public function getUUID(string $dn, bool $isUser = true, ?array $ldapRecord = null) {
if ($isUser) {
$uuidAttr = 'ldapUuidUserAttribute';
$uuidOverride = $this->connection->ldapExpertUUIDUserAttr;
@@ -2014,12 +2014,12 @@ private function initPagedSearch(
}
$this->logger->debug('Ready for a paged search', ['app' => 'user_ldap']);
return [true, $pageSize, $this->lastCookie];
- /* ++ Fixing RHDS searches with pages with zero results ++
- * We couldn't get paged searches working with our RHDS for login ($limit = 0),
- * due to pages with zero results.
- * So we added "&& !empty($this->lastCookie)" to this test to ignore pagination
- * if we don't have a previous paged search.
- */
+ /* ++ Fixing RHDS searches with pages with zero results ++
+ * We couldn't get paged searches working with our RHDS for login ($limit = 0),
+ * due to pages with zero results.
+ * So we added "&& !empty($this->lastCookie)" to this test to ignore pagination
+ * if we don't have a previous paged search.
+ */
} elseif ($this->lastCookie !== '') {
// a search without limit was requested. However, if we do use
// Paged Search once, we always must do it. This requires us to
diff --git a/apps/user_ldap/lib/Configuration.php b/apps/user_ldap/lib/Configuration.php
index 2791324be5b2f..b0bb600cb3bec 100644
--- a/apps/user_ldap/lib/Configuration.php
+++ b/apps/user_ldap/lib/Configuration.php
@@ -177,7 +177,7 @@ public function getConfiguration(): array {
* array
* @param array &$applied optional; array where the set fields will be given to
*/
- public function setConfiguration(array $config, array &$applied = null): void {
+ public function setConfiguration(array $config, ?array &$applied = null): void {
$cta = $this->getConfigTranslationArray();
foreach ($config as $inputKey => $val) {
if (str_contains($inputKey, '_') && array_key_exists($inputKey, $cta)) {
diff --git a/apps/user_ldap/lib/Connection.php b/apps/user_ldap/lib/Connection.php
index 37f7dcaea5ca7..788344b4e7d03 100644
--- a/apps/user_ldap/lib/Connection.php
+++ b/apps/user_ldap/lib/Connection.php
@@ -307,7 +307,7 @@ public function getConfigPrefix(): string {
* @param string $key
* @param mixed $value
*/
- public function writeToCache($key, $value, int $ttlOverride = null): void {
+ public function writeToCache($key, $value, ?int $ttlOverride = null): void {
if (!$this->configured) {
$this->readConfiguration();
}
diff --git a/apps/user_ldap/lib/DataCollector/LdapDataCollector.php b/apps/user_ldap/lib/DataCollector/LdapDataCollector.php
index 8644626d00bc6..015248f914d8e 100644
--- a/apps/user_ldap/lib/DataCollector/LdapDataCollector.php
+++ b/apps/user_ldap/lib/DataCollector/LdapDataCollector.php
@@ -48,6 +48,6 @@ public function getName(): string {
return 'ldap';
}
- public function collect(Request $request, Response $response, \Throwable $exception = null): void {
+ public function collect(Request $request, Response $response, ?\Throwable $exception = null): void {
}
}
diff --git a/apps/user_ldap/lib/Jobs/Sync.php b/apps/user_ldap/lib/Jobs/Sync.php
index f715a5e9fb96e..b92aa2fcfaa90 100644
--- a/apps/user_ldap/lib/Jobs/Sync.php
+++ b/apps/user_ldap/lib/Jobs/Sync.php
@@ -224,7 +224,7 @@ public function setCycle(array $cycleData) {
* @param array|null $cycleData the old cycle
* @return array|null
*/
- public function determineNextCycle(array $cycleData = null) {
+ public function determineNextCycle(?array $cycleData = null) {
$prefixes = $this->ldapHelper->getServerConfigurationPrefixes(true);
if (count($prefixes) === 0) {
return null;
diff --git a/apps/user_ldap/lib/Mapping/AbstractMapping.php b/apps/user_ldap/lib/Mapping/AbstractMapping.php
index 40bc8624c3c17..6c2938661e289 100644
--- a/apps/user_ldap/lib/Mapping/AbstractMapping.php
+++ b/apps/user_ldap/lib/Mapping/AbstractMapping.php
@@ -322,7 +322,7 @@ public function getUUIDByDN($dn) {
return $this->getXbyY('directory_uuid', 'ldap_dn_hash', $this->getDNHash($dn));
}
- public function getList(int $offset = 0, int $limit = null, bool $invalidatedOnly = false): array {
+ public function getList(int $offset = 0, ?int $limit = null, bool $invalidatedOnly = false): array {
$select = $this->dbc->getQueryBuilder();
$select->selectAlias('ldap_dn', 'dn')
->selectAlias('owncloud_name', 'name')
diff --git a/apps/user_ldap/lib/User/User.php b/apps/user_ldap/lib/User/User.php
index 3b0015380ecef..c3e9895e043b1 100644
--- a/apps/user_ldap/lib/User/User.php
+++ b/apps/user_ldap/lib/User/User.php
@@ -244,7 +244,7 @@ public function processAttributes($ldapEntry) {
($profileCached === null) && // no cache or TTL not expired
!$this->wasRefreshed('profile')) {
// check current data
- $profileValues = array();
+ $profileValues = [];
//User Profile Field - Phone number
$attr = strtolower($this->connection->ldapAttributePhone);
if (!empty($attr)) { // attribute configured
@@ -316,7 +316,7 @@ public function processAttributes($ldapEntry) {
if (str_contains($ldapEntry[$attr][0], '\r')) {
// convert line endings
$profileValues[\OCP\Accounts\IAccountManager::PROPERTY_BIOGRAPHY]
- = str_replace(array("\r\n","\r"), "\n", $ldapEntry[$attr][0]);
+ = str_replace(["\r\n","\r"], "\n", $ldapEntry[$attr][0]);
} else {
$profileValues[\OCP\Accounts\IAccountManager::PROPERTY_BIOGRAPHY]
= $ldapEntry[$attr][0];
@@ -397,9 +397,9 @@ public function getHomePath($valueFromLDAP = null) {
if ($path !== '') {
//if attribute's value is an absolute path take this, otherwise append it to data dir
//check for / at the beginning or pattern c:\ resp. c:/
- if ('/' !== $path[0]
- && !(3 < strlen($path) && ctype_alpha($path[0])
- && $path[1] === ':' && ('\\' === $path[2] || '/' === $path[2]))
+ if ($path[0] !== '/'
+ && !(strlen($path) > 3 && ctype_alpha($path[0])
+ && $path[1] === ':' && ($path[2] === '\\' || $path[2] === '/'))
) {
$path = $this->config->getSystemValue('datadirectory',
\OC::$SERVERROOT.'/data') . '/' . $path;
@@ -785,7 +785,7 @@ public function getExtStorageHome():string {
* @throws \OCP\PreConditionNotMetException
* @throws \OC\ServerNotAvailableException
*/
- public function updateExtStorageHome(string $valueFromLDAP = null):string {
+ public function updateExtStorageHome(?string $valueFromLDAP = null):string {
if ($valueFromLDAP === null) {
$extHomeValues = $this->access->readAttribute($this->getDN(), $this->connection->ldapExtStorageHomeAttribute);
} else {
diff --git a/apps/user_ldap/tests/Group_LDAPTest.php b/apps/user_ldap/tests/Group_LDAPTest.php
index 5c994b8e3a521..1658001b31c0a 100644
--- a/apps/user_ldap/tests/Group_LDAPTest.php
+++ b/apps/user_ldap/tests/Group_LDAPTest.php
@@ -1356,7 +1356,7 @@ public function groupMemberProvider() {
* @param string[] $expectedMembers
* @dataProvider groupMemberProvider
*/
- public function testGroupMembers(array $expectedResult, array $groupsInfo = null) {
+ public function testGroupMembers(array $expectedResult, ?array $groupsInfo = null) {
$this->access->expects($this->any())
->method('readAttribute')
->willReturnCallback(function ($group) use ($groupsInfo) {
diff --git a/apps/user_ldap/tests/Integration/Lib/User/IntegrationTestUserCleanUp.php b/apps/user_ldap/tests/Integration/Lib/User/IntegrationTestUserCleanUp.php
index 623d08d565da1..a706aae9895f2 100644
--- a/apps/user_ldap/tests/Integration/Lib/User/IntegrationTestUserCleanUp.php
+++ b/apps/user_ldap/tests/Integration/Lib/User/IntegrationTestUserCleanUp.php
@@ -92,7 +92,7 @@ protected function case1() {
}
$user->delete();
- return null === \OC::$server->getUserManager()->get($username);
+ return \OC::$server->getUserManager()->get($username) === null;
}
}
diff --git a/apps/user_ldap/tests/User/UserTest.php b/apps/user_ldap/tests/User/UserTest.php
index 23ce407dfd733..d6530faa9b69f 100644
--- a/apps/user_ldap/tests/User/UserTest.php
+++ b/apps/user_ldap/tests/User/UserTest.php
@@ -837,7 +837,7 @@ public function extStorageHomeDataProvider() {
/**
* @dataProvider extStorageHomeDataProvider
*/
- public function testUpdateExtStorageHome(string $expected, string $valueFromLDAP = null, bool $isSet = true) {
+ public function testUpdateExtStorageHome(string $expected, ?string $valueFromLDAP = null, bool $isSet = true) {
if ($valueFromLDAP === null) {
$this->connection->expects($this->once())
->method('__get')
diff --git a/apps/workflowengine/lib/Helper/ScopeContext.php b/apps/workflowengine/lib/Helper/ScopeContext.php
index 1927aac6b40f7..01c7974cf2f5f 100644
--- a/apps/workflowengine/lib/Helper/ScopeContext.php
+++ b/apps/workflowengine/lib/Helper/ScopeContext.php
@@ -36,7 +36,7 @@ class ScopeContext {
/** @var string */
private $hash;
- public function __construct(int $scope, string $scopeId = null) {
+ public function __construct(int $scope, ?string $scopeId = null) {
$this->scope = $this->evaluateScope($scope);
$this->scopeId = $this->evaluateScopeId($scopeId);
}
@@ -48,7 +48,7 @@ private function evaluateScope(int $scope): int {
throw new \InvalidArgumentException('Invalid scope');
}
- private function evaluateScopeId(string $scopeId = null): string {
+ private function evaluateScopeId(?string $scopeId = null): string {
if ($this->scope === IManager::SCOPE_USER
&& trim((string)$scopeId) === '') {
throw new \InvalidArgumentException('user scope requires a user id');
diff --git a/apps/workflowengine/tests/ManagerTest.php b/apps/workflowengine/tests/ManagerTest.php
index a484a828492cb..890eba99dacae 100644
--- a/apps/workflowengine/tests/ManagerTest.php
+++ b/apps/workflowengine/tests/ManagerTest.php
@@ -121,7 +121,7 @@ protected function tearDown(): void {
/**
* @return MockObject|ScopeContext
*/
- protected function buildScope(string $scopeId = null): MockObject {
+ protected function buildScope(?string $scopeId = null): MockObject {
$scopeContext = $this->createMock(ScopeContext::class);
$scopeContext->expects($this->any())
->method('getScope')
diff --git a/build/integration/features/bootstrap/CalDavContext.php b/build/integration/features/bootstrap/CalDavContext.php
index bad0d915491ca..7f986542d251e 100644
--- a/build/integration/features/bootstrap/CalDavContext.php
+++ b/build/integration/features/bootstrap/CalDavContext.php
@@ -199,7 +199,7 @@ public function theCaldavResponseShouldContainAPropertyWithHrefValue(
* @throws \Exception
*/
public function theCaldavResponseShouldBeMultiStatus(): void {
- if (207 !== $this->response->getStatusCode()) {
+ if ($this->response->getStatusCode() !== 207) {
throw new \Exception(
sprintf(
'Expected code 207 got %s',
diff --git a/build/integration/features/bootstrap/Sharing.php b/build/integration/features/bootstrap/Sharing.php
index 7993d502707be..146b1a350448e 100644
--- a/build/integration/features/bootstrap/Sharing.php
+++ b/build/integration/features/bootstrap/Sharing.php
@@ -353,7 +353,7 @@ public function isFieldInResponse($field, $contentExpected) {
return is_numeric((string)$data->$field);
} elseif ($contentExpected == "AN_URL") {
return $this->isExpectedUrl((string)$data->$field, "index.php/s/");
- } elseif ($data->$field == $contentExpected) {
+ } elseif ($contentExpected == $data->$field) {
return true;
}
return false;
diff --git a/core/Command/App/Enable.php b/core/Command/App/Enable.php
index 624b31521ad74..ed29f2fed922d 100644
--- a/core/Command/App/Enable.php
+++ b/core/Command/App/Enable.php
@@ -103,7 +103,7 @@ private function enableApp(string $appId, array $groupIds, bool $forceEnable, Ou
/** @var Installer $installer */
$installer = \OC::$server->query(Installer::class);
- if (false === $installer->isDownloaded($appId)) {
+ if ($installer->isDownloaded($appId) === false) {
$installer->downloadApp($appId);
}
diff --git a/core/Command/Base.php b/core/Command/Base.php
index f8b864c586456..64d18c1b2c6b9 100644
--- a/core/Command/Base.php
+++ b/core/Command/Base.php
@@ -70,7 +70,7 @@ protected function writeArrayInOutputFormat(InputInterface $input, OutputInterfa
$this->writeArrayInOutputFormat($input, $output, $item, ' ' . $prefix);
continue;
}
- if (!is_int($key) || ListCommand::class === get_class($this)) {
+ if (!is_int($key) || get_class($this) === ListCommand::class) {
$value = $this->valueToString($item);
if (!is_null($value)) {
$output->writeln($prefix . $key . ': ' . $value);
diff --git a/core/Command/Upgrade.php b/core/Command/Upgrade.php
index 45427f6552f7f..93221f91e7330 100644
--- a/core/Command/Upgrade.php
+++ b/core/Command/Upgrade.php
@@ -80,7 +80,7 @@ protected function configure() {
*/
protected function execute(InputInterface $input, OutputInterface $output): int {
if (Util::needUpgrade()) {
- if (OutputInterface::VERBOSITY_NORMAL < $output->getVerbosity()) {
+ if ($output->getVerbosity() > OutputInterface::VERBOSITY_NORMAL) {
// Prepend each line with a little timestamp
$timestampFormatter = new TimestampFormatter($this->config, $output->getFormatter());
$output->setFormatter($timestampFormatter);
@@ -96,7 +96,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$progress->setFormat(" %message%\n %current%/%max% [%bar%] %percent:3s%%");
$listener = function (MigratorExecuteSqlEvent $event) use ($progress, $output): void {
$message = $event->getSql();
- if (OutputInterface::VERBOSITY_NORMAL < $output->getVerbosity()) {
+ if ($output->getVerbosity() > OutputInterface::VERBOSITY_NORMAL) {
$output->writeln(' Executing SQL ' . $message);
} else {
if (strlen($message) > 60) {
@@ -132,11 +132,11 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$progress->finish();
$output->writeln('');
} elseif ($event instanceof RepairStepEvent) {
- if (OutputInterface::VERBOSITY_NORMAL < $output->getVerbosity()) {
+ if ($output->getVerbosity() > OutputInterface::VERBOSITY_NORMAL) {
$output->writeln('Repair step: ' . $event->getStepName() . '');
}
} elseif ($event instanceof RepairInfoEvent) {
- if (OutputInterface::VERBOSITY_NORMAL < $output->getVerbosity()) {
+ if ($output->getVerbosity() > OutputInterface::VERBOSITY_NORMAL) {
$output->writeln('Repair info: ' . $event->getMessage() . '');
}
} elseif ($event instanceof RepairWarningEvent) {
diff --git a/core/Controller/LoginController.php b/core/Controller/LoginController.php
index 9644710689d37..f22fee4f5e79c 100644
--- a/core/Controller/LoginController.php
+++ b/core/Controller/LoginController.php
@@ -134,7 +134,7 @@ public function logout() {
#[UseSession]
#[OpenAPI(scope: OpenAPI::SCOPE_IGNORE)]
#[FrontpageRoute(verb: 'GET', url: '/login')]
- public function showLoginForm(string $user = null, string $redirect_url = null): Http\Response {
+ public function showLoginForm(?string $user = null, ?string $redirect_url = null): Http\Response {
if ($this->userSession->isLoggedIn()) {
return new RedirectResponse($this->urlGenerator->linkToDefaultPageUrl());
}
@@ -307,7 +307,7 @@ private function generateRedirect(?string $redirectUrl): RedirectResponse {
public function tryLogin(Chain $loginChain,
string $user = '',
string $password = '',
- string $redirect_url = null,
+ ?string $redirect_url = null,
string $timezone = '',
string $timezone_offset = ''): RedirectResponse {
if (!$this->request->passesCSRFCheck()) {
diff --git a/core/Db/ProfileConfig.php b/core/Db/ProfileConfig.php
index 122adca88d0c6..d284817ca4e3c 100644
--- a/core/Db/ProfileConfig.php
+++ b/core/Db/ProfileConfig.php
@@ -26,7 +26,7 @@
namespace OC\Core\Db;
-use \JsonSerializable;
+use JsonSerializable;
use OCP\AppFramework\Db\Entity;
use OCP\Profile\ParameterDoesNotExistException;
use function json_decode;
diff --git a/core/templates/update.use-cli.php b/core/templates/update.use-cli.php
index 36e348568c3be..9d1febe614a79 100644
--- a/core/templates/update.use-cli.php
+++ b/core/templates/update.use-cli.php
@@ -12,7 +12,7 @@
} else {
$cliUpgradeLink = link_to_docs('admin-cli-upgrade');
}
- print_unescaped($l->t('For help, see the documentation.', [$cliUpgradeLink])); ?>
+print_unescaped($l->t('For help, see the documentation.', [$cliUpgradeLink])); ?>
diff --git a/lib/autoloader.php b/lib/autoloader.php
index 26540b754a5ca..0f8a2ad9687b6 100644
--- a/lib/autoloader.php
+++ b/lib/autoloader.php
@@ -36,7 +36,7 @@
*/
namespace OC;
-use \OCP\AutoloadNotAllowedException;
+use OCP\AutoloadNotAllowedException;
use OCP\ICache;
use Psr\Log\LoggerInterface;
@@ -185,7 +185,7 @@ public function load(string $class): bool {
*
* @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 22bbe3d11a0aa..bc74c85eac27c 100644
--- a/lib/private/Accounts/Account.php
+++ b/lib/private/Accounts/Account.php
@@ -104,7 +104,7 @@ public function getAllProperties(): Generator {
}
}
- 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 9332d8b111a19..5775e23a503c8 100644
--- a/lib/private/Activity/EventMerger.php
+++ b/lib/private/Activity/EventMerger.php
@@ -67,7 +67,7 @@ public function __construct(IL10N $l10n) {
* @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 14069260c6cfb..b8568a18b8166 100644
--- a/lib/private/Activity/Manager.php
+++ b/lib/private/Activity/Manager.php
@@ -348,7 +348,7 @@ public function getRequirePNG(): bool {
* @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 2461d587bbdf5..cb1d63ee37c77 100644
--- a/lib/private/App/InfoParser.php
+++ b/lib/private/App/InfoParser.php
@@ -270,7 +270,7 @@ public function xmlToArray($xml) {
} 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 9b94c0b07bcc7..2d6ce7e89be08 100644
--- a/lib/private/App/PlatformRepository.php
+++ b/lib/private/App/PlatformRepository.php
@@ -154,7 +154,7 @@ public function findLibrary(string $name): ?string {
*/
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 @@ public function normalizeVersion(string $version, ?string $fullVersion = null):
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 @@ public function normalizeVersion(string $version, ?string $fullVersion = null):
// 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 b18c95a2f0db6..ddcf38c801052 100644
--- a/lib/private/AppFramework/App.php
+++ b/lib/private/AppFramework/App.php
@@ -116,7 +116,7 @@ public static function getAppIdForClass(string $className, string $topNamespace
* @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 5fff0aec9d878..a69fc24c978dc 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 94054c3e62c0e..7a614878ab55e 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 @@ protected function decodeContent() {
$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 737777a11ac7f..89f4f1b467e8a 100644
--- a/lib/private/AppFramework/Utility/TimeFactory.php
+++ b/lib/private/AppFramework/Utility/TimeFactory.php
@@ -60,7 +60,7 @@ public function getTime(): int {
* @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 86b44e4d0e2ea..a47ac6134a876 100644
--- a/lib/private/Authentication/Exceptions/InvalidProviderException.php
+++ b/lib/private/Authentication/Exceptions/InvalidProviderException.php
@@ -29,7 +29,7 @@
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 0ce11cf70fcea..a36fd66df75b2 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 18820d98a47d8..6c031bc88fb75 100644
--- a/lib/private/Authentication/Login/LoginResult.php
+++ b/lib/private/Authentication/Login/LoginResult.php
@@ -64,7 +64,7 @@ public static function success(LoginData $data, ?string $redirectUrl = null) {
/**
* @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 2e00ac211c1c9..1e6f52ae2b91b 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 b77a856589de8..48106dc2cec11 100644
--- a/lib/private/Authentication/Token/PublicKeyToken.php
+++ b/lib/private/Authentication/Token/PublicKeyToken.php
@@ -211,7 +211,7 @@ public function setToken(string $token): void {
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 6fd2bebc19502..48a23b61e0b6d 100644
--- a/lib/private/Authentication/Token/PublicKeyTokenProvider.php
+++ b/lib/private/Authentication/Token/PublicKeyTokenProvider.php
@@ -192,7 +192,7 @@ public function getToken(string $tokenId): OCPIToken {
*/
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 97d6a02b4c487..db5da97f27588 100644
--- a/lib/private/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDao.php
+++ b/lib/private/Authentication/TwoFactorAuth/Db/ProviderUserAssignmentDao.php
@@ -57,7 +57,7 @@ public function getState(string $uid): array {
$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 @@ public function deleteByUser(string $uid): array {
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 3870c797f8dcf..3722b4506812c 100644
--- a/lib/private/Authentication/TwoFactorAuth/Manager.php
+++ b/lib/private/Authentication/TwoFactorAuth/Manager.php
@@ -313,7 +313,7 @@ private function publishEvent(IUser $user, string $event, array $params) {
* @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 e5c3fcf16189f..81dad20fc6099 100644
--- a/lib/private/Authentication/WebAuthn/CredentialRepository.php
+++ b/lib/private/Authentication/WebAuthn/CredentialRepository.php
@@ -61,7 +61,7 @@ public function findAllForUserEntity(PublicKeyCredentialUserEntity $publicKeyCre
}, $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 @@ public function saveAndReturnCredentialSource(PublicKeyCredentialSource $publicK
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 93d5cf74a20f7..4e5d11604e636 100644
--- a/lib/private/BackgroundJob/JobList.php
+++ b/lib/private/BackgroundJob/JobList.php
@@ -59,7 +59,7 @@ public function __construct(IDBConnection $connection, IConfig $config, ITimeFac
$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 524ffba4b9ea8..64ff60c71c25b 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 58a3ac96b1d1b..b1261a7252069 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 49b319038cbb1..3c5522de8aecc 100644
--- a/lib/private/Comments/Manager.php
+++ b/lib/private/Comments/Manager.php
@@ -339,7 +339,7 @@ public function getForObject(
$objectId,
$limit = 0,
$offset = 0,
- \DateTime $notOlderThan = null
+ ?\DateTime $notOlderThan = null
) {
$comments = [];
@@ -632,7 +632,7 @@ public function searchForObjects(string $search, string $objectType, array $obje
* @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 fc02c91a99fc2..ec8d5900f367f 100644
--- a/lib/private/Console/Application.php
+++ b/lib/private/Console/Application.php
@@ -203,7 +203,7 @@ public function setAutoExit($boolean) {
* @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 954f46e12967b..41fb88b15285c 100644
--- a/lib/private/Contacts/ContactsMenu/Entry.php
+++ b/lib/private/Contacts/ContactsMenu/Entry.php
@@ -111,9 +111,9 @@ public function addAction(IAction $action): 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 {
$this->status = $status;
$this->statusMessage = $statusMessage;
$this->statusMessageTimestamp = $statusMessageTimestamp;
diff --git a/lib/private/DB/Adapter.php b/lib/private/DB/Adapter.php
index ad232aaabd1a0..c2da5343b4bec 100644
--- a/lib/private/DB/Adapter.php
+++ b/lib/private/DB/Adapter.php
@@ -100,7 +100,7 @@ public function unlockTable() {
* @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 27c700bce7f89..7fce1d17c9ad8 100644
--- a/lib/private/DB/AdapterSqlite.php
+++ b/lib/private/DB/AdapterSqlite.php
@@ -63,7 +63,7 @@ public function fixupStatement($statement) {
* @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 a8838bbae2cd3..bd602c27222d5 100644
--- a/lib/private/DB/Connection.php
+++ b/lib/private/DB/Connection.php
@@ -269,7 +269,7 @@ public function prepare($sql, $limit = null, $offset = null): Statement {
*
* @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 @@ public function realLastInsertId($seqName = null) {
* @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 @@ public function rollBack() {
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 e27c98194fb25..411ce3a7e55df 100644
--- a/lib/private/DB/ConnectionAdapter.php
+++ b/lib/private/DB/ConnectionAdapter.php
@@ -97,7 +97,7 @@ public function lastInsertId(string $table): int {
}
}
- 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 60e3dbe797dc5..da5d55316a29d 100644
--- a/lib/private/DB/DbDataCollector.php
+++ b/lib/private/DB/DbDataCollector.php
@@ -48,7 +48,7 @@ public function setDebugStack(BacktraceDebugStack $debugStack, $name = 'default'
/**
* @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 @@ private function sanitizeQueries(array $queries): array {
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 f885422c928f3..f23f105763ed5 100644
--- a/lib/private/DB/MigrationService.php
+++ b/lib/private/DB/MigrationService.php
@@ -79,7 +79,7 @@ public function __construct(string $appName, Connection $connection, ?IOutput $o
$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 7cf95b040004c..ba3203a34d606 100644
--- a/lib/private/DB/Migrator.php
+++ b/lib/private/DB/Migrator.php
@@ -145,7 +145,7 @@ protected function getDiff(Schema $targetSchema, Connection $connection) {
/**
* @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 57c4833a4e357..0c5b6a55882f2 100644
--- a/lib/private/DateTimeFormatter.php
+++ b/lib/private/DateTimeFormatter.php
@@ -77,7 +77,7 @@ protected function getLocale($l = null) {
* @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 @@ protected function getDateTime($timestamp, \DateTimeZone $timeZone = null) {
* @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 @@ public function formatDate($timestamp, $format = 'long', \DateTimeZone $timeZone
* @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 @@ public function formatDateRelativeDay($timestamp, $format = 'long', \DateTimeZon
* @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 @@ public function formatDateSpan($timestamp, $baseTimestamp = null, \OCP\IL10N $l
* @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 @@ public function formatTime($timestamp, $format = 'medium', \DateTimeZone $timeZo
* @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 @@ public function formatTimeSpan($timestamp, $baseTimestamp = null, \OCP\IL10N $l
* @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 @@ public function formatDateTime($timestamp, $formatDate = 'long', $formatTime = '
* @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 @@ public function formatDateTimeRelativeDay($timestamp, $formatDate = 'long', $for
* @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 5f4017510777d..f2fa2b574d187 100644
--- a/lib/private/Diagnostics/QueryLogger.php
+++ b/lib/private/Diagnostics/QueryLogger.php
@@ -49,7 +49,7 @@ public function __construct() {
/**
* @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 53e2e170ed1f7..4db41d85a3e4a 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\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 @@ public function create(string $path, string $editorId, string $creatorId, $templ
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 @@ public function revertTokenScope(): void {
$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 bd27d71c40ee3..e776984ae4fc5 100644
--- a/lib/private/Encryption/Util.php
+++ b/lib/private/Encryption/Util.php
@@ -105,7 +105,7 @@ public function __construct(
* @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 5df4002530f03..8f0f962a3b771 100644
--- a/lib/private/Files/Cache/Cache.php
+++ b/lib/private/Files/Cache/Cache.php
@@ -99,7 +99,7 @@ public function __construct(
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 365d28fc8c556..d80375e94ee25 100644
--- a/lib/private/Files/Cache/CacheQueryBuilder.php
+++ b/lib/private/Files/Cache/CacheQueryBuilder.php
@@ -68,7 +68,7 @@ public function selectTagUsage(): self {
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 f9754e433df27..e8d5fcb490a5b 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 @@ protected function getSourcePath($path) {
* @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 31410eea798e5..1662c76a6b8b1 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 19fa87aa0909d..3e7187a5114f6 100644
--- a/lib/private/Files/Config/CachedMountInfo.php
+++ b/lib/private/Files/Config/CachedMountInfo.php
@@ -53,7 +53,7 @@ public function __construct(
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 d42052c5f8348..b60c69733e592 100644
--- a/lib/private/Files/Config/LazyPathCachedMountInfo.php
+++ b/lib/private/Files/Config/LazyPathCachedMountInfo.php
@@ -47,7 +47,7 @@ public function __construct(
int $rootId,
string $mountPoint,
string $mountProvider,
- int $mountId = null,
+ ?int $mountId,
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 d251199fd435f..fcc151eeda0eb 100644
--- a/lib/private/Files/Config/MountProviderCollection.php
+++ b/lib/private/Files/Config/MountProviderCollection.php
@@ -119,7 +119,7 @@ public function getUserMountsForProviderClasses(IUser $user, array $mountProvide
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 8275eee7b9fe4..b5b07d8f29e51 100644
--- a/lib/private/Files/Config/UserMountCache.php
+++ b/lib/private/Files/Config/UserMountCache.php
@@ -81,7 +81,7 @@ public function __construct(
$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 $newMounts */
$newMounts = [];
diff --git a/lib/private/Files/Mount/HomeMountPoint.php b/lib/private/Files/Mount/HomeMountPoint.php
index 0bec12af5c2aa..25a877ce644d1 100644
--- a/lib/private/Files/Mount/HomeMountPoint.php
+++ b/lib/private/Files/Mount/HomeMountPoint.php
@@ -33,11 +33,11 @@ public function __construct(
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 fe6358b32f124..e9a4c5c8a4f8a 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 014b66fdf63ba..52e7b55676a56 100644
--- a/lib/private/Files/Node/Folder.php
+++ b/lib/private/Files/Node/Folder.php
@@ -199,7 +199,7 @@ public function newFile($path, $content = null) {
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 4aae5cf98044d..08e77d7f7052f 100644
--- a/lib/private/Files/Node/LazyFolder.php
+++ b/lib/private/Files/Node/LazyFolder.php
@@ -101,7 +101,7 @@ public function listen($scope, $method, callable $callback) {
/**
* @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 acd91c56d3f68..9f1a1e357e95b 100644
--- a/lib/private/Files/Node/Node.php
+++ b/lib/private/Files/Node/Node.php
@@ -124,7 +124,7 @@ public function getFileInfo(bool $includeMountPoint = true) {
/**
* @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 71bc7a6da6bf0..7c3ff1d2867f2 100644
--- a/lib/private/Files/Node/Root.php
+++ b/lib/private/Files/Node/Root.php
@@ -137,7 +137,7 @@ public function listen($scope, $method, callable $callback) {
* @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 553f593b29919..c4a349294ecaa 100644
--- a/lib/private/Files/ObjectStore/Azure.php
+++ b/lib/private/Files/ObjectStore/Azure.php
@@ -100,7 +100,7 @@ public function readObject($urn) {
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 7eb284fc77463..ef4d2f7ca13d3 100644
--- a/lib/private/Files/ObjectStore/ObjectStoreStorage.php
+++ b/lib/private/Files/ObjectStore/ObjectStoreStorage.php
@@ -494,7 +494,7 @@ public function file_put_contents($path, $data) {
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 e0a94df1d9956..b7ec047850b81 100644
--- a/lib/private/Files/ObjectStore/S3ObjectTrait.php
+++ b/lib/private/Files/ObjectStore/S3ObjectTrait.php
@@ -106,7 +106,7 @@ public function readObject($urn) {
* @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 @@ protected function writeSingle(string $urn, StreamInterface $stream, string $mim
* @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 @@ protected function writeMultiPart(string $urn, StreamInterface $stream, string $
* @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 85926be897e1c..d968adb3c290c 100644
--- a/lib/private/Files/ObjectStore/StorageObjectStore.php
+++ b/lib/private/Files/ObjectStore/StorageObjectStore.php
@@ -64,7 +64,7 @@ public function readObject($urn) {
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 b463cb9d44d94..68618f136b29d 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 @@ public function getStorageId() {
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 0d4e8d2929557..c236541390f06 100644
--- a/lib/private/Files/Storage/Common.php
+++ b/lib/private/Files/Storage/Common.php
@@ -882,7 +882,7 @@ public function needsPartFile() {
* @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 c49cf91dc91c8..909b124ff64d2 100644
--- a/lib/private/Files/Storage/Local.php
+++ b/lib/private/Files/Storage/Local.php
@@ -642,7 +642,7 @@ public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $t
}
}
- 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 7ce4338256f01..e68e1f65048da 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 @@ protected function shouldEncrypt($path) {
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 592acd418ec3f..6c185112b231b 100644
--- a/lib/private/Files/Storage/Wrapper/Jail.php
+++ b/lib/private/Files/Storage/Wrapper/Jail.php
@@ -514,7 +514,7 @@ public function getPropagator($storage = null) {
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 dde209c44ab45..9a71dc9036744 100644
--- a/lib/private/Files/Storage/Wrapper/KnownMtime.php
+++ b/lib/private/Files/Storage/Wrapper/KnownMtime.php
@@ -132,7 +132,7 @@ public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $t
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 2c50bbdb11f6b..2e96733ec66d6 100644
--- a/lib/private/Files/Storage/Wrapper/Wrapper.php
+++ b/lib/private/Files/Storage/Wrapper/Wrapper.php
@@ -646,7 +646,7 @@ public function needsPartFile() {
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 c57991f35a900..895126653f783 100644
--- a/lib/private/Files/Stream/Encryption.php
+++ b/lib/private/Files/Stream/Encryption.php
@@ -321,7 +321,7 @@ public function stream_read($count) {
$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 @@ public function stream_write($data) {
$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 9d9f641620885..3f3c36de5f151 100644
--- a/lib/private/Files/Template/TemplateManager.php
+++ b/lib/private/Files/Template/TemplateManager.php
@@ -262,7 +262,7 @@ public function getTemplatePath(): string {
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 ae6a0a33d2b7c..997d6e1a34ed8 100644
--- a/lib/private/Files/Utils/Scanner.php
+++ b/lib/private/Files/Utils/Scanner.php
@@ -198,7 +198,7 @@ public function backgroundScan($dir) {
* @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 5ad48e26cc552..98b597dbd4ded 100644
--- a/lib/private/Files/View.php
+++ b/lib/private/Files/View.php
@@ -802,14 +802,14 @@ public function rename($source, $target) {
} 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 @@ public function addSubMounts(FileInfo $info, $extOnly = false): void {
* @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 @@ public function getETag($path) {
* @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 9bfa8ae49d6da..a684b870637b6 100644
--- a/lib/private/FilesMetadata/FilesMetadataManager.php
+++ b/lib/private/FilesMetadata/FilesMetadataManager.php
@@ -257,7 +257,7 @@ public function getMetadataQuery(
* @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 70dec89650add..be38b234be3e6 100644
--- a/lib/private/FilesMetadata/Model/MetadataValueWrapper.php
+++ b/lib/private/FilesMetadata/Model/MetadataValueWrapper.php
@@ -234,7 +234,7 @@ public function setValueIntList(array $value): self {
*/
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 @@ public function getValueString(): string {
*/
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 @@ public function getValueInt(): int {
*/
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 @@ public function getValueFloat(): float {
*/
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 @@ public function getValueBool(): bool {
*/
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 @@ public function getValueArray(): array {
*/
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 @@ public function getValueStringList(): array {
*/
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 @@ public function getValueIntList(): array {
* @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 13837eef55294..c4915eefeae1a 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 57289a4d3acb7..d43a10b6a5c0f 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 @@ public function countDisabled(): int|bool {
* @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 dafbe4295a491..2b6eb70502b45 100644
--- a/lib/private/Group/Manager.php
+++ b/lib/private/Group/Manager.php
@@ -323,7 +323,7 @@ public function search(string $search, ?int $limit = null, ?int $offset = 0) {
* @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 bc5af2b60a286..f3ed1f4229633 100644
--- a/lib/private/Hooks/Emitter.php
+++ b/lib/private/Hooks/Emitter.php
@@ -49,5 +49,5 @@ public function listen($scope, $method, callable $callback);
* @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 fe9cba893de31..6b084d7753387 100644
--- a/lib/private/Hooks/EmitterTrait.php
+++ b/lib/private/Hooks/EmitterTrait.php
@@ -54,7 +54,7 @@ public function listen($scope, $method, callable $callback) {
* @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 6de620e7ec74b..a9717b679ed59 100644
--- a/lib/private/L10N/Factory.php
+++ b/lib/private/L10N/Factory.php
@@ -233,7 +233,7 @@ public function findLanguage(?string $appId = null): string {
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 @@ public function findLocale($lang = null) {
}
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 @@ public function findLocale($lang = null) {
}
// 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 @@ public function findLocale($lang = null) {
* @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 @@ public function languageExists($app, $lang) {
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 @@ public function getLanguageIterator(IUser $user = null): ILanguageIterator {
* @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 @@ private function getLanguageFromRequest(?string $app = null): string {
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 c44e4f9cf499b..b701d05983535 100644
--- a/lib/private/L10N/L10N.php
+++ b/lib/private/L10N/L10N.php
@@ -157,7 +157,7 @@ public function n(string $text_singular, string $text_plural, int $count, array
* - 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 b9c3e9954607c..bc0ea989cbd60 100644
--- a/lib/private/Lock/MemcacheLockingProvider.php
+++ b/lib/private/Lock/MemcacheLockingProvider.php
@@ -44,7 +44,7 @@ public function __construct(
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 15d4da793dd52..81b0775cb156a 100644
--- a/lib/private/Mail/Message.php
+++ b/lib/private/Mail/Message.php
@@ -73,7 +73,7 @@ public function attach(IAttachment $attachment): 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 0d991a87ab82a..68fa4e7f22c41 100644
--- a/lib/private/Memcache/ProfilerWrapperCache.php
+++ b/lib/private/Memcache/ProfilerWrapperCache.php
@@ -216,7 +216,7 @@ public function offsetUnset($offset): void {
$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 97b6d41ea5eff..4f86ff680521a 100644
--- a/lib/private/Memcache/Redis.php
+++ b/lib/private/Memcache/Redis.php
@@ -218,7 +218,7 @@ protected function evalLua(string $scriptName, array $keys, array $args) {
$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 567fe8378a993..a09d0c89bf237 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 695d4a3357fa8..ddb68e012b0c3 100644
--- a/lib/private/Preview/Generator.php
+++ b/lib/private/Preview/Generator.php
@@ -289,7 +289,7 @@ public static function getHardwareConcurrency(): int {
* @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 0cb7eb59e2196..6d80594d1c8bc 100644
--- a/lib/private/Preview/ProviderV2.php
+++ b/lib/private/Preview/ProviderV2.php
@@ -83,7 +83,7 @@ protected function useTempFile(File $file): bool {
* @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 d7f3df752a649..79b17d520c6e7 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 @@ public function write(IProfile $profile): bool {
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 @@ public function write(IProfile $profile): bool {
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 @@ protected function readLineFromFile($file): ?string {
$line = '';
$position = ftell($file);
- if (0 === $position) {
+ if ($position === 0) {
return null;
}
@@ -230,7 +230,7 @@ protected function readLineFromFile($file): ?string {
$position -= $chunkSize;
fseek($file, $position);
- if (0 === $chunkSize) {
+ if ($chunkSize === 0) {
// bof reached
break;
}
@@ -246,15 +246,15 @@ protected function readLineFromFile($file): ?string {
$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 9cbf703c79b1f..10cae8a96a9d3 100644
--- a/lib/private/Profiler/Profiler.php
+++ b/lib/private/Profiler/Profiler.php
@@ -95,7 +95,7 @@ public function collect(Request $request, Response $response): IProfile {
* @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 e665923087994..8769615a37b4d 100644
--- a/lib/private/Profiler/RoutingDataCollector.php
+++ b/lib/private/Profiler/RoutingDataCollector.php
@@ -41,7 +41,7 @@ public function __construct(string $appName, string $controllerName, string $act
$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 e7e2a9f0e49cb..28a25b4addf93 100644
--- a/lib/private/Route/Router.php
+++ b/lib/private/Route/Router.php
@@ -361,7 +361,7 @@ public function match($url) {
*
*/
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 5ec0132cc031b..6522e9db5a000 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 839d3e5ce386a..173b7dc5b0187 100644
--- a/lib/private/Settings/Manager.php
+++ b/lib/private/Settings/Manager.php
@@ -184,7 +184,7 @@ public function registerSetting(string $type, string $setting) {
*
* @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 2bef6ba3ce7bf..53dbf65ccc755 100644
--- a/lib/private/Share20/Manager.php
+++ b/lib/private/Share20/Manager.php
@@ -902,7 +902,7 @@ protected function sendMailNotification(IL10N $l,
$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 451e782279022..1982d43611cc3 100644
--- a/lib/private/Talk/Broker.php
+++ b/lib/private/Talk/Broker.php
@@ -95,7 +95,7 @@ public function newConversationOptions(): IConversationOptions {
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 b90d66417e0a1..5be1cb3c81a3d 100644
--- a/lib/private/Template/JSResourceLocator.php
+++ b/lib/private/Template/JSResourceLocator.php
@@ -120,7 +120,7 @@ public function doFindTheme($script) {
* 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 af2599e26b681..3f893eb9bae14 100644
--- a/lib/private/User/Session.php
+++ b/lib/private/User/Session.php
@@ -162,7 +162,7 @@ public function listen($scope, $method, callable $callback) {
* @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 28dfb741be82d..daa78011007f5 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 ef65aa33c939f..1b2f83941c87a 100644
--- a/lib/private/legacy/OC_Files.php
+++ b/lib/private/legacy/OC_Files.php
@@ -87,7 +87,7 @@ private static function sendHeaders($filename, $name, array $rangeArray): void {
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 56fb3e0d52f0a..48f1812038ba0 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 @@ public function heightTopLeft(): int {
* @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 07ec97da7b064..3fe3f173b9908 100644
--- a/lib/private/legacy/OC_User.php
+++ b/lib/private/legacy/OC_User.php
@@ -88,7 +88,7 @@ public static function useBackend($backend = 'database') {
\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 09d0719ff2b55..86472f1b5e569 100644
--- a/lib/private/legacy/OC_Util.php
+++ b/lib/private/legacy/OC_Util.php
@@ -970,11 +970,11 @@ public function isHtaccessWorking(\OCP\IConfig $config) {
*/
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 e024ced5bda29..5a5c838f398e4 100644
--- a/lib/public/Accounts/IAccount.php
+++ b/lib/public/Accounts/IAccount.php
@@ -154,7 +154,7 @@ public function getPropertyCollection(string $propertyCollectionName): IAccountP
* @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 d72106b24f71d..3b6cc179efa0b 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 9130c6b6b902e..8340b54f75724 100644
--- a/lib/public/Activity/IManager.php
+++ b/lib/public/Activity/IManager.php
@@ -161,7 +161,7 @@ public function getRequirePNG(): bool;
* @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 657ffdeadbc83..9c032ebaec2ac 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 0853ce7981dcc..c2c6eca4683bd 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 1ae938f6e32f8..e0d9eae9171c5 100644
--- a/lib/public/AppFramework/Db/Entity.php
+++ b/lib/public/AppFramework/Db/Entity.php
@@ -105,7 +105,7 @@ public function resetUpdatedFields() {
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 57b996b2c0f66..56957a7c9128d 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 d28f45f4c60c7..06541df2da2f3 100644
--- a/lib/public/AppFramework/Http/Response.php
+++ b/lib/public/AppFramework/Http/Response.php
@@ -141,7 +141,7 @@ public function cacheFor(int $cacheSeconds, bool $public = false, bool $immutabl
* @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 db146076f2ae4..997b2fdb0258d 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 ecdccb05a6ff0..691d31996ca4a 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 7a2ffb5de9166..9dd2925ef113f 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 1b661ed994342..b7064aff31897 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 be1b80ff6175a..ee5901b5a4528 100644
--- a/lib/public/AppFramework/Utility/ITimeFactory.php
+++ b/lib/public/AppFramework/Utility/ITimeFactory.php
@@ -50,7 +50,7 @@ public function getTime(): int;
* @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 24d8e7aad4a01..90c0804c1e1bc 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 e93db3420b807..bac60f9be11df 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 8fd8fadce4fae..2f91dbfdc6e9e 100644
--- a/lib/public/BackgroundJob/TimedJob.php
+++ b/lib/public/BackgroundJob/TimedJob.php
@@ -88,7 +88,7 @@ public function setTimeSensitivity(int $sensitivity): void {
* @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 15d14d656ede8..a27a52fc54ab2 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 3d47be3d95176..3df7984387ad3 100644
--- a/lib/public/Comments/ICommentsManager.php
+++ b/lib/public/Comments/ICommentsManager.php
@@ -118,7 +118,7 @@ public function getForObject(
$objectId,
$limit = 0,
$offset = 0,
- \DateTime $notOlderThan = null
+ ?\DateTime $notOlderThan = null
);
/**
@@ -201,7 +201,7 @@ public function searchForObjects(string $search, string $objectType, array $obje
* @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 1307e2c74f7bf..a1c64ca56aa48 100644
--- a/lib/public/Contacts/ContactsMenu/IEntry.php
+++ b/lib/public/Contacts/ContactsMenu/IEntry.php
@@ -63,9 +63,9 @@ public function addAction(IAction $action): void;
* @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 0fb914727dfb4..def260402f9fc 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 63568b272941b..0b52a0f6bf0fb 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 ba4c97f5b50bd..f1f4d623da177 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 89209748e4fdf..66b772e4d80fc 100644
--- a/lib/public/DirectEditing/ACreateEmpty.php
+++ b/lib/public/DirectEditing/ACreateEmpty.php
@@ -70,6 +70,6 @@ abstract public function getMimetype(): string;
* @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 8406d0593d2e4..5338b22167545 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 9294f5e1d95b6..d3cfd6cea2d59 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 4411200c7ae7b..d60a7aad94b82 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 c0226a9b527df..8cbd1d8a3a00f 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 4c2c566c8c6ec..7331f7502673d 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 6a0a8d7fc4bad..1f45e94f55cd8 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 2cf8ea20acf63..000c532063459 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 a202ef7c0c2e7..e58f41cf69d66 100644
--- a/lib/public/Files/ObjectStore/IObjectStore.php
+++ b/lib/public/Files/ObjectStore/IObjectStore.php
@@ -54,7 +54,7 @@ public function readObject($urn);
* @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 01f5cbbb20af6..2d5825c4ee865 100644
--- a/lib/public/Files/Storage/IChunkedFileWrite.php
+++ b/lib/public/Files/Storage/IChunkedFileWrite.php
@@ -49,7 +49,7 @@ public function startChunkedWrite(string $targetPath): string;
* @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 f9122cd4b2c17..3de2f8a25c1de 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 bc39f8e27f5f6..60f711af326d3 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 36d7329d4b507..ac017f1edf952 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 d29398172e6f7..0f3f2e0e54c04 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 78b004f85184e..a87ed500e02da 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 c20711d418161..45ee4c15464d0 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 f39cf65fba4cf..c54c971680445 100644
--- a/lib/public/Files/Template/ITemplateManager.php
+++ b/lib/public/Files/Template/ITemplateManager.php
@@ -80,7 +80,7 @@ public function getTemplatePath(): string;
* @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 ad6eb486d4ba2..0e9a142e8f3b5 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 5613aa3743b54..026e79c377684 100644
--- a/lib/public/IDBConnection.php
+++ b/lib/public/IDBConnection.php
@@ -164,7 +164,7 @@ public function lastInsertId(string $table): int;
* @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 f85a88b4e3819..75e5f2e1cc706 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 @@ public function formatDate($timestamp, $format = 'long', \DateTimeZone $timeZone
* @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 @@ public function formatDateRelativeDay($timestamp, $format = 'long', \DateTimeZon
* >= 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 @@ public function formatDateSpan($timestamp, $baseTimestamp = null, \OCP\IL10N $l
* @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 @@ public function formatTime($timestamp, $format = 'medium', \DateTimeZone $timeZo
* >= 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 @@ public function formatTimeSpan($timestamp, $baseTimestamp = null, \OCP\IL10N $l
* @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 @@ public function formatDateTime($timestamp, $formatDate = 'long', $formatTime = '
* @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 51417641e26a5..9739a324168e5 100644
--- a/lib/public/IGroup.php
+++ b/lib/public/IGroup.php
@@ -135,7 +135,7 @@ public function countDisabled(): int|bool;
* @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 a6655292398b0..df7321bf0d767 100644
--- a/lib/public/IGroupManager.php
+++ b/lib/public/IGroupManager.php
@@ -108,7 +108,7 @@ public function search(string $search, ?int $limit = null, ?int $offset = 0);
* @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 35713862f070d..72aa11f002ce0 100644
--- a/lib/public/L10N/IFactory.php
+++ b/lib/public/L10N/IFactory.php
@@ -78,7 +78,7 @@ public function findLanguage(?string $appId = null): string;
* @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 @@ public function findLocale($lang = null);
* @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 @@ public function localeExists($locale);
*
* @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 @@ public function getLanguages(): array;
* @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 ec7701523fb9c..2b1377b5854d7 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 914f0392e39e0..bc91a9c330426 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 ac043b4d958ef..be14208103b12 100644
--- a/lib/public/Log/functions.php
+++ b/lib/public/Log/functions.php
@@ -48,7 +48,7 @@
* @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 bd96918c7aca4..79efc1e2a71e6 100644
--- a/lib/public/Mail/IMessage.php
+++ b/lib/public/Mail/IMessage.php
@@ -79,7 +79,7 @@ public function attach(IAttachment $attachment): 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 5fa4582add797..50edabb47ffa9 100644
--- a/lib/public/Profiler/IProfiler.php
+++ b/lib/public/Profiler/IProfiler.php
@@ -67,7 +67,7 @@ public function saveProfile(IProfile $profile): bool;
* 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 496aae1406bbd..b726ce27b91ca 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 48bd651f7a373..802b690038adf 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 54e96856052b6..8f5442bb145ee 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 f2b512ea4a8ee..67fae10253fd8 100644
--- a/lib/public/Talk/IBroker.php
+++ b/lib/public/Talk/IBroker.php
@@ -69,7 +69,7 @@ public function newConversationOptions(): IConversationOptions;
*/
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 ee228ae01e75f..67c01dec259ba 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 aa81801f4745b..be6f2848cb20b 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 782d6d270ead3..b6fa75e0221d9 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 c1b97fec29cd3..fa22b1bd53dc3 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 11229567188c0..9ab9895acb87f 100644
--- a/lib/public/Util.php
+++ b/lib/public/Util.php
@@ -177,7 +177,7 @@ public static function addInitScript(string $application, string $file): void {
* @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 {
diff --git a/tests/Core/Service/LoginFlowV2ServiceUnitTest.php b/tests/Core/Service/LoginFlowV2ServiceUnitTest.php
index 7ca389946d8f5..011196bb1bab6 100644
--- a/tests/Core/Service/LoginFlowV2ServiceUnitTest.php
+++ b/tests/Core/Service/LoginFlowV2ServiceUnitTest.php
@@ -392,7 +392,7 @@ public function testCreateTokens() {
->method('getSystemValue')
->willReturn($this->returnCallback(function ($key) {
// Note: \OCP\IConfig::getSystemValue returns either an array or string.
- return 'openssl' == $key ? [] : '';
+ return $key == 'openssl' ? [] : '';
}));
$this->mapper->expects($this->once())
diff --git a/tests/lib/Accounts/AccountManagerTest.php b/tests/lib/Accounts/AccountManagerTest.php
index 3d0bee5902f9c..632bbe4d6ac3a 100644
--- a/tests/lib/Accounts/AccountManagerTest.php
+++ b/tests/lib/Accounts/AccountManagerTest.php
@@ -125,7 +125,7 @@ protected function tearDown(): void {
$query->delete($this->table)->executeStatement();
}
- protected function makeUser(string $uid, string $name, string $email = null): IUser {
+ protected function makeUser(string $uid, string $name, ?string $email = null): IUser {
$user = $this->createMock(IUser::class);
$user->expects($this->any())
->method('getUid')
diff --git a/tests/lib/BackgroundJob/DummyJobList.php b/tests/lib/BackgroundJob/DummyJobList.php
index 05a9e5928c2be..64c0cf8038e95 100644
--- a/tests/lib/BackgroundJob/DummyJobList.php
+++ b/tests/lib/BackgroundJob/DummyJobList.php
@@ -35,7 +35,7 @@ public function __construct() {
* @param IJob|class-string $job
* @param mixed $argument
*/
- public function add($job, $argument = null, int $firstCheck = null): void {
+ public function add($job, $argument = null, ?int $firstCheck = null): void {
if (is_string($job)) {
/** @var IJob $job */
$job = \OCP\Server::get($job);
diff --git a/tests/lib/BackgroundJob/TestJob.php b/tests/lib/BackgroundJob/TestJob.php
index 54b0ec7d9eacd..a88132165ad3c 100644
--- a/tests/lib/BackgroundJob/TestJob.php
+++ b/tests/lib/BackgroundJob/TestJob.php
@@ -22,7 +22,7 @@ class TestJob extends \OCP\BackgroundJob\Job {
* @param JobTest $testCase
* @param callable $callback
*/
- public function __construct(ITimeFactory $time = null, $testCase = null, $callback = null) {
+ public function __construct(?ITimeFactory $time = null, $testCase = null, $callback = null) {
parent::__construct($time ?? \OCP\Server::get(ITimeFactory::class));
$this->testCase = $testCase;
$this->callback = $callback;
diff --git a/tests/lib/BackgroundJob/TestParallelAwareJob.php b/tests/lib/BackgroundJob/TestParallelAwareJob.php
index 7fa0bda7bbf39..480762a270959 100644
--- a/tests/lib/BackgroundJob/TestParallelAwareJob.php
+++ b/tests/lib/BackgroundJob/TestParallelAwareJob.php
@@ -22,7 +22,7 @@ class TestParallelAwareJob extends \OCP\BackgroundJob\Job {
* @param JobTest $testCase
* @param callable $callback
*/
- public function __construct(ITimeFactory $time = null, $testCase = null, $callback = null) {
+ public function __construct(?ITimeFactory $time = null, $testCase = null, $callback = null) {
parent::__construct($time ?? \OC::$server->get(ITimeFactory::class));
$this->setAllowParallelRuns(false);
$this->testCase = $testCase;
diff --git a/tests/lib/Comments/FakeManager.php b/tests/lib/Comments/FakeManager.php
index b524f5a500065..136d32ce6c09a 100644
--- a/tests/lib/Comments/FakeManager.php
+++ b/tests/lib/Comments/FakeManager.php
@@ -22,7 +22,7 @@ public function getForObject(
$objectId,
$limit = 0,
$offset = 0,
- \DateTime $notOlderThan = null
+ ?\DateTime $notOlderThan = null
) {
}
@@ -49,7 +49,7 @@ public function getCommentsWithVerbForObjectSinceComment(
return [];
}
- public function getNumberOfCommentsForObject($objectType, $objectId, \DateTime $notOlderThan = null, $verb = '') {
+ public function getNumberOfCommentsForObject($objectType, $objectId, ?\DateTime $notOlderThan = null, $verb = '') {
}
public function search(string $search, string $objectType, string $objectId, string $verb, int $offset, int $limit = 50): array {
diff --git a/tests/lib/Files/ObjectStore/FailDeleteObjectStore.php b/tests/lib/Files/ObjectStore/FailDeleteObjectStore.php
index 5160abe574fd3..6613153f37f88 100644
--- a/tests/lib/Files/ObjectStore/FailDeleteObjectStore.php
+++ b/tests/lib/Files/ObjectStore/FailDeleteObjectStore.php
@@ -40,7 +40,7 @@ public function readObject($urn) {
return $this->objectStore->readObject($urn);
}
- public function writeObject($urn, $stream, string $mimetype = null) {
+ public function writeObject($urn, $stream, ?string $mimetype = null) {
return $this->objectStore->writeObject($urn, $stream, $mimetype);
}
diff --git a/tests/lib/Files/ObjectStore/FailWriteObjectStore.php b/tests/lib/Files/ObjectStore/FailWriteObjectStore.php
index 559d004cd0cd1..bcb9ef68890cc 100644
--- a/tests/lib/Files/ObjectStore/FailWriteObjectStore.php
+++ b/tests/lib/Files/ObjectStore/FailWriteObjectStore.php
@@ -40,7 +40,7 @@ public function readObject($urn) {
return $this->objectStore->readObject($urn);
}
- public function writeObject($urn, $stream, string $mimetype = null) {
+ public function writeObject($urn, $stream, ?string $mimetype = null) {
// emulate a failed write that didn't throw an error
return true;
}
diff --git a/tests/lib/Files/ObjectStore/S3Test.php b/tests/lib/Files/ObjectStore/S3Test.php
index c8333ca1ea38d..7622f42676f1b 100644
--- a/tests/lib/Files/ObjectStore/S3Test.php
+++ b/tests/lib/Files/ObjectStore/S3Test.php
@@ -25,7 +25,7 @@
use OC\Files\ObjectStore\S3;
class MultiPartUploadS3 extends S3 {
- public function writeObject($urn, $stream, string $mimetype = null) {
+ public function writeObject($urn, $stream, ?string $mimetype = null) {
$this->getConnection()->upload($this->bucket, $urn, $stream, 'private', [
'mup_threshold' => 1,
]);
diff --git a/tests/lib/L10N/FactoryTest.php b/tests/lib/L10N/FactoryTest.php
index 2db1e0302e8a5..20eb355f6f4c8 100644
--- a/tests/lib/L10N/FactoryTest.php
+++ b/tests/lib/L10N/FactoryTest.php
@@ -683,7 +683,7 @@ public function languageIteratorRequestProvider():array {
/**
* @dataProvider languageIteratorRequestProvider
*/
- public function testGetLanguageIterator(bool $hasSession, IUser $iUserMock = null): void {
+ public function testGetLanguageIterator(bool $hasSession, ?IUser $iUserMock = null): void {
$factory = $this->getFactory();
if ($iUserMock === null) {
diff --git a/tests/lib/TestCase.php b/tests/lib/TestCase.php
index 4ca0090176207..59e1125d38f74 100644
--- a/tests/lib/TestCase.php
+++ b/tests/lib/TestCase.php
@@ -525,7 +525,7 @@ protected function getGroupAnnotations(): array {
protected function IsDatabaseAccessAllowed() {
// on travis-ci.org we allow database access in any case - otherwise
// this will break all apps right away
- if (true == getenv('TRAVIS')) {
+ if (getenv('TRAVIS') == true) {
return true;
}
$annotations = $this->getGroupAnnotations();
diff --git a/vendor-bin/cs-fixer/composer.lock b/vendor-bin/cs-fixer/composer.lock
index cb5db42002de4..c76be0cf4d1ef 100644
--- a/vendor-bin/cs-fixer/composer.lock
+++ b/vendor-bin/cs-fixer/composer.lock
@@ -8,16 +8,16 @@
"packages": [
{
"name": "nextcloud/coding-standard",
- "version": "v1.1.1",
+ "version": "v1.2.1",
"source": {
"type": "git",
"url": "https://github.com/nextcloud/coding-standard.git",
- "reference": "55def702fb9a37a219511e1d8c6fe8e37164c1fb"
+ "reference": "cf5f18d989ec62fb4cdc7fc92a36baf34b3d829e"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/nextcloud/coding-standard/zipball/55def702fb9a37a219511e1d8c6fe8e37164c1fb",
- "reference": "55def702fb9a37a219511e1d8c6fe8e37164c1fb",
+ "url": "https://api.github.com/repos/nextcloud/coding-standard/zipball/cf5f18d989ec62fb4cdc7fc92a36baf34b3d829e",
+ "reference": "cf5f18d989ec62fb4cdc7fc92a36baf34b3d829e",
"shasum": ""
},
"require": {
@@ -43,22 +43,22 @@
"description": "Nextcloud coding standards for the php cs fixer",
"support": {
"issues": "https://github.com/nextcloud/coding-standard/issues",
- "source": "https://github.com/nextcloud/coding-standard/tree/v1.1.1"
+ "source": "https://github.com/nextcloud/coding-standard/tree/v1.2.1"
},
- "time": "2023-06-01T12:05:01+00:00"
+ "time": "2024-02-01T14:54:37+00:00"
},
{
"name": "php-cs-fixer/shim",
- "version": "v3.39.0",
+ "version": "v3.52.1",
"source": {
"type": "git",
"url": "https://github.com/PHP-CS-Fixer/shim.git",
- "reference": "33304deae9dd24f333fd9210c80e37c2013210d7"
+ "reference": "baec5a6d4b24bad4c930d39fde34b2b0c1c8cd94"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/PHP-CS-Fixer/shim/zipball/33304deae9dd24f333fd9210c80e37c2013210d7",
- "reference": "33304deae9dd24f333fd9210c80e37c2013210d7",
+ "url": "https://api.github.com/repos/PHP-CS-Fixer/shim/zipball/baec5a6d4b24bad4c930d39fde34b2b0c1c8cd94",
+ "reference": "baec5a6d4b24bad4c930d39fde34b2b0c1c8cd94",
"shasum": ""
},
"require": {
@@ -95,9 +95,9 @@
"description": "A tool to automatically fix PHP code style",
"support": {
"issues": "https://github.com/PHP-CS-Fixer/shim/issues",
- "source": "https://github.com/PHP-CS-Fixer/shim/tree/v3.39.0"
+ "source": "https://github.com/PHP-CS-Fixer/shim/tree/v3.52.1"
},
- "time": "2023-11-22T11:20:32+00:00"
+ "time": "2024-03-19T21:03:12+00:00"
}
],
"packages-dev": [],