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

[5.8] Use Null coalescing operator to refactor #27955

Merged
merged 1 commit into from
Mar 21, 2019
Merged
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
Use Null coalescing operator to refactor
  • Loading branch information
richardkeep authored Mar 21, 2019
commit 7a7cacc3fd02d7d4c596c1a0f8af3c5b7a2990b4
4 changes: 1 addition & 3 deletions src/Illuminate/Http/Concerns/InteractsWithInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,7 @@ public function allFiles()
{
$files = $this->files->all();

return $this->convertedFiles
? $this->convertedFiles
: $this->convertedFiles = $this->convertUploadedFiles($files);
return $this->convertedFiles = $this->convertedFiles ?? $this->convertUploadedFiles($files);
Copy link
Contributor

Choose a reason for hiding this comment

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

Could this not be shortened further to just return $this->convertedFiles ?? $this->convertUploadedFiles($files);?

Copy link
Contributor Author

@richardkeep richardkeep Mar 22, 2019

Choose a reason for hiding this comment

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

No, we also want to set the value for $this->convertUploadedFiles($files) to $this->convertedFiles if it is falsy before returning.

Copy link
Contributor

Choose a reason for hiding this comment

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

@richardkeep Gotcha 🙂

}

/**
Expand Down