Why in php does redefining a private function with the same name as the parent class in the private method inside give a warning?


First of all, this is aStrictError, if you are not hereerror_reportingInside opens it, which is usually invisible. Here is my code


class A
    private function test($a, $b, $c)
        echo 'test';

class B extends A
    private function test($d)
        echo 'hello';

new B();

It will report an error

Strict Standards: Declaration of B::test() should be compatible with that of A::test() in /home/work/test.php on line 17

If it isPublicFunction overloading can still talk about the past, and I just used the method with the same name in the private function, but this is not an overload for subclasses, is it, why would this be a warning?

Post a link:http://stackoverflow.com/questions/31 …

In this case, STRICT mode requires:
1.access level is the same.
2. Same parameters
3. The default parameter values are the same