<?php
class Base {
public function __construct() {
$this->get(new StdClass);
}
private function get(StdClass $foo) {
var_dump("Base");
}
}
class Child1 extends Base {
public function get() {
var_dump("Child");
}
}
class Child2 extends Base {
public function __construct() {
$this->get();
}
public function get() {
var_dump("Child");
}
}
new Base();
new Child1();
new Child2();
Warning: Declaration of Child1::get() should be compatible with Base::get(StdClass $foo) in /in/Rk7sS on line 17
Warning: Declaration of Child2::get() should be compatible with Base::get(StdClass $foo) in /in/Rk7sS on line 27
string(4) "Base"
string(4) "Base"
string(5) "Child"
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.23
Strict Standards: Declaration of Child1::get() should be compatible with Base::get(StdClass $foo) in /in/Rk7sS on line 17
Strict Standards: Declaration of Child2::get() should be compatible with Base::get(StdClass $foo) in /in/Rk7sS on line 27
string(4) "Base"
string(4) "Base"
string(5) "Child"