- Output for 8.4.1 - 8.4.12
- Output for 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.25
- string(8) "DateTime" string(5) "false"
<?php
foreach ((new ReflectionClass('\DateTime'))->getMethods() as $method) {
if ($method->getName() == 'modify') {
$returnType = $method->getTentativeReturnType();
if ($returnType instanceof ReflectionUnionType) {
foreach ($returnType->getTypes() as $type) {
var_dump($type->getName());
}
}
}
}