diff options
Diffstat (limited to 'apps')
102 files changed, 199 insertions, 200 deletions
diff --git a/apps/admin_audit/lib/AuditLogger.php b/apps/admin_audit/lib/AuditLogger.php index c3265737409..fa33e828bfd 100644 --- a/apps/admin_audit/lib/AuditLogger.php +++ b/apps/admin_audit/lib/AuditLogger.php @@ -49,39 +49,39 @@ class AuditLogger implements IAuditLogger { $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 9b04145caa2..ad7e0889ba5 100644 --- a/apps/cloud_federation_api/lib/Capabilities.php +++ b/apps/cloud_federation_api/lib/Capabilities.php @@ -66,7 +66,7 @@ class Capabilities implements ICapability { $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 b139b18371d..2f0f8e314cb 100644 --- a/apps/comments/lib/Activity/Provider.php +++ b/apps/comments/lib/Activity/Provider.php @@ -54,7 +54,7 @@ class Provider implements IProvider { * @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 7042de9c1b0..f0a4ddcaac4 100644 --- a/apps/contactsinteraction/tests/Db/RecentContactMapperTest.php +++ b/apps/contactsinteraction/tests/Db/RecentContactMapperTest.php @@ -107,7 +107,7 @@ class RecentContactMapperTest extends TestCase { $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 c4676e62c4f..37e4feeb6e0 100644 --- a/apps/dav/appinfo/v2/direct.php +++ b/apps/dav/appinfo/v2/direct.php @@ -24,7 +24,7 @@ declare(strict_types=1); * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ -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 daab7806e46..e4cc5fadf7c 100644 --- a/apps/dav/lib/CalDAV/Activity/Provider/Calendar.php +++ b/apps/dav/lib/CalDAV/Activity/Provider/Calendar.php @@ -83,7 +83,7 @@ class Calendar extends Base { * @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 13f0036b0b0..4dcb18fdb90 100644 --- a/apps/dav/lib/CalDAV/Activity/Provider/Event.php +++ b/apps/dav/lib/CalDAV/Activity/Provider/Event.php @@ -121,7 +121,7 @@ class Event extends Base { * @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 e2ddb99a1af..0a8434b9595 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 5d1d55879ca..93344e33186 100644 --- a/apps/dav/lib/CalDAV/BirthdayService.php +++ b/apps/dav/lib/CalDAV/BirthdayService.php @@ -470,7 +470,7 @@ class BirthdayService { */ 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 3abb9d584c1..a6c00a59174 100644 --- a/apps/dav/lib/CalDAV/CalDavBackend.php +++ b/apps/dav/lib/CalDAV/CalDavBackend.php @@ -2169,7 +2169,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription ->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 9ededb8d015..9f4b55824e8 100644 --- a/apps/dav/lib/CalDAV/Reminder/ReminderService.php +++ b/apps/dav/lib/CalDAV/Reminder/ReminderService.php @@ -392,8 +392,8 @@ class ReminderService { 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 2ccecc8131c..a1297fd2cf1 100644 --- a/apps/dav/lib/CalDAV/Schedule/Plugin.php +++ b/apps/dav/lib/CalDAV/Schedule/Plugin.php @@ -57,7 +57,7 @@ use Sabre\VObject\ITip\SameOrganizerForAllComponentsException; 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 @@ EOF; * @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 9dccd4e77a3..29129a3b073 100644 --- a/apps/dav/lib/CalDAV/Status/StatusService.php +++ b/apps/dav/lib/CalDAV/Status/StatusService.php @@ -154,7 +154,7 @@ class StatusService { } $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 a9ed767ffc7..a404dde4448 100644 --- a/apps/dav/lib/CardDAV/Activity/Provider/Addressbook.php +++ b/apps/dav/lib/CardDAV/Activity/Provider/Addressbook.php @@ -71,7 +71,7 @@ class Addressbook extends Base { * @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 8f205942d4b..7f49a428cae 100644 --- a/apps/dav/lib/CardDAV/Activity/Provider/Card.php +++ b/apps/dav/lib/CardDAV/Activity/Provider/Card.php @@ -73,7 +73,7 @@ class Card extends Base { * @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 e9ffe6f25e9..f887e3b32b7 100644 --- a/apps/dav/lib/CardDAV/CardDavBackend.php +++ b/apps/dav/lib/CardDAV/CardDavBackend.php @@ -1151,7 +1151,7 @@ class CardDavBackend implements BackendInterface, SyncSupport { ->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 66927d35e04..52c8192a2fb 100644 --- a/apps/dav/lib/CardDAV/SyncService.php +++ b/apps/dav/lib/CardDAV/SyncService.php @@ -271,7 +271,7 @@ class SyncService { return $this->localSystemAddressBook; } - public function syncInstance(\Closure $progressCallback = null) { + 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 a3045797ff4..7269a5ad4f3 100644 --- a/apps/dav/lib/Command/MoveCalendar.php +++ b/apps/dav/lib/Command/MoveCalendar.php @@ -93,7 +93,7 @@ class MoveCalendar extends Command { $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 @@ class MoveCalendar extends Command { * 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 @@ class MoveCalendar extends Command { * 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 2581ff0c367..1b6139a34a2 100644 --- a/apps/dav/lib/Comments/EntityCollection.php +++ b/apps/dav/lib/Comments/EntityCollection.php @@ -130,7 +130,7 @@ class EntityCollection extends RootCollection implements IProperties { * @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 b1bccce3620..54038468dc5 100644 --- a/apps/dav/lib/Connector/Sabre/CachingTree.php +++ b/apps/dav/lib/Connector/Sabre/CachingTree.php @@ -46,7 +46,7 @@ class CachingTree extends Tree { $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 441e6ea8f57..e40b8d760eb 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 @@ class Directory extends \OCA\DAV\Connector\Sabre\Node implements \Sabre\DAV\ICol * @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 36063da8d65..ce51a90eb27 100644 --- a/apps/dav/lib/Connector/Sabre/Exception/FileLocked.php +++ b/apps/dav/lib/Connector/Sabre/Exception/FileLocked.php @@ -29,7 +29,7 @@ namespace OCA\DAV\Connector\Sabre\Exception; use Exception; class FileLocked extends \Sabre\DAV\Exception { - public function __construct($message = "", $code = 0, Exception $previous = null) { + 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 a5eed911701..d71b837ade2 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 9d1fda339a2..a8ca0aea97d 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 f188490fd93..f54fbbdd15a 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 cd692602df8..73057dd76d1 100644 --- a/apps/dav/lib/Connector/Sabre/FilesPlugin.php +++ b/apps/dav/lib/Connector/Sabre/FilesPlugin.php @@ -563,7 +563,7 @@ class FilesPlugin extends ServerPlugin { */ private function handleUpdatePropertiesMetadata(PropPatch $propPatch, Node $node): void { $userId = $this->userSession->getUser()?->getUID(); - if (null === $userId) { + if ($userId === null) { return; } @@ -667,7 +667,7 @@ class FilesPlugin extends ServerPlugin { * @param \Sabre\DAV\INode $node * @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 5237064b46f..2b77dc08e8d 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 e6219f2bbfe..3c03dfa5d25 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 1e7990af32f..f22e1ccf164 100644 --- a/apps/dav/lib/HookManager.php +++ b/apps/dav/lib/HookManager.php @@ -163,7 +163,7 @@ class HookManager { } } - public function firstLogin(IUser $user = null) { + 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 fb985525078..f5a2890207a 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 @@ class EmailProviderTest extends AbstractNotificationProviderTest { * @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 942718f7ce5..4cd65a341b0 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 36dc550a8a3..688b1ac6b44 100644 --- a/apps/dav/tests/unit/Connector/Sabre/FileTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/FileTest.php @@ -318,7 +318,7 @@ class FileTest extends TestCase { * * @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 @@ class FileTest extends TestCase { * * @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 @@ class FileTest extends TestCase { * @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 745a568b8ad..0edf68e6c09 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 487e1089495..27eba0ad781 100644 --- a/apps/encryption/lib/Hooks/UserHooks.php +++ b/apps/encryption/lib/Hooks/UserHooks.php @@ -210,9 +210,9 @@ class UserHooks implements IHook { $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 9c7018e6a5c..c96d5b5debe 100644 --- a/apps/files/lib/Activity/FavoriteProvider.php +++ b/apps/files/lib/Activity/FavoriteProvider.php @@ -71,7 +71,7 @@ class FavoriteProvider implements IProvider { * @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 @@ class FavoriteProvider implements IProvider { * @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 50535cab5c6..662ea98d0b9 100644 --- a/apps/files/lib/Activity/Provider.php +++ b/apps/files/lib/Activity/Provider.php @@ -102,7 +102,7 @@ class Provider implements IProvider { * @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 @@ class Provider implements IProvider { * @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 @@ class Provider implements IProvider { * @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 @@ class Provider implements IProvider { * @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 a15e1558057..a1a944bc56a 100644 --- a/apps/files/lib/Collaboration/Resources/ResourceProvider.php +++ b/apps/files/lib/Collaboration/Resources/ResourceProvider.php @@ -107,7 +107,7 @@ class ResourceProvider implements IProvider { * @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 5d2162c69e0..ab061382a2d 100644 --- a/apps/files/lib/Controller/DirectEditingController.php +++ b/apps/files/lib/Controller/DirectEditingController.php @@ -79,7 +79,7 @@ class DirectEditingController extends OCSController { * 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 @@ class DirectEditingController extends OCSController { * 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 2934ac06704..67cd0bf2aef 100644 --- a/apps/files/lib/Controller/ViewController.php +++ b/apps/files/lib/Controller/ViewController.php @@ -135,7 +135,7 @@ class ViewController extends Controller { * @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 dff5bf86625..9797a75d428 100644 --- a/apps/files_external/lib/Lib/Auth/Password/GlobalAuth.php +++ b/apps/files_external/lib/Lib/Auth/Password/GlobalAuth.php @@ -70,7 +70,7 @@ class GlobalAuth extends AuthMechanism { ]); } - public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = null) { + 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 e6c2be70056..5f4322814df 100644 --- a/apps/files_external/lib/Lib/Auth/Password/LoginCredentials.php +++ b/apps/files_external/lib/Lib/Auth/Password/LoginCredentials.php @@ -112,7 +112,7 @@ class LoginCredentials extends AuthMechanism { return $credentials; } - public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = null) { + 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 a1add7c870f..af781172c35 100644 --- a/apps/files_external/lib/Lib/Auth/Password/SessionCredentials.php +++ b/apps/files_external/lib/Lib/Auth/Password/SessionCredentials.php @@ -51,7 +51,7 @@ class SessionCredentials extends AuthMechanism { ->addParameters([]); } - public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = null) { + 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 d8ed217b336..28457cf59de 100644 --- a/apps/files_external/lib/Lib/Auth/Password/UserGlobalAuth.php +++ b/apps/files_external/lib/Lib/Auth/Password/UserGlobalAuth.php @@ -69,7 +69,7 @@ class UserGlobalAuth extends AuthMechanism { $this->credentialsManager->store($user->getUID(), self::CREDENTIALS_IDENTIFIER, $credentials); } - public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = null) { + 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 87bf96aeae1..2dd39e3a47d 100644 --- a/apps/files_external/lib/Lib/Auth/Password/UserProvided.php +++ b/apps/files_external/lib/Lib/Auth/Password/UserProvided.php @@ -71,7 +71,7 @@ class UserProvided extends AuthMechanism implements IUserProvided { ]); } - public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = null) { + 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 c9ed8d1b9e3..2c52f654805 100644 --- a/apps/files_external/lib/Lib/Auth/PublicKey/RSA.php +++ b/apps/files_external/lib/Lib/Auth/PublicKey/RSA.php @@ -56,7 +56,7 @@ class RSA extends AuthMechanism { ; } - public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = null) { + 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 c648173a82b..bd6d87c22f8 100644 --- a/apps/files_external/lib/Lib/Auth/PublicKey/RSAPrivateKey.php +++ b/apps/files_external/lib/Lib/Auth/PublicKey/RSAPrivateKey.php @@ -54,7 +54,7 @@ class RSAPrivateKey extends AuthMechanism { ]); } - public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = null) { + 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 3a535577447..f9a0fd040ed 100644 --- a/apps/files_external/lib/Lib/Backend/InvalidBackend.php +++ b/apps/files_external/lib/Lib/Backend/InvalidBackend.php @@ -60,7 +60,7 @@ class InvalidBackend extends Backend { return $this->invalidId; } - public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = null) { + 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 bd15cb46127..41b8e2fbad7 100644 --- a/apps/files_external/lib/Lib/Backend/Local.php +++ b/apps/files_external/lib/Lib/Backend/Local.php @@ -48,7 +48,7 @@ class Local extends Backend { ; } - 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 9ac10025ea0..7fa2f3ae67a 100644 --- a/apps/files_external/lib/Lib/Backend/SMB.php +++ b/apps/files_external/lib/Lib/Backend/SMB.php @@ -77,7 +77,7 @@ class SMB extends Backend { ->setLegacyAuthMechanism($legacyAuth); } - public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = null) { + 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 35743c5bc3b..33cb80c2bb5 100644 --- a/apps/files_external/lib/Lib/Backend/SMB_OC.php +++ b/apps/files_external/lib/Lib/Backend/SMB_OC.php @@ -60,7 +60,7 @@ class SMB_OC extends Backend { ; } - public function manipulateStorageConfig(StorageConfig &$storage, IUser $user = null) { + 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 b2301543d8e..0e5c0be069c 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 72b97f5a42f..544ebc2c529 100644 --- a/apps/files_external/lib/Lib/Storage/FTP.php +++ b/apps/files_external/lib/Lib/Storage/FTP.php @@ -301,7 +301,7 @@ class FTP extends Common { 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 3fa04209fa0..e6fc5dd3e22 100644 --- a/apps/files_external/lib/Lib/Storage/SFTP.php +++ b/apps/files_external/lib/Lib/Storage/SFTP.php @@ -500,7 +500,7 @@ class SFTP extends Common { } } - 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 48e91531cc1..709539219fa 100644 --- a/apps/files_external/lib/Lib/StorageModifierTrait.php +++ b/apps/files_external/lib/Lib/StorageModifierTrait.php @@ -49,7 +49,7 @@ trait StorageModifierTrait { * @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 5ddff0f57fc..6c13ab3b727 100644 --- a/apps/files_external/lib/MountConfig.php +++ b/apps/files_external/lib/MountConfig.php @@ -88,7 +88,7 @@ class MountConfig { * @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 2eda36e9242..3a269e3622d 100644 --- a/apps/files_external/lib/Service/UserGlobalStoragesService.php +++ b/apps/files_external/lib/Service/UserGlobalStoragesService.php @@ -183,7 +183,7 @@ class UserGlobalStoragesService extends GlobalStoragesService { * @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 c6525a8be83..6d6e9fd5b85 100644 --- a/apps/files_external/templates/settings.php +++ b/apps/files_external/templates/settings.php @@ -1,8 +1,8 @@ <?php -use \OCA\Files_External\Lib\Auth\AuthMechanism; -use \OCA\Files_External\Lib\Backend\Backend; -use \OCA\Files_External\Lib\DefinitionParameter; -use \OCA\Files_External\Service\BackendService; +use OCA\Files_External\Lib\Auth\AuthMechanism; +use OCA\Files_External\Lib\Backend\Backend; +use OCA\Files_External\Lib\DefinitionParameter; +use OCA\Files_External\Service\BackendService; /** @var array $_ */ diff --git a/apps/files_sharing/lib/Activity/Providers/Base.php b/apps/files_sharing/lib/Activity/Providers/Base.php index 01d730242c9..af5f7cd2698 100644 --- a/apps/files_sharing/lib/Activity/Providers/Base.php +++ b/apps/files_sharing/lib/Activity/Providers/Base.php @@ -86,7 +86,7 @@ abstract class Base implements IProvider { * @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_sharing') { throw new \InvalidArgumentException(); } @@ -119,7 +119,7 @@ abstract class Base implements IProvider { * @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 @@ abstract class Base implements IProvider { * @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 8152e0b0885..3566431757d 100644 --- a/apps/files_sharing/lib/Activity/Providers/Downloads.php +++ b/apps/files_sharing/lib/Activity/Providers/Downloads.php @@ -68,7 +68,7 @@ class Downloads extends Base { * @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 a6e6fae3e9b..ac6aaba9dbf 100644 --- a/apps/files_sharing/lib/Activity/Providers/Groups.php +++ b/apps/files_sharing/lib/Activity/Providers/Groups.php @@ -102,7 +102,7 @@ class Groups extends Base { * @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 c09b9baa951..264e3c7d5f7 100644 --- a/apps/files_sharing/lib/Activity/Providers/PublicLinks.php +++ b/apps/files_sharing/lib/Activity/Providers/PublicLinks.php @@ -75,7 +75,7 @@ class PublicLinks extends Base { * @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 b46db3105e9..ea9e6895586 100644 --- a/apps/files_sharing/lib/Activity/Providers/RemoteShares.php +++ b/apps/files_sharing/lib/Activity/Providers/RemoteShares.php @@ -83,7 +83,7 @@ class RemoteShares extends Base { * @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 ce873eb5f77..26ddbb06318 100644 --- a/apps/files_sharing/lib/Activity/Providers/Users.php +++ b/apps/files_sharing/lib/Activity/Providers/Users.php @@ -91,7 +91,7 @@ class Users extends Base { * @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 c9a1486db2f..4a01d97cdf0 100644 --- a/apps/files_sharing/lib/Controller/ShareAPIController.php +++ b/apps/files_sharing/lib/Controller/ShareAPIController.php @@ -134,7 +134,7 @@ class ShareAPIController extends OCSController { IUserManager $userManager, IRootFolder $rootFolder, IURLGenerator $urlGenerator, - string $userId = null, + ?string $userId = null, IL10N $l10n, IConfig $config, IAppManager $appManager, @@ -170,7 +170,7 @@ class ShareAPIController extends OCSController { * * @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 @@ class ShareAPIController extends OCSController { * 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 @@ class ShareAPIController extends OCSController { */ 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 de601607f2c..31014ac6565 100644 --- a/apps/files_sharing/lib/Controller/ShareesAPIController.php +++ b/apps/files_sharing/lib/Controller/ShareesAPIController.php @@ -131,7 +131,7 @@ class ShareesAPIController extends OCSController { * * 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 7b64690d53e..8cd0b50f44f 100644 --- a/apps/files_sharing/lib/External/Storage.php +++ b/apps/files_sharing/lib/External/Storage.php @@ -95,7 +95,7 @@ class Storage extends DAV implements ISharedStorage, IDisableEncryptionStorage, $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 931301a04c4..c080a4f611c 100644 --- a/apps/files_sharing/lib/Helper.php +++ b/apps/files_sharing/lib/Helper.php @@ -68,7 +68,7 @@ class Helper { * @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 23096d64156..4dec20cabd9 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 e64ef2973f7..048631db7a5 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 9c1bf4e8910..29963438002 100644 --- a/apps/files_trashbin/lib/Events/BeforeNodeRestoredEvent.php +++ b/apps/files_trashbin/lib/Events/BeforeNodeRestoredEvent.php @@ -40,7 +40,7 @@ class BeforeNodeRestoredEvent extends AbstractNodesEvent { /** * @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 e1470e7634a..11ace4248d9 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 ada42dbe857..a608dc08331 100644 --- a/apps/files_trashbin/lib/Trash/LegacyTrashBackend.php +++ b/apps/files_trashbin/lib/Trash/LegacyTrashBackend.php @@ -51,7 +51,7 @@ class LegacyTrashBackend implements ITrashBackend { * @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 d140c5d60b1..8d6ba5e3ed4 100644 --- a/apps/provisioning_api/lib/Controller/GroupsController.php +++ b/apps/provisioning_api/lib/Controller/GroupsController.php @@ -117,7 +117,7 @@ class GroupsController extends AUserData { * * 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 @@ class GroupsController extends AUserData { * * 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 1833166a4c6..7a25f3e47c6 100644 --- a/apps/provisioning_api/lib/Controller/UsersController.php +++ b/apps/provisioning_api/lib/Controller/UsersController.php @@ -129,7 +129,7 @@ class UsersController extends AUserData { * * 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 @@ class UsersController extends AUserData { * * 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 32e6438d972..15b26128890 100644 --- a/apps/settings/lib/Activity/GroupProvider.php +++ b/apps/settings/lib/Activity/GroupProvider.php @@ -64,7 +64,7 @@ class GroupProvider implements IProvider { $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 001f75ba5e6..e10e55b5750 100644 --- a/apps/settings/lib/Activity/Provider.php +++ b/apps/settings/lib/Activity/Provider.php @@ -83,7 +83,7 @@ class Provider implements IProvider { * @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 cdf7b80298d..f847a53d4bf 100644 --- a/apps/settings/lib/Activity/SecurityProvider.php +++ b/apps/settings/lib/Activity/SecurityProvider.php @@ -51,7 +51,7 @@ class SecurityProvider implements IProvider { $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 50d72e582dd..f9fa07ed73a 100644 --- a/apps/settings/lib/Controller/ChangePasswordController.php +++ b/apps/settings/lib/Controller/ChangePasswordController.php @@ -79,7 +79,7 @@ class ChangePasswordController extends Controller { * @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 @@ class ChangePasswordController extends Controller { * @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 10b8f690812..2cfe9d515bf 100644 --- a/apps/settings/lib/Controller/UsersController.php +++ b/apps/settings/lib/Controller/UsersController.php @@ -391,10 +391,10 @@ class UsersController extends Controller { 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 2d41577f554..03c5f4bc3ac 100644 --- a/apps/settings/lib/Mailer/NewUserMailHelper.php +++ b/apps/settings/lib/Mailer/NewUserMailHelper.php @@ -108,7 +108,7 @@ class NewUserMailHelper { 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 07e4b513497..c6f5c9802ca 100644 --- a/apps/settings/lib/SetupChecks/PhpOpcacheSetup.php +++ b/apps/settings/lib/SetupChecks/PhpOpcacheSetup.php @@ -104,7 +104,7 @@ class PhpOpcacheSetup implements ISetupCheck { 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 17d1e6e7074..0ec402bd613 100644 --- a/apps/settings/templates/settings/personal/security/twofactor.php +++ b/apps/settings/templates/settings/personal/security/twofactor.php @@ -41,7 +41,7 @@ declare(strict_types=1); //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 @@ declare(strict_types=1); <?php } ?> </ul> </div> - diff --git a/apps/sharebymail/lib/Activity.php b/apps/sharebymail/lib/Activity.php index d1f15eb0e54..b8df056c8b7 100644 --- a/apps/sharebymail/lib/Activity.php +++ b/apps/sharebymail/lib/Activity.php @@ -85,7 +85,7 @@ class Activity implements IProvider { * @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 63e000325d4..be268c57ca8 100644 --- a/apps/systemtags/lib/Activity/Provider.php +++ b/apps/systemtags/lib/Activity/Provider.php @@ -75,7 +75,7 @@ class Provider implements IProvider { * @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 0c084b4f9cd..2174b6784f4 100644 --- a/apps/testing/lib/Controller/LockingController.php +++ b/apps/testing/lib/Controller/LockingController.php @@ -199,7 +199,7 @@ class LockingController extends OCSController { 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 1ccce652908..657c20036d3 100644 --- a/apps/theming/lib/Controller/UserThemeController.php +++ b/apps/theming/lib/Controller/UserThemeController.php @@ -204,7 +204,7 @@ class UserThemeController extends OCSController { * 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 169bc0c0223..c6ef6b9614d 100644 --- a/apps/theming/lib/Service/ThemeInjectionService.php +++ b/apps/theming/lib/Service/ThemeInjectionService.php @@ -93,7 +93,7 @@ class ThemeInjectionService { * @param bool $plain request the :root syntax * @param string $media media query to use in the <link> 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 500cb807e83..30d5b77bb6c 100644 --- a/apps/theming/tests/Controller/UserThemeControllerTest.php +++ b/apps/theming/tests/Controller/UserThemeControllerTest.php @@ -121,7 +121,7 @@ class UserThemeControllerTest extends TestCase { * @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 @@ class UserThemeControllerTest extends TestCase { * @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 2d60c8fe3f1..ffb67fcab8d 100644 --- a/apps/twofactor_backupcodes/lib/Activity/Provider.php +++ b/apps/twofactor_backupcodes/lib/Activity/Provider.php @@ -56,7 +56,7 @@ class Provider implements IProvider { $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 9d4b6a28500..92c53e64917 100644 --- a/apps/twofactor_backupcodes/lib/Service/BackupCodeStorage.php +++ b/apps/twofactor_backupcodes/lib/Service/BackupCodeStorage.php @@ -108,7 +108,7 @@ class BackupCodeStorage { $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 @@ class BackupCodeStorage { $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 3a1690c3b76..a51dfc3b349 100644 --- a/apps/user_ldap/lib/Access.php +++ b/apps/user_ldap/lib/Access.php @@ -492,7 +492,7 @@ class Access extends LDAPUtility { * @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 @@ class Access extends LDAPUtility { /** * @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 @@ class Access extends LDAPUtility { /** * @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 @@ class Access extends LDAPUtility { /** * @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 @@ class Access extends LDAPUtility { * @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 @@ class Access extends LDAPUtility { * 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 @@ class Access extends LDAPUtility { * @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 @@ class Access extends LDAPUtility { * @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 @@ class Access extends LDAPUtility { 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 @@ class Access extends LDAPUtility { * @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 @@ class Access extends LDAPUtility { } $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 2791324be5b..b0bb600cb3b 100644 --- a/apps/user_ldap/lib/Configuration.php +++ b/apps/user_ldap/lib/Configuration.php @@ -177,7 +177,7 @@ class Configuration { * 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 37f7dcaea5c..788344b4e7d 100644 --- a/apps/user_ldap/lib/Connection.php +++ b/apps/user_ldap/lib/Connection.php @@ -307,7 +307,7 @@ class Connection extends LDAPUtility { * @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 8644626d00b..015248f914d 100644 --- a/apps/user_ldap/lib/DataCollector/LdapDataCollector.php +++ b/apps/user_ldap/lib/DataCollector/LdapDataCollector.php @@ -48,6 +48,6 @@ class LdapDataCollector extends AbstractDataCollector { 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 f715a5e9fb9..b92aa2fcfaa 100644 --- a/apps/user_ldap/lib/Jobs/Sync.php +++ b/apps/user_ldap/lib/Jobs/Sync.php @@ -224,7 +224,7 @@ class Sync extends TimedJob { * @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 40bc8624c3c..6c2938661e2 100644 --- a/apps/user_ldap/lib/Mapping/AbstractMapping.php +++ b/apps/user_ldap/lib/Mapping/AbstractMapping.php @@ -322,7 +322,7 @@ abstract class AbstractMapping { 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 3b0015380ec..c3e9895e043 100644 --- a/apps/user_ldap/lib/User/User.php +++ b/apps/user_ldap/lib/User/User.php @@ -244,7 +244,7 @@ class User { ($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 @@ class User { 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 @@ class User { 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 @@ class User { * @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 5c994b8e3a5..1658001b31c 100644 --- a/apps/user_ldap/tests/Group_LDAPTest.php +++ b/apps/user_ldap/tests/Group_LDAPTest.php @@ -1356,7 +1356,7 @@ class Group_LDAPTest extends TestCase { * @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 623d08d565d..a706aae9895 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 @@ class IntegrationTestUserCleanUp extends AbstractIntegrationTest { } $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 23ce407dfd7..d6530faa9b6 100644 --- a/apps/user_ldap/tests/User/UserTest.php +++ b/apps/user_ldap/tests/User/UserTest.php @@ -837,7 +837,7 @@ class UserTest extends \Test\TestCase { /** * @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 1927aac6b40..01c7974cf2f 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 @@ class ScopeContext { 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 a484a828492..890eba99dac 100644 --- a/apps/workflowengine/tests/ManagerTest.php +++ b/apps/workflowengine/tests/ManagerTest.php @@ -121,7 +121,7 @@ class ManagerTest extends TestCase { /** * @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') |