<?php
class A
{
private function do_something (bool $str) {
echo "private function";
}
public function call_something(A $obj) {
//call_user_func([$obj, 'do_something'], true);
$obj->do_something(true);
}
}
class B extends A {
public function do_something (string $value) {
echo "subclass";
}
}
class C extends B {
private function do_something (string $value) {
echo "subclass";
}
}
$a = new A();
$c = new C();
$c->call_something($a);
Fatal error: Access level to C::do_something() must be public (as in class B) in /in/UPRZC on line 25
Process exited with code 255.
Output for 7.0.20
private function
Output for 7.0.0 - 7.0.6
Warning: Declaration of B::do_something(string $value) should be compatible with A::do_something(bool $str) in /in/UPRZC on line 19
private function
Output for 5.6.28
Catchable fatal error: Argument 1 passed to A::do_something() must be an instance of bool, boolean given, called in /in/UPRZC on line 11 and defined in /in/UPRZC on line 5
Process exited with code 255.
Output for 5.5.24 - 5.5.35, 5.6.8 - 5.6.21
Strict Standards: Declaration of B::do_something() should be compatible with A::do_something(bool $str) in /in/UPRZC on line 19
Catchable fatal error: Argument 1 passed to A::do_something() must be an instance of bool, boolean given, called in /in/UPRZC on line 11 and defined in /in/UPRZC on line 5
Process exited with code 255.