Skip to content

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

Merged
taylorotwell merged 2 commits into
laravel:9.xfrom
innocenzi:feat/prevent-dumping-source
Oct 19, 2022
Merged

[9.x] Add dontIncludeSource to CliDumper and HtmlDumper#44623
taylorotwell merged 2 commits into
laravel:9.xfrom
innocenzi:feat/prevent-dumping-source

Conversation

@innocenzi
Copy link
Copy Markdown
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