File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -49,8 +49,11 @@ public function register()
4949 'source ' => new SourceContextProvider ('utf-8 ' , base_path ()),
5050 ]);
5151
52- VarDumper::setHandler (function ($ var ) use ($ connection ) {
53- (new Dumper ($ connection ))->dump ($ var );
52+ $ this ->app ->when (Dumper::class)->needs ('$connection ' )->give ($ connection );
53+ $ app = $ this ->app ;
54+
55+ VarDumper::setHandler (function ($ var ) use ($ app ) {
56+ $ app ->make (Dumper::class)->dump ($ var );
5457 });
5558 }
5659}
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ public function __construct(Connection $connection = null)
3636 public function dump ($ value )
3737 {
3838 if (class_exists (CliDumper::class)) {
39- $ data = ( new VarCloner )->cloneVar ($ value );
39+ $ data = $ this -> createVarCloner ( )->cloneVar ($ value );
4040
4141 if ($ this ->connection === null || $ this ->connection ->write ($ data ) === false ) {
4242 $ dumper = in_array (PHP_SAPI , ['cli ' , 'phpdbg ' ]) ? new CliDumper : new HtmlDumper ;
@@ -46,4 +46,12 @@ public function dump($value)
4646 var_dump ($ value );
4747 }
4848 }
49+
50+ /**
51+ * @return VarCloner
52+ */
53+ protected function createVarCloner (): VarCloner
54+ {
55+ return new VarCloner ();
56+ }
4957}
You can’t perform that action at this time.
0 commit comments