Skip to content

[12.x] Default $contents as empty string for Filesystem::put() #55562

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

Closed
wants to merge 1 commit into from

Conversation

weshooper
Copy link
Contributor

@weshooper weshooper commented Apr 26, 2025

Non-breaking change, since currently the second parameter must be provided.

When testing file operations, we often don't care about the content, so put() empty strings.

Making that explicit, by not providing content, would also be consistent with the behaviour of assertExists() where content is optional.

-$fs->put('file.foo', '');
-$fs->put('file.bar', '');
+$fs->put('file.foo');
+$fs->put('file.bar');
$fs->assertExists('file.foo');
$fs->assertExists('file.bar');

@weshooper weshooper changed the title Default $contents as empty string for Filesystem::put() [12.x] Default $contents as empty string for Filesystem::put() Apr 26, 2025
@AndrewMast
Copy link
Contributor

I personally think that the file contents should stay explicit. Do we have any default file contents elsewhere in the framework?

@taylorotwell
Copy link
Member

Thanks for your pull request to Laravel!

Unfortunately, I'm going to delay merging this code for now. To preserve our ability to adequately maintain the framework, we need to be very careful regarding the amount of code we include.

If applicable, please consider releasing your code as a package so that the community can still take advantage of your contributions!

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.

3 participants