diff --git a/lib/private/Archive/TAR.php b/lib/private/Archive/TAR.php index 9dc906384e0fb..a6140e44eb629 100644 --- a/lib/private/Archive/TAR.php +++ b/lib/private/Archive/TAR.php @@ -197,7 +197,7 @@ public function getFolder(string $path): array { if ($pos = strpos($result, '/')) { $result = substr($result, 0, $pos + 1); } - if (array_search($result, $folderContent) === false) { + if (!in_array($result, $folderContent)) { $folderContent[] = $result; } } @@ -269,7 +269,7 @@ public function extract(string $dest): bool { */ public function fileExists(string $path): bool { $files = $this->getFiles(); - if ((array_search($path, $files) !== false) or (array_search($path . '/', $files) !== false)) { + if ((in_array($path, $files)) or (in_array($path . '/', $files))) { return true; } else { $folderPath = rtrim($path, '/') . '/'; diff --git a/lib/private/Command/AsyncBus.php b/lib/private/Command/AsyncBus.php index ec6fbc91f68a2..c65e6cad78e56 100644 --- a/lib/private/Command/AsyncBus.php +++ b/lib/private/Command/AsyncBus.php @@ -82,7 +82,7 @@ private function runCommand($command) { private function canRunAsync($command) { $traits = $this->getTraits($command); foreach ($traits as $trait) { - if (array_search($trait, $this->syncTraits) !== false) { + if (in_array($trait, $this->syncTraits)) { return false; } } diff --git a/lib/private/Files/Cache/Cache.php b/lib/private/Files/Cache/Cache.php index 27db4dfe8099a..46228af565b15 100644 --- a/lib/private/Files/Cache/Cache.php +++ b/lib/private/Files/Cache/Cache.php @@ -454,7 +454,7 @@ protected function normalizeData(array $data): array { $params = []; $extensionParams = []; foreach ($data as $name => $value) { - if (array_search($name, $fields) !== false) { + if (in_array($name, $fields)) { if ($name === 'path') { $params['path_hash'] = md5($value); } elseif ($name === 'mimetype') { @@ -474,7 +474,7 @@ protected function normalizeData(array $data): array { } $params[$name] = $value; } - if (array_search($name, $extensionFields) !== false) { + if (in_array($name, $extensionFields)) { $extensionParams[$name] = $value; } } diff --git a/lib/private/Files/Cache/Watcher.php b/lib/private/Files/Cache/Watcher.php index acc76f263dc57..61ea5b2f848d4 100644 --- a/lib/private/Files/Cache/Watcher.php +++ b/lib/private/Files/Cache/Watcher.php @@ -129,7 +129,7 @@ public function update($path, $cachedData) { * @return bool */ public function needsUpdate($path, $cachedData) { - if ($this->watchPolicy === self::CHECK_ALWAYS or ($this->watchPolicy === self::CHECK_ONCE and array_search($path, $this->checkedPaths) === false)) { + if ($this->watchPolicy === self::CHECK_ALWAYS or ($this->watchPolicy === self::CHECK_ONCE and !in_array($path, $this->checkedPaths))) { $this->checkedPaths[] = $path; return $this->storage->hasUpdated($path, $cachedData['storage_mtime']); } diff --git a/lib/private/Group/Manager.php b/lib/private/Group/Manager.php index 47475121ea0cf..da99187f130e9 100644 --- a/lib/private/Group/Manager.php +++ b/lib/private/Group/Manager.php @@ -371,7 +371,7 @@ public function isAdmin($userId) { * @return bool if in group */ public function isInGroup($userId, $group) { - return array_search($group, $this->getUserIdGroupIds($userId)) !== false; + return in_array($group, $this->getUserIdGroupIds($userId)); } /** diff --git a/lib/private/Hooks/EmitterTrait.php b/lib/private/Hooks/EmitterTrait.php index da4e3da2bd659..fe9cba893de31 100644 --- a/lib/private/Hooks/EmitterTrait.php +++ b/lib/private/Hooks/EmitterTrait.php @@ -43,7 +43,7 @@ public function listen($scope, $method, callable $callback) { if (!isset($this->listeners[$eventName])) { $this->listeners[$eventName] = []; } - if (array_search($callback, $this->listeners[$eventName], true) === false) { + if (!in_array($callback, $this->listeners[$eventName], true)) { $this->listeners[$eventName][] = $callback; } } diff --git a/lib/private/legacy/OC_App.php b/lib/private/legacy/OC_App.php index 23e0b099e9112..579c38b2d7c98 100644 --- a/lib/private/legacy/OC_App.php +++ b/lib/private/legacy/OC_App.php @@ -564,7 +564,7 @@ public function listAllApps(): array { $supportedApps = $this->getSupportedApps(); foreach ($installedApps as $app) { - if (array_search($app, $blacklist) === false) { + if (!in_array($app, $blacklist)) { $info = $appManager->getAppInfo($app, false, $langCode); if (!is_array($info)) { \OCP\Server::get(LoggerInterface::class)->error('Could not read app info file for app "' . $app . '"', ['app' => 'core']); diff --git a/lib/private/legacy/OC_User.php b/lib/private/legacy/OC_User.php index 5751b813f2cc5..d2dc2a2389f7c 100644 --- a/lib/private/legacy/OC_User.php +++ b/lib/private/legacy/OC_User.php @@ -138,7 +138,7 @@ public static function setupBackends() { $class = $config['class']; $arguments = $config['arguments']; if (class_exists($class)) { - if (array_search($i, self::$_setupedBackends) === false) { + if (!in_array($i, self::$_setupedBackends)) { // make a reflection object $reflectionObj = new ReflectionClass($class);