Cannot implement two interfaces that have the same method name

后端 未结 5 1981
[愿得一人]
[愿得一人] 2021-01-13 07:28

This doesn\'t work:

interface TestInterface
{
    public function testMethod();
}

interface TestInterface2
{
    public function testMethod();
}

class Test         


        
5条回答
  •  再見小時候
    2021-01-13 08:03

    The PHP manual says explicitly:

    Prior to PHP 5.3.9, a class could not implement two interfaces that specified a method with the same name, since it would cause ambiguity. More recent versions of PHP allow this as long as the duplicate methods have the same signature.

提交回复
热议问题