Why method renaming does not work in PHP traits?

冷暖自知 提交于 2019-12-04 03:50:19

As mentioned in the comments and for completeness; From the PHP manual section on Traits:

The Aliased_Talker makes use of the as operator to be able to use B's bigTalk implementation under an additional alias talk.

And then:

The as operator can be used to add an alias to one of the methods. Note the as operator does not rename the method and it does not affect any other method either.

So as adds an alias but does not replace or affect the original method in any way. This is the expected behavior.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!