PHP : Does extending class need another 'use' to call namespace?

后端 未结 1 586
故里飘歌
故里飘歌 2020-12-11 00:14

I\'m wondering whether in the situation where I\'m extending a class that has already \'use\' keyword above it to use specific namespace - do I need to add another \'use\' a

1条回答
  •  一整个雨季
    2020-12-11 00:53

    No, you need the "use" statement in both files. Use is a file-level keyword and isn't affected by inheritance.

    See the scoping rules for importing and the little box describing what I said at the bottom of the manual page.

    0 讨论(0)
提交回复
热议问题