Skip to content

Commit

Permalink
DomPlugin: Add PHP 8.5 special case handling
Browse files Browse the repository at this point in the history
  • Loading branch information
jnvsor committed Jan 1, 2025
1 parent 2fb169b commit d99eb89
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
Binary file modified build/kint.phar
Binary file not shown.
1 change: 1 addition & 0 deletions init.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
\define('KINT_PHP82', \version_compare(PHP_VERSION, '8.2') >= 0);
\define('KINT_PHP83', \version_compare(PHP_VERSION, '8.3') >= 0);
\define('KINT_PHP84', \version_compare(PHP_VERSION, '8.4') >= 0);
\define('KINT_PHP85', \version_compare(PHP_VERSION, '8.5') >= 0);

// Dynamic default settings
if (\strlen((string) \ini_get('xdebug.file_link_format')) > 0) {
Expand Down
15 changes: 15 additions & 0 deletions src/Parser/DomPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,14 @@ class DomPlugin extends AbstractPlugin implements PluginBeginInterface
'previousElementSibling' => true,
'nextElementSibling' => true,
'innerHTML' => false,
'outerHTML' => false,
'substitutedNodeValue' => false,
];

public const DOM_NS_VERSIONS = [
'outerHTML' => KINT_PHP85,
];

/**
* @psalm-var non-empty-array<string, bool> Property names to readable status
*/
Expand Down Expand Up @@ -458,6 +463,16 @@ public static function getKnownProperties(object $var): array
if ($var instanceof Attr || $var instanceof CharacterData) {
$known_properties['nodeValue'] = false;
}

foreach (self::DOM_NS_VERSIONS as $key => $val) {
/**
* @psalm-var bool $val
* Psalm bug #4509
*/
if (false === $val) {
unset($known_properties[$key]); // @codeCoverageIgnore
}
}
} else {
$known_properties = self::DOMNODE_PROPS;
if ($var instanceof DOMElement) {
Expand Down

0 comments on commit d99eb89

Please sign in to comment.