Open
Description
Description
The following code:
<?php
declare(strict_types=1);
enum IntBacked: int {
case One = 1;
}
$rm = new ReflectionMethod(IntBacked::class, 'tryFrom');
var_export((string) $rm->getParameters()[0]->getType());
Resulted in this output:
'string|int'
But I expected this output instead:
'int'
Because when a bad type is passed in there, it's rejected with TypeError:
Argument #1 ($value) must be of type int, string given
Related: #12863
PHP Version
PHP 8.1+
Operating System
No response