Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/private/Archive/TAR.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -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))) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if ((in_array($path, $files)) or (in_array($path . '/', $files))) {
if (in_array($path, $files) || in_array($path . '/', $files)) {

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can address that syntax in another PR 👍

return true;
} else {
$folderPath = rtrim($path, '/') . '/';
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Command/AsyncBus.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
4 changes: 2 additions & 2 deletions lib/private/Files/Cache/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand All @@ -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;
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Files/Cache/Watcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Group/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Hooks/EmitterTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/private/legacy/OC_App.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
Expand Down
2 changes: 1 addition & 1 deletion lib/private/legacy/OC_User.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down