psalm icon indicating copy to clipboard operation
psalm copied to clipboard

`Dom\XMLDocument` is unimplemented

Open jnvsor opened this issue 1 year ago • 2 comments

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.

jnvsor avatar Aug 21 '24 13:08 jnvsor

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

psalm-github-bot[bot] avatar Aug 21 '24 13:08 psalm-github-bot[bot]

PHP 8.4 is not out yet either.

weirdan avatar Sep 07 '24 18:09 weirdan

It now is.

distantnative avatar Nov 22 '24 07:11 distantnative

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

jnvsor avatar Apr 13 '25 16:04 jnvsor