Skip to content

Commit 2bd133b

Browse files
committed
DomPlugin: Add outerHTML for PHP 8.5
1 parent 2fb169b commit 2bd133b

4 files changed

Lines changed: 20 additions & 0 deletions

File tree

build/kint.phar

499 Bytes
Binary file not shown.

init.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
\define('KINT_PHP82', \version_compare(PHP_VERSION, '8.2') >= 0);
4545
\define('KINT_PHP83', \version_compare(PHP_VERSION, '8.3') >= 0);
4646
\define('KINT_PHP84', \version_compare(PHP_VERSION, '8.4') >= 0);
47+
\define('KINT_PHP85', \version_compare(PHP_VERSION, '8.5') >= 0);
4748

4849
// Dynamic default settings
4950
if (\strlen((string) \ini_get('xdebug.file_link_format')) > 0) {

src/Parser/DomPlugin.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,14 @@ class DomPlugin extends AbstractPlugin implements PluginBeginInterface
102102
'previousElementSibling' => true,
103103
'nextElementSibling' => true,
104104
'innerHTML' => false,
105+
'outerHTML' => false,
105106
'substitutedNodeValue' => false,
106107
];
107108

109+
public const DOM_NS_VERSIONS = [
110+
'outerHTML' => KINT_PHP85,
111+
];
112+
108113
/**
109114
* @psalm-var non-empty-array<string, bool> Property names to readable status
110115
*/
@@ -458,6 +463,16 @@ public static function getKnownProperties(object $var): array
458463
if ($var instanceof Attr || $var instanceof CharacterData) {
459464
$known_properties['nodeValue'] = false;
460465
}
466+
467+
foreach (self::DOM_NS_VERSIONS as $key => $val) {
468+
/**
469+
* @psalm-var bool $val
470+
* Psalm bug #4509
471+
*/
472+
if (false === $val) {
473+
unset($known_properties[$key]); // @codeCoverageIgnore
474+
}
475+
}
461476
} else {
462477
$known_properties = self::DOMNODE_PROPS;
463478
if ($var instanceof DOMElement) {

tests/Parser/DomPluginTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,6 +1126,10 @@ private function getExpectedPropsCount(bool $old)
11261126
'NODE_PROPS' => 14,
11271127
'ELEMENT_PROPS' => 15,
11281128
];
1129+
1130+
if (KINT_PHP85) {
1131+
++$expected_props['ELEMENT_PROPS'];
1132+
}
11291133
}
11301134

11311135
$expected_props['ELEMENT_PROPS'] += $expected_props['NODE_PROPS'];

0 commit comments

Comments
 (0)