<?php
class X {
}
class Y extends X {
}
class Blah {
public function blah(X $x) {
$this->bleh($x);
}
public function bleh(Y $x) {
echo "Hello\n";
}
}
$x = new Y;
$b = new Blah;
$b->blah($x);
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Blah has a deprecated constructor in /in/aFqCg on line 8
Fatal error: Uncaught ArgumentCountError: Too few arguments to function Blah::blah(), 0 passed in /in/aFqCg on line 19 and exactly 1 expected in /in/aFqCg:9
Stack trace:
#0 /in/aFqCg(19): Blah->blah()
#1 {main}
thrown in /in/aFqCg on line 9
Process exited with code 255.
Output for 7.3.32 - 7.3.33
Fatal error: Uncaught ArgumentCountError: Too few arguments to function Blah::blah(), 0 passed in /in/aFqCg on line 19 and exactly 1 expected in /in/aFqCg:9
Stack trace:
#0 /in/aFqCg(19): Blah->blah()
#1 {main}
thrown in /in/aFqCg on line 9
Process exited with code 255.
Output for 7.0.0 - 7.0.31
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Blah has a deprecated constructor in /in/aFqCg on line 8
Fatal error: Uncaught TypeError: Argument 1 passed to Blah::blah() must be an instance of X, none given, called in /in/aFqCg on line 19 and defined in /in/aFqCg:9
Stack trace:
#0 /in/aFqCg(19): Blah->blah()
#1 {main}
thrown in /in/aFqCg on line 9
Process exited with code 255.
Catchable fatal error: Argument 1 passed to Blah::blah() must be an instance of X, none given, called in /in/aFqCg on line 19 and defined in /in/aFqCg on line 9
Process exited with code 255.