psalm
psalm copied to clipboard
`Dom\XMLDocument` is unimplemented
https://psalm.dev/r/fd6cc59c7d
Dom\XMLDocument is no longer an alias of DOMDocument per https://wiki.php.net/rfc/opt_in_dom_spec_compliance
I propose the following BC solution. The HTML 5 RFC added class aliases such as DOMNode -> DOM\Node etc. I propose to make them real classes instead of aliases.
I found these snippets:
https://psalm.dev/r/fd6cc59c7d
<?php
$x = Dom\XMLDocument::createFromString('<?xml>');
$h = Dom\HTMLDocument::createFromString('<!DOCTYPE html>');
Psalm output (using commit 16b24bd):
ERROR: UndefinedClass - 3:6 - Class, interface or enum named Dom\XMLDocument does not exist
PHP 8.4 is not out yet either.
It now is.
No stubs needed when run on 8.4 as reflection handles it, but it's a bit counterintuitive since psalm.dev is 2 versions behind