Skip to content

Commit

Permalink
feat: avoid throwing exceptions in iterator and toString Kint plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Neundorfer committed Sep 20, 2023
1 parent 2938f36 commit c8882df
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
22 changes: 22 additions & 0 deletions Classes/Plugins/FailsafeIteratorPlugin.php
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;
}
}
}
22 changes: 22 additions & 0 deletions Classes/Plugins/FailsafeToStringPlugin.php
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;
}
}

}

0 comments on commit c8882df

Please sign in to comment.