Closed as not planned
Description
Description
DOM methods do not provide a return type when inspected via ReflectionMethod
. I'm not sure whether it's by design, an oversight, or a bug. The DOM stub has return type annotations but no actual return type. As far as I can tell, DOM properties can be inspected normally too.
The following code:
<?php declare(strict_types=1);
$class = new ReflectionClass('DOMDocument');
$method = $class->getMethod('createElement');
$property = $class->getProperty('documentElement');
var_dump(
phpversion(),
$method->getReturnType(),
$method->getTentativeReturnType(),
$property->getType()->getName()
);
Resulted in this output:
string(8) "8.3.0RC4"
NULL
NULL
string(10) "DOMElement"
But I expected this output instead:
string(8) "8.3.0RC4"
object(ReflectionNamedType)
NULL
string(10) "DOMElement"
PHP Version
8.1.24, 8.2.11, 8.3.0RC4
Operating System
No response