Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Replace array_search with in_array in lib/ #40462

Merged
merged 1 commit into from
Nov 22, 2023

Conversation

ChristophWurst
Copy link
Member

Summary

in_array returns bool, therefore the syntax is more compact than the comparison with false for array_search.

Checklist

@ChristophWurst
Copy link
Member Author

CI failure is unrelated as far as I can tell

@ChristophWurst ChristophWurst added 4. to release Ready to be released and/or waiting for tests to finish and removed 3. to review Waiting for reviews labels Sep 18, 2023
@@ -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 👍

@nickvergessen
Copy link
Member

Failing samba tests could be related to touching lib/private/Files/ ?

@solracsf solracsf added this to the Nextcloud 28 milestone Nov 21, 2023
@blizzz blizzz mentioned this pull request Nov 22, 2023
5 tasks
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
@blizzz blizzz force-pushed the refactor/lib-array_search-to-in_array branch from 4fd113a to ea8f9a7 Compare November 22, 2023 10:42
@AndyScherzinger AndyScherzinger merged commit 42724c1 into master Nov 22, 2023
50 checks passed
@AndyScherzinger AndyScherzinger deleted the refactor/lib-array_search-to-in_array branch November 22, 2023 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4. to release Ready to be released and/or waiting for tests to finish
Projects
Development

Successfully merging this pull request may close these issues.

7 participants