Skip to content

Commit 4335c5c

Browse files
[9.x] Add preventDumpingSource to CliDumper and HtmlDumper (#44623)
* feat: prevent dumping source * formatting Co-authored-by: Taylor Otwell <[email protected]>
1 parent 3b26f7a commit 4335c5c

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/Illuminate/Foundation/Concerns/ResolvesDumpSource.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ trait ResolvesDumpSource
3232
/**
3333
* The source resolver.
3434
*
35-
* @var (callable(): (array{0: string, 1: string, 2: int|null}|null))|null
35+
* @var (callable(): (array{0: string, 1: string, 2: int|null}|null))|null|false
3636
*/
3737
protected static $dumpSourceResolver;
3838

@@ -43,6 +43,10 @@ trait ResolvesDumpSource
4343
*/
4444
public function resolveDumpSource()
4545
{
46+
if (static::$dumpSourceResolver === false) {
47+
return null;
48+
}
49+
4650
if (static::$dumpSourceResolver) {
4751
return call_user_func(static::$dumpSourceResolver);
4852
}
@@ -161,4 +165,14 @@ public static function resolveDumpSourceUsing($callable)
161165
{
162166
static::$dumpSourceResolver = $callable;
163167
}
168+
169+
/**
170+
* Don't include the location / file of the dump in dumps.
171+
*
172+
* @return void
173+
*/
174+
public static function dontIncludeSource()
175+
{
176+
static::$dumpSourceResolver = false;
177+
}
164178
}

0 commit comments

Comments
 (0)