Skip to content

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
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
@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
@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.

8 participants