<?php
class B {
function __toString() {
echo __CLASS__;
}
}
class A extends B {
function __toString() {
echo __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/TV8RZ:5
Stack trace:
#0 /in/TV8RZ(13): B->__toString()
#1 {main}
thrown in /in/TV8RZ 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/TV8RZ:13
Stack trace:
#0 {main}
thrown in /in/TV8RZ on line 13
Process exited with code 255.