<?php
class B {
function __toString() {
echo (string)__CLASS__;
}
}
class A extends B {
function __toString() {
echo (string)__CLASS__;
}
}
echo new B();
echo new A();
B
Fatal error: Uncaught TypeError: B::__toString(): Return value must be of type string, none returned in /in/quJAA:5
Stack trace:
#0 /in/quJAA(13): B->__toString()
#1 {main}
thrown in /in/quJAA on line 5
Process exited with code 255.
Output for 7.4.0 - 7.4.33
B
Fatal error: Uncaught Error: Method B::__toString() must return a string value in /in/quJAA:13
Stack trace:
#0 {main}
thrown in /in/quJAA on line 13
Process exited with code 255.