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] Add dontIncludeSource to CliDumper and HtmlDumper #44623

Merged
merged 2 commits into from
Oct 19, 2022
Merged

[9.x] Add dontIncludeSource to CliDumper and HtmlDumper #44623

merged 2 commits into from
Oct 19, 2022

Conversation

innocenzi
Copy link
Contributor

This pull request adds a preventDumpingSource static method to Illuminate\Foundation\Concerns\ResolvesDumpSource, effectively affecting Illuminate\Foundation\Console\CliDumper and Illuminate\Foundation\Http\HtmlDumper.

When called, this method prevents the dump and dd functions from displaying a comment with the source of the dump.

While the idea is very nice, in practice it has made dumps cumbersome to read and understand for me. Here is an example:

image

The functionality can already be disabled by calling HtmlDumper::resolveDumpSourceUsing(fn () => null), but I didn't found out until I dove into the code. The point of this pull request is to allow preventing the dump resolution in a cleaner and more accessible way:

// Before
HtmlDumper::resolveDumpSourceUsing(fn () => null);
CliDumper::resolveDumpSourceUsing(fn () => null);

// After
HtmlDumper::preventDumpingSource();
CliDumper::preventDumpingSource();

@taylorotwell taylorotwell merged commit 4335c5c into laravel:9.x Oct 19, 2022
@innocenzi innocenzi deleted the feat/prevent-dumping-source branch October 19, 2022 14:28
@innocenzi innocenzi changed the title [9.x] Add preventDumpingSource to CliDumper and HtmlDumper [9.x] Add dontIncludeSource to CliDumper and HtmlDumper Oct 19, 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.

2 participants