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

[6.x] Add a more readable "missing" method to Filesystem and FilesystemAdapter #30441

Merged
merged 4 commits into from Oct 27, 2019

Conversation

@AmirrezaNasiri
Copy link
Contributor

AmirrezaNasiri commented Oct 27, 2019

This PR adds a new missing() method to both Illuminate\Filesystem\Filesystem and of course Illuminate\Filesystem\FilesystemAdapter so we can check missing files or directories in a more readable way.

In other word, instead of following condition checkings:

if (!Storage::exists('file.txt')) {
   // ...
}

if (!File::exists('file.txt')) {
   // ...
}

We can do:

if (Storage::missing('file.txt')) {
   // ...
}

if (File::missing('file.txt')) {
   // ...
}

There is no much logic behind the methods and I think they don't add maintenance overload.

AmirrezaNasiri and others added 4 commits Oct 27, 2019
@taylorotwell taylorotwell merged commit 69f9fa4 into laravel:6.x Oct 27, 2019
1 check passed
1 check passed
continuous-integration/styleci/pr The analysis has passed
Details
baijunyao added a commit to baijunyao/laravel-bjyblog that referenced this pull request Nov 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.