Repository navigation
Adjust 'if' conditionals that were reported by phpstan - #462
Merged
Merged
Conversation
phil-davis
commented
Mar 17, 2022
| */ | ||
| private function getFileHandle($fileId, $owner, $editor) { | ||
| if ($editor && $editor != '') { | ||
| if ($editor) { |
Contributor
Author
There was a problem hiding this comment.
If $editor is the empty string, then $editor will evaluate to false in the first condition, so the 2nd condition adds no value.
phil-davis
commented
Mar 17, 2022
| /** @var \OCP\Files\Node|null $document */ | ||
| $document = $node; | ||
| } elseif ($node->getType() == FileInfo::TYPE_FOLDER && $fileId !== null) { | ||
| } elseif ($fileId !== null) { |
Contributor
Author
There was a problem hiding this comment.
At this point we know that the resource type is not TYPE_FILE. getType can only return 2 values, so we know that $node must be of type TYPE_FOLDER. Therefore that check is removed.
phil-davis
requested review from
AlexAndBear,
JammingBen,
jvillafanez and
mrow4a
March 17, 2022 04:55
Closed
|
Kudos, SonarCloud Quality Gate passed! |
jvillafanez
approved these changes
Mar 17, 2022
8 of 42 tasks
31 of 42 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.








Fixes issue #460 and gets CI green again.