diff --git a/core/BackgroundJobs/CheckForUserCertificates.php b/core/BackgroundJobs/CheckForUserCertificates.php index 11b851fff94a9..bcaa45bd070cf 100644 --- a/core/BackgroundJobs/CheckForUserCertificates.php +++ b/core/BackgroundJobs/CheckForUserCertificates.php @@ -71,7 +71,7 @@ public function run($arguments): void { \OC_Util::tearDownFS(); }); - if (empty($uploadList)) { + if ($uploadList === []) { $this->config->deleteAppValue('files_external', 'user_certificate_scan'); } else { $this->config->setAppValue('files_external', 'user_certificate_scan', json_encode($uploadList)); diff --git a/core/Command/Base.php b/core/Command/Base.php index abf9f95773a59..3e8b97fefcf94 100644 --- a/core/Command/Base.php +++ b/core/Command/Base.php @@ -96,7 +96,7 @@ protected function writeTableInOutputFormat(InputInterface $input, OutputInterfa default: $table = new Table($output); $table->setRows($items); - if (!empty($items) && is_string(array_key_first(reset($items)))) { + if ($items !== [] && is_string(array_key_first(reset($items)))) { $table->setHeaders(array_keys(reset($items))); } $table->render(); diff --git a/core/Command/Config/Import.php b/core/Command/Config/Import.php index 227c909038c7e..a0744269e5044 100644 --- a/core/Command/Config/Import.php +++ b/core/Command/Config/Import.php @@ -120,7 +120,7 @@ protected function getArrayFromFile($importFile) { */ protected function validateFileContent($content) { $decodedContent = json_decode($content, true); - if (!is_array($decodedContent) || empty($decodedContent)) { + if (!is_array($decodedContent) || $decodedContent === []) { throw new \UnexpectedValueException('The file must contain a valid json array'); } @@ -138,10 +138,10 @@ protected function validateArray($array) { $arrayKeys = array_keys($array); $additionalKeys = array_diff($arrayKeys, $this->validRootKeys); $commonKeys = array_intersect($arrayKeys, $this->validRootKeys); - if (!empty($additionalKeys)) { + if ($additionalKeys !== []) { throw new \UnexpectedValueException('Found invalid entries in root: ' . implode(', ', $additionalKeys)); } - if (empty($commonKeys)) { + if ($commonKeys === []) { throw new \UnexpectedValueException('At least one key of the following is expected: ' . implode(', ', $this->validRootKeys)); } diff --git a/core/Command/Config/System/Base.php b/core/Command/Config/System/Base.php index 18bc9cb7ca0e4..c278969a9d753 100644 --- a/core/Command/Config/System/Base.php +++ b/core/Command/Config/System/Base.php @@ -41,14 +41,14 @@ public function __construct(SystemConfig $systemConfig) { public function completeArgumentValues($argumentName, CompletionContext $context) { if ($argumentName === 'name') { $words = $this->getPreviousNames($context, $context->getWordIndex()); - if (empty($words)) { + if ($words === []) { $completions = $this->systemConfig->getKeys(); } else { $key = array_shift($words); $value = $this->systemConfig->getValue($key); $completions = array_keys($value); - while (!empty($words) && is_array($value)) { + while ($words !== [] && is_array($value)) { $key = array_shift($words); if (!isset($value[$key]) || !is_array($value[$key])) { break; diff --git a/core/Command/Config/System/DeleteConfig.php b/core/Command/Config/System/DeleteConfig.php index f4d49ba8f516a..9b77e9746f832 100644 --- a/core/Command/Config/System/DeleteConfig.php +++ b/core/Command/Config/System/DeleteConfig.php @@ -93,7 +93,7 @@ protected function removeSubValue($keys, $currentValue, $throwError) { if (is_array($currentValue)) { if (isset($currentValue[$nextKey])) { - if (empty($keys)) { + if ($keys === []) { unset($currentValue[$nextKey]); } else { $currentValue[$nextKey] = $this->removeSubValue($keys, $currentValue[$nextKey], $throwError); diff --git a/core/Command/Config/System/GetConfig.php b/core/Command/Config/System/GetConfig.php index 01bbf82d5d176..5300c69c6e86d 100644 --- a/core/Command/Config/System/GetConfig.php +++ b/core/Command/Config/System/GetConfig.php @@ -73,7 +73,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $configValue = $defaultValue; } else { $configValue = $this->systemConfig->getValue($configName); - if (!empty($configNames)) { + if ($configNames !== []) { foreach ($configNames as $configName) { if (isset($configValue[$configName])) { $configValue = $configValue[$configName]; diff --git a/core/Command/Config/System/SetConfig.php b/core/Command/Config/System/SetConfig.php index 01a1999bcf983..6a702ae87eb9b 100644 --- a/core/Command/Config/System/SetConfig.php +++ b/core/Command/Config/System/SetConfig.php @@ -175,7 +175,7 @@ protected function mergeArrayValue(array $configNames, $existingValues, $value, if (!is_array($existingValues)) { $existingValues = []; } - if (!empty($configNames)) { + if ($configNames !== []) { if (isset($existingValues[$configName])) { $existingValue = $existingValues[$configName]; } else { diff --git a/core/Command/Db/ConvertFilecacheBigInt.php b/core/Command/Db/ConvertFilecacheBigInt.php index 9d77ac9a5a046..f2707c14d9919 100644 --- a/core/Command/Db/ConvertFilecacheBigInt.php +++ b/core/Command/Db/ConvertFilecacheBigInt.php @@ -102,7 +102,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int } } - if (empty($updates)) { + if ($updates === []) { $output->writeln('All tables already up to date!'); return 0; } diff --git a/core/Command/Db/ConvertType.php b/core/Command/Db/ConvertType.php index f7638e3024f6b..46895c03cb3e6 100644 --- a/core/Command/Db/ConvertType.php +++ b/core/Command/Db/ConvertType.php @@ -196,7 +196,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int // warn/fail if there are more tables in 'from' database $extraFromTables = array_diff($fromTables, $toTables); - if (!empty($extraFromTables)) { + if ($extraFromTables !== []) { $output->writeln('The following tables will not be converted:'); $output->writeln($extraFromTables); if (!$input->getOption('all-apps')) { diff --git a/core/Command/TwoFactorAuth/State.php b/core/Command/TwoFactorAuth/State.php index 4694c76b40815..d8816d38b33eb 100644 --- a/core/Command/TwoFactorAuth/State.php +++ b/core/Command/TwoFactorAuth/State.php @@ -92,7 +92,7 @@ private function filterEnabledDisabledUnknownProviders(array $providerStates): a private function printProviders(string $title, array $providers, OutputInterface $output) { - if (empty($providers)) { + if ($providers === []) { // Ignore and don't print anything return; } diff --git a/core/Command/User/Report.php b/core/Command/User/Report.php index e080a61725850..9283483e8a327 100644 --- a/core/Command/User/Report.php +++ b/core/Command/User/Report.php @@ -69,7 +69,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $table->setHeaders(['User Report', '']); $userCountArray = $this->countUsers(); $total = 0; - if (!empty($userCountArray)) { + if ($userCountArray !== []) { $rows = []; foreach ($userCountArray as $classname => $users) { $total += $users; diff --git a/core/ajax/update.php b/core/ajax/update.php index dae08ad0882f9..6aa9cfdf6e412 100644 --- a/core/ajax/update.php +++ b/core/ajax/update.php @@ -198,7 +198,7 @@ function (MigratorExecuteSqlEvent $event) use ($eventSource, $l): void { $disabledApps[$app] = $l->t('%s (incompatible)', [$app]); } - if (!empty($disabledApps)) { + if ($disabledApps !== []) { $eventSource->send('notice', $l->t('The following apps have been disabled: %s', [implode(', ', $disabledApps)])); } } else { diff --git a/lib/base.php b/lib/base.php index c7fde4136fef3..d25f9559ab50d 100644 --- a/lib/base.php +++ b/lib/base.php @@ -219,7 +219,7 @@ public static function initPaths(): void { OC::$APPSROOTS[] = ['path' => OC::$SERVERROOT . '/apps', 'url' => '/apps', 'writable' => true]; } - if (empty(OC::$APPSROOTS)) { + if (OC::$APPSROOTS === []) { throw new \RuntimeException('apps directory not found! Please put the Nextcloud apps folder in the Nextcloud folder' . '. You can also configure the location in the config.php file.'); } @@ -392,7 +392,7 @@ private static function printUpgradePage(\OC\SystemConfig $systemConfig): void { } } - if (!empty($incompatibleShippedApps)) { + if ($incompatibleShippedApps !== []) { $l = Server::get(\OCP\L10N\IFactory::class)->get('core'); $hint = $l->t('Application %1$s is not present or has a non-compatible version with this server. Please check the apps directory.', [implode(', ', $incompatibleShippedApps)]); throw new \OCP\HintException('Application ' . implode(', ', $incompatibleShippedApps) . ' is not present or has a non-compatible version with this server. Please check the apps directory.', $hint); @@ -919,7 +919,7 @@ private static function registerAppRestrictionsHooks(): void { $key = array_search($group->getGID(), $restrictions); unset($restrictions[$key]); $restrictions = array_values($restrictions); - if (empty($restrictions)) { + if ($restrictions === []) { $appManager->disableApp($appId); } else { $appManager->enableAppForGroups($appId, $restrictions); diff --git a/lib/composer/composer/ClassLoader.php b/lib/composer/composer/ClassLoader.php index a72151c77c8eb..24e72d20b8ae3 100644 --- a/lib/composer/composer/ClassLoader.php +++ b/lib/composer/composer/ClassLoader.php @@ -117,7 +117,7 @@ public function __construct($vendorDir = null) */ public function getPrefixes() { - if (!empty($this->prefixesPsr0)) { + if ($this->prefixesPsr0 !== []) { return call_user_func_array('array_merge', array_values($this->prefixesPsr0)); } diff --git a/lib/private/Accounts/AccountManager.php b/lib/private/Accounts/AccountManager.php index 8fc16d5ce1a63..a3cdac19bf6b3 100644 --- a/lib/private/Accounts/AccountManager.php +++ b/lib/private/Accounts/AccountManager.php @@ -354,7 +354,7 @@ protected function getUser(IUser $user, bool $insertIfNotExists = true): array { $accountData = $result->fetchAll(); $result->closeCursor(); - if (empty($accountData)) { + if ($accountData === []) { $userData = $this->buildDefaultUserRecord($user); if ($insertIfNotExists) { $this->insertNewUser($user, $userData); diff --git a/lib/private/App/AppManager.php b/lib/private/App/AppManager.php index 9b038b7382689..c9936e08f7b40 100644 --- a/lib/private/App/AppManager.php +++ b/lib/private/App/AppManager.php @@ -561,7 +561,7 @@ public function hasProtectedAppType($types) { } $protectedTypes = array_intersect($this->protectedAppTypes, $types); - return !empty($protectedTypes); + return $protectedTypes !== []; } /** diff --git a/lib/private/App/AppStore/Fetcher/AppFetcher.php b/lib/private/App/AppStore/Fetcher/AppFetcher.php index 35bec10f5ae3e..80626d057a033 100644 --- a/lib/private/App/AppStore/Fetcher/AppFetcher.php +++ b/lib/private/App/AppStore/Fetcher/AppFetcher.php @@ -85,7 +85,7 @@ protected function fetch($ETag, $content, $allowUnstable = false) { /** @var mixed[] $response */ $response = parent::fetch($ETag, $content); - if (empty($response)) { + if ($response === []) { return []; } @@ -139,7 +139,7 @@ protected function fetch($ETag, $content, $allowUnstable = false) { } } - if (empty($releases)) { + if ($releases === []) { // Remove apps that don't have a matching release $response['data'][$dataKey] = []; continue; diff --git a/lib/private/App/AppStore/Fetcher/Fetcher.php b/lib/private/App/AppStore/Fetcher/Fetcher.php index 095b026cb4488..1799b27b6b0b3 100644 --- a/lib/private/App/AppStore/Fetcher/Fetcher.php +++ b/lib/private/App/AppStore/Fetcher/Fetcher.php @@ -189,7 +189,7 @@ public function get($allowUnstable = false) { try { $responseJson = $this->fetch($ETag, $content, $allowUnstable); - if (empty($responseJson)) { + if ($responseJson === []) { return []; } diff --git a/lib/private/AppFramework/Http/Dispatcher.php b/lib/private/AppFramework/Http/Dispatcher.php index b4b03574d567a..bfdaf709a416f 100644 --- a/lib/private/AppFramework/Http/Dispatcher.php +++ b/lib/private/AppFramework/Http/Dispatcher.php @@ -136,7 +136,7 @@ public function dispatch(Controller $controller, string $methodName): array { $response = $this->executeController($controller, $methodName); - if (!empty($databaseStatsBefore)) { + if ($databaseStatsBefore !== []) { $databaseStatsAfter = $this->connection->getInner()->getStats(); $numBuilt = $databaseStatsAfter['built'] - $databaseStatsBefore['built']; $numExecuted = $databaseStatsAfter['executed'] - $databaseStatsBefore['executed']; diff --git a/lib/private/AppFramework/Middleware/Security/BruteForceMiddleware.php b/lib/private/AppFramework/Middleware/Security/BruteForceMiddleware.php index ba8c7f45b49c3..4aae587213da5 100644 --- a/lib/private/AppFramework/Middleware/Security/BruteForceMiddleware.php +++ b/lib/private/AppFramework/Middleware/Security/BruteForceMiddleware.php @@ -72,7 +72,7 @@ public function beforeController($controller, $methodName) { $reflectionMethod = new ReflectionMethod($controller, $methodName); $attributes = $reflectionMethod->getAttributes(BruteForceProtection::class); - if (!empty($attributes)) { + if ($attributes !== []) { $remoteAddress = $this->request->getRemoteAddress(); foreach ($attributes as $attribute) { @@ -99,7 +99,7 @@ public function afterController($controller, $methodName, Response $response) { $reflectionMethod = new ReflectionMethod($controller, $methodName); $attributes = $reflectionMethod->getAttributes(BruteForceProtection::class); - if (!empty($attributes)) { + if ($attributes !== []) { $ip = $this->request->getRemoteAddress(); $metaData = $response->getThrottleMetadata(); diff --git a/lib/private/AppFramework/Middleware/Security/SecurityMiddleware.php b/lib/private/AppFramework/Middleware/Security/SecurityMiddleware.php index 8e0794f964563..6fd72a1f872eb 100644 --- a/lib/private/AppFramework/Middleware/Security/SecurityMiddleware.php +++ b/lib/private/AppFramework/Middleware/Security/SecurityMiddleware.php @@ -273,7 +273,7 @@ protected function getAuthorizedAdminSettingClasses(ReflectionMethod $reflection } $attributes = $reflectionMethod->getAttributes(AuthorizedAdminSetting::class); - if (!empty($attributes)) { + if ($attributes !== []) { foreach ($attributes as $attribute) { /** @var AuthorizedAdminSetting $setting */ $setting = $attribute->newInstance(); diff --git a/lib/private/Authentication/Login/TwoFactorCommand.php b/lib/private/Authentication/Login/TwoFactorCommand.php index 256d88ffa811b..fcf4eb6023b2e 100644 --- a/lib/private/Authentication/Login/TwoFactorCommand.php +++ b/lib/private/Authentication/Login/TwoFactorCommand.php @@ -61,9 +61,9 @@ public function process(LoginData $loginData): LoginResult { $providerSet = $this->twoFactorManager->getProviderSet($loginData->getUser()); $loginProviders = $this->twoFactorManager->getLoginSetupProviders($loginData->getUser()); $providers = $providerSet->getPrimaryProviders(); - if (empty($providers) + if ($providers === [] && !$providerSet->isProviderMissing() - && !empty($loginProviders) + && $loginProviders !== [] && $this->mandatoryTwoFactor->isEnforcedFor($loginData->getUser())) { // No providers set up, but 2FA is enforced and setup providers are available $url = 'core.TwoFactorChallenge.setupProviders'; diff --git a/lib/private/Authentication/Token/RemoteWipe.php b/lib/private/Authentication/Token/RemoteWipe.php index 5fd01cfbe879c..d06b965270012 100644 --- a/lib/private/Authentication/Token/RemoteWipe.php +++ b/lib/private/Authentication/Token/RemoteWipe.php @@ -85,7 +85,7 @@ public function markAllTokensForWipe(IUser $user): bool { return $token instanceof IWipeableToken; }); - if (empty($wipeable)) { + if ($wipeable === []) { return false; } diff --git a/lib/private/Authentication/TwoFactorAuth/Manager.php b/lib/private/Authentication/TwoFactorAuth/Manager.php index 7e115cf9b4221..140356a26d5ee 100644 --- a/lib/private/Authentication/TwoFactorAuth/Manager.php +++ b/lib/private/Authentication/TwoFactorAuth/Manager.php @@ -137,7 +137,7 @@ public function isTwoFactorAuthenticated(IUser $user): bool { $providerIds = array_keys($enabled); $providerIdsWithoutBackupCodes = array_diff($providerIds, [self::BACKUP_CODES_PROVIDER_ID]); - $this->userIsTwoFactorAuthenticated[$user->getUID()] = !empty($providerIdsWithoutBackupCodes); + $this->userIsTwoFactorAuthenticated[$user->getUID()] = $providerIdsWithoutBackupCodes !== []; return $this->userIsTwoFactorAuthenticated[$user->getUID()]; } @@ -222,7 +222,7 @@ private function isProviderMissing(array $states, array $providers): bool { } } - if (!empty($missing)) { + if ($missing !== []) { // There was at least one provider missing $this->logger->alert(count($missing) . " two-factor auth providers failed to load", ['app' => 'core']); diff --git a/lib/private/Calendar/Manager.php b/lib/private/Calendar/Manager.php index 7ef9dc585ae3c..5ef2f599d509c 100644 --- a/lib/private/Calendar/Manager.php +++ b/lib/private/Calendar/Manager.php @@ -269,7 +269,7 @@ public function handleIMipReply(string $principalUri, string $sender, string $re } $calendars = $this->getCalendarsForPrincipal($principalUri); - if (empty($calendars)) { + if ($calendars === []) { $this->logger->warning('Could not find any calendars for principal ' . $principalUri); return false; } @@ -283,7 +283,7 @@ public function handleIMipReply(string $principalUri, string $sender, string $re // We should not search in writable calendars if ($calendar instanceof IHandleImipMessage) { $o = $calendar->search($sender, ['ATTENDEE'], ['uid' => $vEvent->{'UID'}->getValue()]); - if (!empty($o)) { + if ($o !== []) { $found = $calendar; $name = $o[0]['uri']; break; @@ -347,7 +347,7 @@ public function handleIMipCancel(string $principalUri, string $sender, ?string $ // Check if we have a calendar to work with $calendars = $this->getCalendarsForPrincipal($principalUri); - if (empty($calendars)) { + if ($calendars === []) { $this->logger->warning('Could not find any calendars for principal ' . $principalUri); return false; } @@ -361,7 +361,7 @@ public function handleIMipCancel(string $principalUri, string $sender, ?string $ // We should not search in writable calendars if ($calendar instanceof IHandleImipMessage) { $o = $calendar->search($recipient, ['ATTENDEE'], ['uid' => $vEvent->{'UID'}->getValue()]); - if (!empty($o)) { + if ($o !== []) { $found = $calendar; $name = $o[0]['uri']; break; diff --git a/lib/private/Collaboration/Collaborators/GroupPlugin.php b/lib/private/Collaboration/Collaborators/GroupPlugin.php index 75e52c19e0b27..f73a3d572c492 100644 --- a/lib/private/Collaboration/Collaborators/GroupPlugin.php +++ b/lib/private/Collaboration/Collaborators/GroupPlugin.php @@ -82,7 +82,7 @@ public function search($search, $limit, $offset, ISearchResult $searchResult) { } $userGroups = []; - if (!empty($groups) && ($this->shareWithGroupOnly || $this->shareeEnumerationInGroupOnly)) { + if ($groups !== [] && ($this->shareWithGroupOnly || $this->shareeEnumerationInGroupOnly)) { // Intersect all the groups that match with the groups this user is a member of $userGroups = $this->groupManager->getUserGroups($this->userSession->getUser()); $userGroups = array_map(function (IGroup $group) { diff --git a/lib/private/Collaboration/Collaborators/UserPlugin.php b/lib/private/Collaboration/Collaborators/UserPlugin.php index 9beecdaa6cbbf..73c5be977407f 100644 --- a/lib/private/Collaboration/Collaborators/UserPlugin.php +++ b/lib/private/Collaboration/Collaborators/UserPlugin.php @@ -125,7 +125,7 @@ public function search($search, $limit, $offset, ISearchResult $searchResult) { if (!$this->shareWithGroupOnly && $this->shareeEnumerationPhone) { $usersTmp = $this->userManager->searchKnownUsersByDisplayName($currentUserId, $search, $limit, $offset); - if (!empty($usersTmp)) { + if ($usersTmp !== []) { foreach ($usersTmp as $user) { if ($user->isEnabled()) { // Don't keep deactivated users $users[$user->getUID()] = $user; @@ -217,7 +217,7 @@ public function search($search, $limit, $offset, ISearchResult $searchResult) { if (!$addToWideResults && $this->shareeEnumerationInGroupOnly) { $commonGroups = array_intersect($currentUserGroups, $this->groupManager->getUserGroupIds($user)); - if (!empty($commonGroups)) { + if ($commonGroups !== []) { $addToWideResults = true; } } @@ -248,7 +248,7 @@ public function search($search, $limit, $offset, ISearchResult $searchResult) { if ($this->shareWithGroupOnly) { // Only add, if we have a common group $commonGroups = array_intersect($currentUserGroups, $this->groupManager->getUserGroupIds($user)); - $addUser = !empty($commonGroups); + $addUser = $commonGroups !== []; } if ($addUser) { diff --git a/lib/private/Collaboration/Reference/File/FileReferenceProvider.php b/lib/private/Collaboration/Reference/File/FileReferenceProvider.php index d423a83049567..b9168adec3cf9 100644 --- a/lib/private/Collaboration/Reference/File/FileReferenceProvider.php +++ b/lib/private/Collaboration/Reference/File/FileReferenceProvider.php @@ -131,7 +131,7 @@ private function fetchReference(Reference $reference): void { $userFolder = $this->rootFolder->getUserFolder($this->userId); $files = $userFolder->getById($fileId); - if (empty($files)) { + if ($files === []) { throw new NotFoundException(); } diff --git a/lib/private/Collaboration/Reference/ReferenceManager.php b/lib/private/Collaboration/Reference/ReferenceManager.php index 2897410f5d613..91fb71023b0f8 100644 --- a/lib/private/Collaboration/Reference/ReferenceManager.php +++ b/lib/private/Collaboration/Reference/ReferenceManager.php @@ -247,7 +247,7 @@ public function touchProvider(string $userId, string $providerId, ?int $timestam $matchingProviders = array_filter($providers, static function (IDiscoverableReferenceProvider $provider) use ($providerId) { return $provider->getId() === $providerId; }); - if (!empty($matchingProviders)) { + if ($matchingProviders !== []) { if ($timestamp === null) { $timestamp = time(); } diff --git a/lib/private/Collaboration/Resources/Manager.php b/lib/private/Collaboration/Resources/Manager.php index fc8804e69b4dc..3d66814331881 100644 --- a/lib/private/Collaboration/Resources/Manager.php +++ b/lib/private/Collaboration/Resources/Manager.php @@ -165,7 +165,7 @@ public function searchCollections(IUser $user, string $filter, int $limit = 50, } $result->closeCursor(); - if (empty($collections) && $foundResults === $limit) { + if ($collections === [] && $foundResults === $limit) { return $this->searchCollections($user, $filter, $limit, $start + $limit); } diff --git a/lib/private/Comments/Manager.php b/lib/private/Comments/Manager.php index 117318fb2782f..5a57ecd47af19 100644 --- a/lib/private/Comments/Manager.php +++ b/lib/private/Comments/Manager.php @@ -490,7 +490,7 @@ public function getCommentsWithVerbForObjectSinceComment( $query->setMaxResults($limit); } - if (!empty($verbs)) { + if ($verbs !== []) { $query->andWhere($query->expr()->in('verb', $query->createNamedParameter($verbs, IQueryBuilder::PARAM_STR_ARRAY))); } @@ -638,7 +638,7 @@ public function searchForObjects(string $search, string $objectType, array $obje if ($objectType !== '') { $query->andWhere($query->expr()->eq('object_type', $query->createNamedParameter($objectType))); } - if (!empty($objectIds)) { + if ($objectIds !== []) { $query->andWhere($query->expr()->in('object_id', $query->createNamedParameter($objectIds, IQueryBuilder::PARAM_STR_ARRAY))); } if ($verb !== '') { @@ -771,7 +771,7 @@ public function getNumberOfCommentsWithVerbsForObjectSinceComment(string $object ->andWhere($query->expr()->eq('object_id', $query->createNamedParameter($objectId))) ->andWhere($query->expr()->gt('id', $query->createNamedParameter($lastRead))); - if (!empty($verbs)) { + if ($verbs !== []) { $query->andWhere($query->expr()->in('verb', $query->createNamedParameter($verbs, IQueryBuilder::PARAM_STR_ARRAY))); } diff --git a/lib/private/Console/Application.php b/lib/private/Console/Application.php index 94956364390db..ea07ab53632ea 100644 --- a/lib/private/Console/Application.php +++ b/lib/private/Console/Application.php @@ -158,7 +158,7 @@ public function loadCommands( if ($input->getFirstArgument() !== 'check') { $errors = \OC_Util::checkServer(\OC::$server->getSystemConfig()); - if (!empty($errors)) { + if ($errors !== []) { foreach ($errors as $error) { $output->writeln((string)$error['error']); $output->writeln((string)$error['hint']); diff --git a/lib/private/Contacts/ContactsMenu/Entry.php b/lib/private/Contacts/ContactsMenu/Entry.php index 51fde76040749..c279fca4d3a0e 100644 --- a/lib/private/Contacts/ContactsMenu/Entry.php +++ b/lib/private/Contacts/ContactsMenu/Entry.php @@ -149,7 +149,7 @@ public function getProperty(string $key) { * @return array */ public function jsonSerialize(): array { - $topAction = !empty($this->actions) ? $this->actions[0]->jsonSerialize() : null; + $topAction = $this->actions !== [] ? $this->actions[0]->jsonSerialize() : null; $otherActions = array_map(function (IAction $action) { return $action->jsonSerialize(); }, array_slice($this->actions, 1)); diff --git a/lib/private/DB/Connection.php b/lib/private/DB/Connection.php index 85c6a72dfdbd5..9cbc04c3cf4f2 100644 --- a/lib/private/DB/Connection.php +++ b/lib/private/DB/Connection.php @@ -425,7 +425,7 @@ public function setValues(string $table, array $keys, array $values, array $upda $updateQb->where($where); $affected = $updateQb->executeStatement(); - if ($affected === 0 && !empty($updatePreconditionValues)) { + if ($affected === 0 && $updatePreconditionValues !== []) { throw new PreConditionNotMetException(); } diff --git a/lib/private/DB/MigrationService.php b/lib/private/DB/MigrationService.php index 7993730b23006..dffba634838c7 100644 --- a/lib/private/DB/MigrationService.php +++ b/lib/private/DB/MigrationService.php @@ -223,7 +223,7 @@ protected function findMigrations() { uasort($files, function ($a, $b) { preg_match('/^Version(\d+)Date(\d+)\\.php$/', basename($a), $matchA); preg_match('/^Version(\d+)Date(\d+)\\.php$/', basename($b), $matchB); - if (!empty($matchA) && !empty($matchB)) { + if ($matchA !== [] && $matchB !== []) { if ($matchA[1] !== $matchB[1]) { return ($matchA[1] < $matchB[1]) ? -1 : 1; } @@ -433,7 +433,7 @@ public function migrateSchemaOnly($to = 'latest') { // read known migrations $toBeExecuted = $this->getMigrationsToExecute($to); - if (empty($toBeExecuted)) { + if ($toBeExecuted === []) { return; } @@ -660,7 +660,7 @@ public function ensureOracleConstraints(Schema $sourceSchema, Schema $targetSche } private function ensureMigrationsAreLoaded() { - if (empty($this->migrations)) { + if ($this->migrations === []) { $this->migrations = $this->findMigrations(); } } diff --git a/lib/private/DB/QueryBuilder/QueryBuilder.php b/lib/private/DB/QueryBuilder/QueryBuilder.php index 43ed68f5616ac..9ce98ea26b16b 100644 --- a/lib/private/DB/QueryBuilder/QueryBuilder.php +++ b/lib/private/DB/QueryBuilder/QueryBuilder.php @@ -212,7 +212,7 @@ public function execute() { $params[] = $placeholder . ' => \'' . $value . '\''; } } - if (empty($params)) { + if ($params === []) { $this->logger->debug('DB QueryBuilder: \'{query}\'', [ 'query' => $this->getSQL(), 'app' => 'core', diff --git a/lib/private/Files/Cache/Scanner.php b/lib/private/Files/Cache/Scanner.php index 6969828782a4a..f20637a24ccc7 100644 --- a/lib/private/Files/Cache/Scanner.php +++ b/lib/private/Files/Cache/Scanner.php @@ -223,7 +223,7 @@ public function scanFile($file, $reuseExisting = 0, $parentId = -1, $cacheData = $newData = $data; $fileId = -1; } - if (!empty($newData)) { + if ($newData !== []) { // Reset the checksum if the data has changed $newData['checksum'] = ''; $newData['parent'] = $parentId; diff --git a/lib/private/Files/Storage/Wrapper/Encryption.php b/lib/private/Files/Storage/Wrapper/Encryption.php index 9c0e6c9146396..f7650125dc847 100644 --- a/lib/private/Files/Storage/Wrapper/Encryption.php +++ b/lib/private/Files/Storage/Wrapper/Encryption.php @@ -984,7 +984,7 @@ protected function getHeader($path) { // if the header doesn't contain a encryption module we check if it is a // legacy file. If true, we add the default encryption module - if (!isset($result[Util::HEADER_ENCRYPTION_MODULE_KEY]) && (!empty($result) || $exists)) { + if (!isset($result[Util::HEADER_ENCRYPTION_MODULE_KEY]) && ($result !== [] || $exists)) { $result[Util::HEADER_ENCRYPTION_MODULE_KEY] = 'OC_DEFAULT_MODULE'; } } diff --git a/lib/private/Group/Manager.php b/lib/private/Group/Manager.php index b718afa516828..a1d445dc1416d 100644 --- a/lib/private/Group/Manager.php +++ b/lib/private/Group/Manager.php @@ -184,7 +184,7 @@ protected function getGroupObject($gid, $displayName = null) { foreach ($this->backends as $backend) { if ($backend->implementsActions(Backend::GROUP_DETAILS)) { $groupData = $backend->getGroupDetails($gid); - if (is_array($groupData) && !empty($groupData)) { + if (is_array($groupData) && $groupData !== []) { // take the display name from the first backend that has a non-null one if (is_null($displayName) && isset($groupData['displayName'])) { $displayName = $groupData['displayName']; diff --git a/lib/private/IntegrityCheck/Checker.php b/lib/private/IntegrityCheck/Checker.php index e31c580554178..2e9da95cccef2 100644 --- a/lib/private/IntegrityCheck/Checker.php +++ b/lib/private/IntegrityCheck/Checker.php @@ -427,7 +427,7 @@ private function verify(string $signaturePath, string $basePath, string $certifi */ public function hasPassedCheck(): bool { $results = $this->getResults(); - if (empty($results)) { + if ($results === []) { return true; } @@ -458,7 +458,7 @@ public function getResults(): array { private function storeResults(string $scope, array $result) { $resultArray = $this->getResults(); unset($resultArray[$scope]); - if (!empty($result)) { + if ($result !== []) { $resultArray[$scope] = $result; } if ($this->config !== null) { diff --git a/lib/private/Mail/Mailer.php b/lib/private/Mail/Mailer.php index 5d838b2cdf1f0..c8811f79f53fa 100644 --- a/lib/private/Mail/Mailer.php +++ b/lib/private/Mail/Mailer.php @@ -309,7 +309,7 @@ protected function getSmtpInstance(): EsmtpTransport { } $streamingOptions = $this->config->getSystemValue('mail_smtpstreamoptions', []); - if (is_array($streamingOptions) && !empty($streamingOptions)) { + if (is_array($streamingOptions) && $streamingOptions !== []) { /** @psalm-suppress InternalMethod */ $currentStreamingOptions = $stream->getStreamOptions(); diff --git a/lib/private/Mail/Message.php b/lib/private/Mail/Message.php index 35d6f96d33acb..d83d9c6636d52 100644 --- a/lib/private/Mail/Message.php +++ b/lib/private/Mail/Message.php @@ -101,7 +101,7 @@ public function attachInline(string $body, string $name, string $contentType = n protected function convertAddresses(array $addresses): array { $convertedAddresses = []; - if (empty($addresses)) { + if ($addresses === []) { return []; } diff --git a/lib/private/PreviewManager.php b/lib/private/PreviewManager.php index 814235f421287..ed62bf41ecbc7 100644 --- a/lib/private/PreviewManager.php +++ b/lib/private/PreviewManager.php @@ -148,7 +148,7 @@ public function getProviders(): array { */ public function hasProviders(): bool { $this->registerCoreProviders(); - return !empty($this->providers); + return $this->providers !== []; } private function getGenerator(): Generator { diff --git a/lib/private/Repair/CleanTags.php b/lib/private/Repair/CleanTags.php index 531fcc1112f9e..7e84baa331d41 100644 --- a/lib/private/Repair/CleanTags.php +++ b/lib/private/Repair/CleanTags.php @@ -109,7 +109,7 @@ protected function checkTags($offset) { return false; } - if (!empty($users)) { + if ($users !== []) { $query = $this->connection->getQueryBuilder(); $query->delete('vcategory') ->where($query->expr()->in('uid', $query->createNamedParameter($users, IQueryBuilder::PARAM_STR_ARRAY))); @@ -188,7 +188,7 @@ protected function deleteOrphanEntries(IOutput $output, $repairInfo, $deleteTabl $orphanItems[] = (int) $row[$deleteId]; } - if (!empty($orphanItems)) { + if ($orphanItems !== []) { $orphanItemsBatch = array_chunk($orphanItems, 200); foreach ($orphanItemsBatch as $items) { $qb->delete($deleteTable) diff --git a/lib/private/Repair/Collation.php b/lib/private/Repair/Collation.php index 6f7dde6886588..7569bbd65a88d 100644 --- a/lib/private/Repair/Collation.php +++ b/lib/private/Repair/Collation.php @@ -102,7 +102,7 @@ public function run(IOutput $output) { } } } - if (empty($tables)) { + if ($tables === []) { $output->info('All tables already have the correct collation -> nothing to do'); } } diff --git a/lib/private/Repair/NC16/CleanupCardDAVPhotoCache.php b/lib/private/Repair/NC16/CleanupCardDAVPhotoCache.php index 394e47dfcda08..b44879beb2c09 100644 --- a/lib/private/Repair/NC16/CleanupCardDAVPhotoCache.php +++ b/lib/private/Repair/NC16/CleanupCardDAVPhotoCache.php @@ -77,7 +77,7 @@ private function repair(IOutput $output): void { return $folder->fileExists('photo.'); }); - if (empty($folders)) { + if ($folders === []) { return; } diff --git a/lib/private/RichObjectStrings/Validator.php b/lib/private/RichObjectStrings/Validator.php index 4585cbfc8148c..5a9ca2db2fecb 100644 --- a/lib/private/RichObjectStrings/Validator.php +++ b/lib/private/RichObjectStrings/Validator.php @@ -94,7 +94,7 @@ protected function validateParameter(array $parameter) { $requiredParameters = $this->getRequiredParameters($parameter['type'], $definition); $missingKeys = array_diff($requiredParameters, array_keys($parameter)); - if (!empty($missingKeys)) { + if ($missingKeys !== []) { throw new InvalidObjectExeption('Object is invalid'); } } diff --git a/lib/private/Settings/Manager.php b/lib/private/Settings/Manager.php index 2d44ac7d3df4c..26c74b97ee6ad 100644 --- a/lib/private/Settings/Manager.php +++ b/lib/private/Settings/Manager.php @@ -291,7 +291,7 @@ public function getPersonalSections(): array { $sections = []; $legacyForms = \OC_App::getForms('personal'); - if ((!empty($legacyForms) && $this->hasLegacyPersonalSettingsToRender($legacyForms)) + if (($legacyForms !== [] && $this->hasLegacyPersonalSettingsToRender($legacyForms)) || count($this->getPersonalSettings('additional')) > 1) { $sections[98] = [new Section('additional', $this->l->t('Additional settings'), 0, $this->url->imagePath('core', 'actions/settings-dark.svg'))]; } diff --git a/lib/private/Setup.php b/lib/private/Setup.php index 7567aaf14b1da..69211731c071b 100644 --- a/lib/private/Setup.php +++ b/lib/private/Setup.php @@ -308,7 +308,7 @@ public function install($options) { $error[] = $l->t("Cannot create or write into the data directory %s", [$dataDir]); } - if (!empty($error)) { + if ($error !== []) { return $error; } diff --git a/lib/private/Share/Share.php b/lib/private/Share/Share.php index dec71f792fdcf..84e7b1d65e6b9 100644 --- a/lib/private/Share/Share.php +++ b/lib/private/Share/Share.php @@ -177,7 +177,7 @@ public static function getItemSharedWithUser(string $itemType, string $itemSourc // if it is a mount point we need to get the path from the mount manager $mountManager = \OC\Files\Filesystem::getMountManager(); $mountPoint = $mountManager->findByStorageId($row['storage_id']); - if (!empty($mountPoint)) { + if ($mountPoint !== []) { $path = $mountPoint[0]->getMountPoint(); $path = trim($path, '/'); $path = substr($path, strlen($owner) + 1); //normalize path to 'files/foo.txt` @@ -194,7 +194,7 @@ public static function getItemSharedWithUser(string $itemType, string $itemSourc $result->closeCursor(); // if we didn't found a result then let's look for a group share. - if (empty($shares) && $user !== null) { + if ($shares === [] && $user !== null) { $userObject = \OC::$server->getUserManager()->get($user); $groups = []; if ($userObject) { @@ -572,7 +572,7 @@ public static function getItems($itemType, ?string $item = null, ?int $shareType } else { if (!isset($mounts[$row['storage']])) { $mountPoints = \OC\Files\Filesystem::getMountByNumericId($row['storage']); - if (is_array($mountPoints) && !empty($mountPoints)) { + if (is_array($mountPoints) && $mountPoints !== []) { $mounts[$row['storage']] = current($mountPoints); } } @@ -626,7 +626,7 @@ public static function getItems($itemType, ?string $item = null, ?int $shareType $items = self::groupItems($items, $itemType); } - if (!empty($items)) { + if ($items !== []) { $collectionItems = []; foreach ($items as &$row) { // Check if this is a collection of the requested item type @@ -689,7 +689,7 @@ public static function getItems($itemType, ?string $item = null, ?int $shareType } } } - if (!empty($collectionItems)) { + if ($collectionItems !== []) { $collectionItems = array_unique($collectionItems, SORT_REGULAR); $items = array_merge($items, $collectionItems); } diff --git a/lib/private/Share20/DefaultShareProvider.php b/lib/private/Share20/DefaultShareProvider.php index 9dd862abb3175..681b06efaf834 100644 --- a/lib/private/Share20/DefaultShareProvider.php +++ b/lib/private/Share20/DefaultShareProvider.php @@ -1277,7 +1277,7 @@ public function groupDeleted($gid) { } $cursor->closeCursor(); - if (!empty($ids)) { + if ($ids !== []) { $chunks = array_chunk($ids, 100); foreach ($chunks as $chunk) { $qb->delete('share') @@ -1320,7 +1320,7 @@ public function userDeletedFromGroup($uid, $gid) { } $cursor->closeCursor(); - if (!empty($ids)) { + if ($ids !== []) { $chunks = array_chunk($ids, 100); foreach ($chunks as $chunk) { /* @@ -1485,7 +1485,7 @@ private function sendNote(array $recipients, IShare $share) { } } - if (empty($toListByLanguage)) { + if ($toListByLanguage === []) { return; } diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php index 732bd5bb97d39..2867aebe71453 100644 --- a/lib/private/Share20/Manager.php +++ b/lib/private/Share20/Manager.php @@ -323,7 +323,7 @@ protected function generalCreateChecks(IShare $share) { $incomingShares = array_merge($incomingShares, $this->getSharedWith($share->getSharedBy(), IShare::TYPE_ROOM, $userMountPoint, -1, 0)); /** @var IShare[] $incomingShares */ - if (!empty($incomingShares)) { + if ($incomingShares !== []) { foreach ($incomingShares as $incomingShare) { $permissions |= $incomingShare->getPermissions(); } @@ -550,7 +550,7 @@ protected function userCreateChecks(IShare $share) { $this->groupManager->getUserGroupIds($sharedBy), $this->groupManager->getUserGroupIds($sharedWith) ); - if (empty($groups)) { + if ($groups === []) { $message_t = $this->l->t('Sharing is only allowed with group members'); throw new \Exception($message_t); } @@ -948,7 +948,7 @@ protected function sendMailNotification(IL10N $l, $message->useTemplate($emailTemplate); try { $failedRecipients = $this->mailer->send($message); - if (!empty($failedRecipients)) { + if ($failedRecipients !== []) { $this->logger->error('Share notification mail could not be sent to: ' . implode(', ', $failedRecipients)); return; } @@ -1386,7 +1386,7 @@ public function getSharesBy($userId, $shareType, $path = null, $reshares = false $shares = $provider->getSharesBy($userId, $shareType, $path, $reshares, $limit, $offset); // No more shares means we are done - if (empty($shares)) { + if ($shares === []) { break; } } @@ -2038,11 +2038,11 @@ public function sharingDisabledForUser($userId) { } $user = $this->userManager->get($userId); $usersGroups = $this->groupManager->getUserGroupIds($user); - if (!empty($usersGroups)) { + if ($usersGroups !== []) { $remainingGroups = array_diff($usersGroups, $excludedGroups); // if the user is only in groups which are disabled for sharing then // sharing is also disabled for the user - if (empty($remainingGroups)) { + if ($remainingGroups === []) { $this->sharingDisabledForUsersCache[$userId] = true; return true; } diff --git a/lib/private/Share20/Share.php b/lib/private/Share20/Share.php index 0a50fa0ccfb52..db0d1bed386bf 100644 --- a/lib/private/Share20/Share.php +++ b/lib/private/Share20/Share.php @@ -189,7 +189,7 @@ public function getNode() { } $nodes = $userFolder->getById($this->fileId); - if (empty($nodes)) { + if ($nodes === []) { throw new NotFoundException('Node for share not found, fileid: ' . $this->fileId); } diff --git a/lib/private/Share20/ShareHelper.php b/lib/private/Share20/ShareHelper.php index 3debfe185e0eb..026a154737ac8 100644 --- a/lib/private/Share20/ShareHelper.php +++ b/lib/private/Share20/ShareHelper.php @@ -109,13 +109,13 @@ protected function getPathsForUsers(Node $node, array $users) { return $results; } - if (empty($byId)) { + if ($byId === []) { return $results; } $item = $node; $appendix = '/' . $node->getName(); - while (!empty($byId)) { + while ($byId !== []) { try { /** @var Node $item */ $item = $item->getParent(); @@ -178,7 +178,7 @@ protected function getPathsForRemotes(Node $node, array $remotes) { } $item = $node; - while (!empty($byId)) { + while ($byId !== []) { try { if (!empty($byId[$item->getId()])) { $path = $this->getMountedPath($item); diff --git a/lib/private/Support/CrashReport/Registry.php b/lib/private/Support/CrashReport/Registry.php index f2a3506928896..4060bcb0a879b 100644 --- a/lib/private/Support/CrashReport/Registry.php +++ b/lib/private/Support/CrashReport/Registry.php @@ -148,6 +148,6 @@ private function loadLazyProviders(): void { } public function hasReporters(): bool { - return !empty($this->lazyReporters) || !empty($this->reporters); + return $this->lazyReporters !== [] || $this->reporters !== []; } } diff --git a/lib/private/SystemTag/SystemTagManager.php b/lib/private/SystemTag/SystemTagManager.php index 79c5adcf450ad..d1623dee56410 100644 --- a/lib/private/SystemTag/SystemTagManager.php +++ b/lib/private/SystemTag/SystemTagManager.php @@ -296,7 +296,7 @@ public function deleteTags($tagIds) { // Get existing tag objects for the hooks later $existingTags = array_diff($tagIds, $tagNotFoundException->getMissingTags()); - if (!empty($existingTags)) { + if ($existingTags !== []) { try { $tags = $this->getTagsByIds($existingTags); } catch (TagNotFoundException $e) { @@ -349,9 +349,9 @@ public function canUserAssignTag(ISystemTag $tag, IUser $user): bool { } $groupIds = $this->groupManager->getUserGroupIds($user); - if (!empty($groupIds)) { + if ($groupIds !== []) { $matchingGroups = array_intersect($groupIds, $this->getTagGroups($tag)); - if (!empty($matchingGroups)) { + if ($matchingGroups !== []) { return true; } } diff --git a/lib/private/SystemTag/SystemTagObjectMapper.php b/lib/private/SystemTag/SystemTagObjectMapper.php index b61a81a1fa701..52c11b9e58ce3 100644 --- a/lib/private/SystemTag/SystemTagObjectMapper.php +++ b/lib/private/SystemTag/SystemTagObjectMapper.php @@ -68,7 +68,7 @@ public function __construct(IDBConnection $connection, ISystemTagManager $tagMan public function getTagIdsForObjects($objIds, string $objectType): array { if (!\is_array($objIds)) { $objIds = [$objIds]; - } elseif (empty($objIds)) { + } elseif ($objIds === []) { return []; } @@ -168,7 +168,7 @@ public function assignTags(string $objId, string $objectType, $tagIds) { } } - if (empty($tagsAssigned)) { + if ($tagsAssigned === []) { return; } diff --git a/lib/private/Updater.php b/lib/private/Updater.php index 5628516632222..569e3ddd26412 100644 --- a/lib/private/Updater.php +++ b/lib/private/Updater.php @@ -279,7 +279,7 @@ private function doUpgrade(string $currentVersion, string $installedVersion): vo // upgrade appstore apps $this->upgradeAppStoreApps($appManager->getInstalledApps()); $autoDisabledApps = $appManager->getAutoDisabledApps(); - if (!empty($autoDisabledApps)) { + if ($autoDisabledApps !== []) { $this->upgradeAppStoreApps(array_keys($autoDisabledApps), $autoDisabledApps); } @@ -422,7 +422,7 @@ private function upgradeAppStoreApps(array $apps, array $previousEnableStates = } $this->emit('\OC\Updater', 'checkAppStoreApp', [$app]); - if (!empty($previousEnableStates)) { + if ($previousEnableStates !== []) { $ocApp = new \OC_App(); if (!empty($previousEnableStates[$app]) && is_array($previousEnableStates[$app])) { $ocApp->enable($app, $previousEnableStates[$app]); diff --git a/lib/private/User/Session.php b/lib/private/User/Session.php index 6273945ec4324..ad458432f1d1b 100644 --- a/lib/private/User/Session.php +++ b/lib/private/User/Session.php @@ -504,7 +504,7 @@ protected function isTwoFactorEnforced($username) { $user = $this->manager->get($username); if (is_null($user)) { $users = $this->manager->getByEmail($username); - if (empty($users)) { + if ($users === []) { return false; } if (count($users) !== 1) { diff --git a/lib/private/legacy/OC_App.php b/lib/private/legacy/OC_App.php index b1da6a1d2fbea..c65797c225f51 100644 --- a/lib/private/legacy/OC_App.php +++ b/lib/private/legacy/OC_App.php @@ -335,7 +335,7 @@ public static function findAppInDirectories(string $appId, bool $ignoreCache = f } } - if (empty($possibleApps)) { + if ($possibleApps === []) { return false; } elseif (count($possibleApps) === 1) { $dir = array_shift($possibleApps); @@ -883,7 +883,7 @@ public static function updateApp(string $appId): bool { * @throws \OC\NeedsUpdateException */ public static function executeRepairSteps(string $appId, array $steps) { - if (empty($steps)) { + if ($steps === []) { return; } // load the app diff --git a/lib/private/legacy/OC_Files.php b/lib/private/legacy/OC_Files.php index 5655139b24a57..1cb7394d67529 100644 --- a/lib/private/legacy/OC_Files.php +++ b/lib/private/legacy/OC_Files.php @@ -82,7 +82,7 @@ private static function sendHeaders($filename, $name, array $rangeArray): void { $fileSize = \OC\Files\Filesystem::filesize($filename); $type = \OC::$server->getMimeTypeDetector()->getSecureMimeType(\OC\Files\Filesystem::getMimeType($filename)); if ($fileSize > -1) { - if (!empty($rangeArray)) { + if ($rangeArray !== []) { http_response_code(206); header('Accept-Ranges: bytes', true); if (count($rangeArray) > 1) { @@ -352,7 +352,7 @@ private static function getSingleFile($view, $dir, $name, $params) { return; } - if (!empty($rangeArray)) { + if ($rangeArray !== []) { try { if (count($rangeArray) == 1) { $view->readfilePart($filename, $rangeArray[0]['from'], $rangeArray[0]['to']); diff --git a/lib/private/legacy/OC_Util.php b/lib/private/legacy/OC_Util.php index a04d154ef8bb8..49be1b9cffce5 100644 --- a/lib/private/legacy/OC_Util.php +++ b/lib/private/legacy/OC_Util.php @@ -526,7 +526,7 @@ public static function checkServer(\OC\SystemConfig $config) { $urlGenerator = \OC::$server->getURLGenerator(); $availableDatabases = $setup->getSupportedDatabases(); - if (empty($availableDatabases)) { + if ($availableDatabases === []) { $errors[] = [ 'error' => $l->t('No database drivers (sqlite, mysql, or postgresql) installed.'), 'hint' => '' //TODO: sane hint diff --git a/lib/public/AppFramework/Http/EmptyContentSecurityPolicy.php b/lib/public/AppFramework/Http/EmptyContentSecurityPolicy.php index 98a42aeabb5e4..b47900851d209 100644 --- a/lib/public/AppFramework/Http/EmptyContentSecurityPolicy.php +++ b/lib/public/AppFramework/Http/EmptyContentSecurityPolicy.php @@ -473,7 +473,7 @@ public function buildPolicy() { $policy .= ';'; } - if (!empty($this->allowedStyleDomains) || $this->inlineStyleAllowed) { + if ($this->allowedStyleDomains !== [] || $this->inlineStyleAllowed) { $policy .= 'style-src '; if (is_array($this->allowedStyleDomains)) { $policy .= implode(' ', $this->allowedStyleDomains); @@ -484,43 +484,43 @@ public function buildPolicy() { $policy .= ';'; } - if (!empty($this->allowedImageDomains)) { + if ($this->allowedImageDomains !== []) { $policy .= 'img-src ' . implode(' ', $this->allowedImageDomains); $policy .= ';'; } - if (!empty($this->allowedFontDomains)) { + if ($this->allowedFontDomains !== []) { $policy .= 'font-src ' . implode(' ', $this->allowedFontDomains); $policy .= ';'; } - if (!empty($this->allowedConnectDomains)) { + if ($this->allowedConnectDomains !== []) { $policy .= 'connect-src ' . implode(' ', $this->allowedConnectDomains); $policy .= ';'; } - if (!empty($this->allowedMediaDomains)) { + if ($this->allowedMediaDomains !== []) { $policy .= 'media-src ' . implode(' ', $this->allowedMediaDomains); $policy .= ';'; } - if (!empty($this->allowedObjectDomains)) { + if ($this->allowedObjectDomains !== []) { $policy .= 'object-src ' . implode(' ', $this->allowedObjectDomains); $policy .= ';'; } - if (!empty($this->allowedFrameDomains)) { + if ($this->allowedFrameDomains !== []) { $policy .= 'frame-src '; $policy .= implode(' ', $this->allowedFrameDomains); $policy .= ';'; } - if (!empty($this->allowedChildSrcDomains)) { + if ($this->allowedChildSrcDomains !== []) { $policy .= 'child-src ' . implode(' ', $this->allowedChildSrcDomains); $policy .= ';'; } - if (!empty($this->allowedFrameAncestors)) { + if ($this->allowedFrameAncestors !== []) { $policy .= 'frame-ancestors ' . implode(' ', $this->allowedFrameAncestors); $policy .= ';'; } else { @@ -537,7 +537,7 @@ public function buildPolicy() { $policy .= ';'; } - if (!empty($this->reportTo)) { + if ($this->reportTo !== []) { $policy .= 'report-uri ' . implode(' ', $this->reportTo); $policy .= ';'; } diff --git a/lib/public/AppFramework/Http/EmptyFeaturePolicy.php b/lib/public/AppFramework/Http/EmptyFeaturePolicy.php index b73eaf667e73f..d9385a9f210c1 100644 --- a/lib/public/AppFramework/Http/EmptyFeaturePolicy.php +++ b/lib/public/AppFramework/Http/EmptyFeaturePolicy.php @@ -135,42 +135,42 @@ public function addAllowedPaymentDomain(string $domain): self { public function buildPolicy(): string { $policy = ''; - if (empty($this->autoplayDomains)) { + if ($this->autoplayDomains === []) { $policy .= "autoplay 'none';"; } else { $policy .= 'autoplay ' . implode(' ', $this->autoplayDomains); $policy .= ';'; } - if (empty($this->cameraDomains)) { + if ($this->cameraDomains === []) { $policy .= "camera 'none';"; } else { $policy .= 'camera ' . implode(' ', $this->cameraDomains); $policy .= ';'; } - if (empty($this->fullscreenDomains)) { + if ($this->fullscreenDomains === []) { $policy .= "fullscreen 'none';"; } else { $policy .= 'fullscreen ' . implode(' ', $this->fullscreenDomains); $policy .= ';'; } - if (empty($this->geolocationDomains)) { + if ($this->geolocationDomains === []) { $policy .= "geolocation 'none';"; } else { $policy .= 'geolocation ' . implode(' ', $this->geolocationDomains); $policy .= ';'; } - if (empty($this->microphoneDomains)) { + if ($this->microphoneDomains === []) { $policy .= "microphone 'none';"; } else { $policy .= 'microphone ' . implode(' ', $this->microphoneDomains); $policy .= ';'; } - if (empty($this->paymentDomains)) { + if ($this->paymentDomains === []) { $policy .= "payment 'none';"; } else { $policy .= 'payment ' . implode(' ', $this->paymentDomains); diff --git a/lib/public/Http/WellKnown/JrdResponse.php b/lib/public/Http/WellKnown/JrdResponse.php index 7a25f8fe0c3c4..2d9ee40c4849f 100644 --- a/lib/public/Http/WellKnown/JrdResponse.php +++ b/lib/public/Http/WellKnown/JrdResponse.php @@ -162,8 +162,8 @@ public function toHttpResponse(): Response { */ public function isEmpty(): bool { return $this->expires === null - && empty($this->aliases) - && empty($this->properties) + && $this->aliases === [] + && $this->properties === [] && empty($this->links); } } diff --git a/lib/public/Search/Provider.php b/lib/public/Search/Provider.php index e709cb402eb00..0767cd320194b 100644 --- a/lib/public/Search/Provider.php +++ b/lib/public/Search/Provider.php @@ -83,7 +83,7 @@ public function getOption($key) { */ public function providesResultsFor(array $apps = []) { $forApps = $this->getOption(self::OPTION_APPS); - return empty($apps) || empty($forApps) || array_intersect($forApps, $apps); + return $apps === [] || empty($forApps) || array_intersect($forApps, $apps); } /**