<?php
class My extends ReflectionMethod
{
public $name = 'test';
public $className;
}
$ref = new My(My::class, 'getDeclaringClass');
$ref->className = new stdClass;
echo $ref->name, get_class($ref->class);
Fatal error: Type of My::$name must be string (as in class ReflectionFunctionAbstract) in /in/huWb7 on line 3
Process exited with code 255.
Output for 8.0.0 - 8.0.30
getDeclaringClass
Fatal error: Uncaught TypeError: get_class(): Argument #1 ($object) must be of type object, string given in /in/huWb7:13
Stack trace:
#0 {main}
thrown in /in/huWb7 on line 13
Process exited with code 255.