From 46c22f618f7104888b0e8de22aeadd37f9c902db Mon Sep 17 00:00:00 2001 From: Jonathan Vollebregt Date: Sat, 14 Sep 2024 21:41:59 +0200 Subject: [PATCH] ToString: Ignore SplFileInfo too Just results in repeated SplFileInfoRepresentation dumps --- build/kint.phar | Bin 507222 -> 507218 bytes src/Parser/ToStringPlugin.php | 4 ++-- tests/Parser/ToStringPluginTest.php | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/build/kint.phar b/build/kint.phar index 2d91171f4f2f454001ec72faf6c359e02980cca7..331529a9f376b92b1f53867ff2ffc48c3466c277 100644 GIT binary patch delta 177 zcmcciOYYJyxeZqQ0v|XT7#jBJ$bjhfl>%nXUi|G|{ER@%1jNkSz4%#z_*gvi((}t>+xj%jqoX6 zM=kYS)b_}6_&M1 V?v6L+y2~X0nuURZ!QIK%2>|@iPK36A&|R_u^*>;+y{PACvg> zjj}9l+xr-q`5C7lHDXe3PnTx_Vpbq#+nz4ZzId)jiG%rtu*1D&*EVZtcg5Gdo^x_O z!@KqUrA}Jfy@BWZCVFTThX_8F&vmXe+~8jDXVG!d+!_B=T1Efqe&Z=qI`Er?fq}u@ H$=3-0tuZ~5 diff --git a/src/Parser/ToStringPlugin.php b/src/Parser/ToStringPlugin.php index 3a51a530c..08ca9173d 100644 --- a/src/Parser/ToStringPlugin.php +++ b/src/Parser/ToStringPlugin.php @@ -31,14 +31,14 @@ use Kint\Zval\Value; use ReflectionClass; use SimpleXMLElement; -use SplFileObject; +use SplFileInfo; use Throwable; class ToStringPlugin extends AbstractPlugin { public static array $blacklist = [ SimpleXMLElement::class, - SplFileObject::class, + SplFileInfo::class, ]; public function getTypes(): array diff --git a/tests/Parser/ToStringPluginTest.php b/tests/Parser/ToStringPluginTest.php index 52b501197..a789bb3e5 100644 --- a/tests/Parser/ToStringPluginTest.php +++ b/tests/Parser/ToStringPluginTest.php @@ -27,13 +27,13 @@ namespace Kint\Test\Parser; +use Exception; use Kint\Parser\Parser; use Kint\Parser\ToStringPlugin; use Kint\Test\Fixtures\BadToStringClass; use Kint\Test\KintTestCase; use Kint\Zval\BlobValue; use Kint\Zval\Value; -use SplFileInfo; use stdClass; /** @@ -71,14 +71,14 @@ public function testParse() $b = new Value('$v'); $b->access_path = '$v'; - $v = new SplFileInfo(__FILE__); + $v = new Exception('There was an error'); $obj = $p->parse($v, clone $b); $rep = $obj->getRepresentation('tostring'); $this->assertNotNull($rep); $this->assertInstanceOf(BlobValue::class, $rep->contents); - $this->assertSame(__FILE__, $rep->contents->value->contents); + $this->assertSame((string) $v, $rep->contents->value->contents); $this->assertSame('(string) $v', $rep->contents->access_path); $b->access_path = null; @@ -129,13 +129,13 @@ public function testParseBlacklist() $p->addPlugin(new ToStringPlugin($p)); $b = new Value('$v'); - $v = new SplFileInfo(__FILE__); + $v = new Exception('There was an error'); $obj = $p->parse($v, clone $b); $this->assertNotNull($obj->getRepresentation('tostring')); - ToStringPlugin::$blacklist[] = SplFileInfo::class; + ToStringPlugin::$blacklist[] = Exception::class; $obj = $p->parse($v, clone $b);