-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: avoid throwing exceptions in iterator and toString Kint plugins
- Loading branch information
Martin Neundorfer
committed
Sep 20, 2023
1 parent
2938f36
commit c8882df
Showing
2 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
|
||
namespace Neunerlei\Dbg\Plugins; | ||
|
||
|
||
use Kint\Object\BasicObject; | ||
use Kint\Parser\IteratorPlugin; | ||
use Kint\Zval\Value; | ||
|
||
class FailsafeIteratorPlugin extends IteratorPlugin | ||
{ | ||
public function parse(&$var, Value &$o, int $trigger): void | ||
{ | ||
try { | ||
parent::parse($var, $o, $trigger); | ||
} catch (\Throwable $e){ | ||
return; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
|
||
namespace Neunerlei\Dbg\Plugins; | ||
|
||
|
||
use Kint\Parser\ToStringPlugin; | ||
use Kint\Zval\Value; | ||
|
||
class FailsafeToStringPlugin extends ToStringPlugin | ||
{ | ||
public function parse(&$var, Value &$o, int $trigger): void | ||
{ | ||
try { | ||
parent::parse($var, $o, $trigger); | ||
} catch (\Throwable $e){ | ||
return; | ||
} | ||
} | ||
|
||
} |