diff --git a/build/kint.phar b/build/kint.phar index dd651f7cd..4ee8a7d0f 100644 Binary files a/build/kint.phar and b/build/kint.phar differ diff --git a/src/Parser/ClassStaticsPlugin.php b/src/Parser/ClassStaticsPlugin.php index 8a18a00ae..0b5e616fc 100644 --- a/src/Parser/ClassStaticsPlugin.php +++ b/src/Parser/ClassStaticsPlugin.php @@ -136,7 +136,9 @@ private function buildStaticValue(ReflectionProperty $pr, int $depth): AbstractV $context->access_path = '\\'.$context->owner_class.'::$'.$context->name; } - $pr->setAccessible(true); + if (KINT_PHP81 === false) { + $pr->setAccessible(true); + } /** * @psalm-suppress TooFewArguments diff --git a/src/Parser/Parser.php b/src/Parser/Parser.php index 8548e4682..771e50e16 100644 --- a/src/Parser/Parser.php +++ b/src/Parser/Parser.php @@ -401,7 +401,10 @@ private function parseObject(object &$var, ContextInterface $c): AbstractValue $properties = []; foreach ($props as $rprop) { - $rprop->setAccessible(true); + if (KINT_PHP81 === false) { + $rprop->setAccessible(true); + } + $name = $rprop->getName(); // Casting object to array: diff --git a/tests/Parser/ClassStringsPluginTest.php b/tests/Parser/ClassStringsPluginTest.php index 53420684c..5ca992351 100644 --- a/tests/Parser/ClassStringsPluginTest.php +++ b/tests/Parser/ClassStringsPluginTest.php @@ -54,17 +54,28 @@ public function testConstruct() $reflector = new ReflectionClass($d); $mprop = $reflector->getProperty('methods_plugin'); - $mprop->setAccessible(true); + + if (KINT_PHP81 === false) { + $mprop->setAccessible(true); + } + $m = $mprop->getValue($d); $this->assertInstanceOf(ClassMethodsPlugin::class, $m); $sprop = $reflector->getProperty('statics_plugin'); - $sprop->setAccessible(true); + + if (KINT_PHP81 === false) { + $sprop->setAccessible(true); + } + $s = $sprop->getValue($d); $this->assertInstanceOf(ClassStaticsPlugin::class, $s); $reflector = new ReflectionClass(AbstractPlugin::class); $aparser = $reflector->getProperty('parser'); - $aparser->setAccessible(true); + + if (KINT_PHP81 === false) { + $aparser->setAccessible(true); + } $p = new Parser(); $this->assertNotSame($p, $aparser->getValue($m)); diff --git a/tests/Parser/DomPluginTest.php b/tests/Parser/DomPluginTest.php index 72b705a7c..5bd3d8c4a 100644 --- a/tests/Parser/DomPluginTest.php +++ b/tests/Parser/DomPluginTest.php @@ -115,17 +115,28 @@ public function testConstruct() $reflector = new ReflectionClass($d); $mprop = $reflector->getProperty('methods_plugin'); - $mprop->setAccessible(true); + + if (KINT_PHP81 === false) { + $mprop->setAccessible(true); + } + $m = $mprop->getValue($d); $this->assertInstanceOf(ClassMethodsPlugin::class, $m); $sprop = $reflector->getProperty('statics_plugin'); - $sprop->setAccessible(true); + + if (KINT_PHP81 === false) { + $sprop->setAccessible(true); + } + $s = $sprop->getValue($d); $this->assertInstanceOf(ClassStaticsPlugin::class, $s); $reflector = new ReflectionClass(AbstractPlugin::class); $aparser = $reflector->getProperty('parser'); - $aparser->setAccessible(true); + + if (KINT_PHP81 === false) { + $aparser->setAccessible(true); + } $p = new Parser(); $this->assertNotSame($p, $aparser->getValue($m)); diff --git a/tests/Parser/SimpleXMLElementPluginTest.php b/tests/Parser/SimpleXMLElementPluginTest.php index c0a15ed6e..8551ba51c 100644 --- a/tests/Parser/SimpleXMLElementPluginTest.php +++ b/tests/Parser/SimpleXMLElementPluginTest.php @@ -87,13 +87,20 @@ public function testConstruct() $reflector = new ReflectionClass($s); $mprop = $reflector->getProperty('methods_plugin'); - $mprop->setAccessible(true); + + if (KINT_PHP81 === false) { + $mprop->setAccessible(true); + } + $m = $mprop->getValue($s); $this->assertInstanceOf(ClassMethodsPlugin::class, $m); $reflector = new ReflectionClass(AbstractPlugin::class); $mparser = $reflector->getProperty('parser'); - $mparser->setAccessible(true); + + if (KINT_PHP81 === false) { + $mparser->setAccessible(true); + } $p = new Parser(); $this->assertNotSame($p, $mparser->getValue($m));