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

[9.x] Adds isEqual to compare file hashes in filesystem #41586

Merged
merged 4 commits into from
Mar 21, 2022
Merged

[9.x] Adds isEqual to compare file hashes in filesystem #41586

merged 4 commits into from
Mar 21, 2022

Conversation

DarkGhostHunter
Copy link
Contributor

What?

Allows to compare two files if these exists and their hashes are the same.

use Illuminate\Support\Facades\File;

if (File::isEqual('foo.txt', 'bar.txt')) {
   return 'Both files are equal.'
}

It will always return false if one of the compared files doesn't exist.

Why?

Useful to check if a file copied was later edited without using exists() and hash() damn every time.

BC?

Is not expected the developer to have a macro of the same name for different functionality.

@driesvints driesvints changed the title [9.x] Adds isEqual to compare file hashes in filesystem. [9.x] Adds isEqual to compare file hashes in filesystem Mar 21, 2022
@taylorotwell taylorotwell merged commit 89e43ae into laravel:9.x Mar 21, 2022
@DarkGhostHunter DarkGhostHunter deleted the feat/file_equal_to branch March 21, 2022 17:23
crynobone added a commit to crynobone/framework that referenced this pull request Mar 22, 2022
taylorotwell pushed a commit to illuminate/support that referenced this pull request Mar 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants